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__Classrooms__Lists__Commo...

372 lines
949 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[47,5,6,7],{"+NIl":function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(Q,D){"use strict";function Z(_,S){_.cmdState.push(S)}function B(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function P(_){var S=_.cmdState.pop();S&&S.closeBracket()}function z(_){for(var S=_.cmdState,T=S.length-1;T>=0;T--){var h=S[T];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function j(_,S,T){return function(){this.name=_,this.bracketNo=0,this.style=S,this.styles=T,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=j("importmodule","tag",["string","builtin"]),I.documentclass=j("documentclass","tag",["","atom"]),I.usepackage=j("usepackage","tag",["atom"]),I.begin=j("begin","tag",["atom"]),I.end=j("end","tag",["atom"]),I.label=j("label","tag",["atom"]),I.ref=j("ref","tag",["atom"]),I.eqref=j("eqref","tag",["atom"]),I.cite=j("cite","tag",["atom"]),I.bibitem=j("bibitem","tag",["atom"]),I.Bibitem=j("Bibitem","tag",["atom"]),I.RBibitem=j("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(_,S){_.f=S}function v(_,S){var T;if(_.match(/^\\[a-zA-Z@]+/)){var h=_.current().slice(1);return T=I.hasOwnProperty(h)?I[h]:I.DEFAULT,T=new T,Z(S,T),k(S,O),T.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return k(S,function(l,d){return A(l,d,"\\]")}),"keyword";if(_.match("\\("))return k(S,function(l,d){return A(l,d,"\\)")}),"keyword";if(_.match("$$"))return k(S,function(l,d){return A(l,d,"$$")}),"keyword";if(_.match("$"))return k(S,function(l,d){return A(l,d,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(T=B(S),T)T.closeBracket(o),k(S,O);else return"error";return"bracket"}else return o=="{"||o=="["?(T=I.DEFAULT,T=new T,Z(S,T),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),T=z(S),T.name=="begin"&&(T.argument=_.current()),T.styleIdentifier())}function A(_,S,T){if(_.eatSpace())return null;if(T&&_.match(T))return k(S,v),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=_.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(_.skipToEnd(),"comment"):"error"}function O(_,S){var T=_.peek(),h;return T=="{"||T=="["?(h=B(S),h.openBracket(T),_.eat(T),k(S,v),"bracket"):/[ \t\r]/.test(T)?(_.eat(T),null):(k(S,v),P(S),v(_,S))}return{startState:function(){var _=D.inMathMode?function(S,T){return A(S,T)}:v;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,S){return S.f(_,S)},blankLine:function(_){_.f=v,_.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"19Vz":function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(j,I,k){var v=k&&k!=ue.Init;if(I&&!v)j.on("blur",B),j.on("change",P),j.on("swapDoc",P),ue.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Z(j)}),P(j);else if(!I&&v){j.off("blur",B),j.off("change",P),j.off("swapDoc",P),ue.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),Q(j);var A=j.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}I&&!j.hasFocus()&&B(j)});function Q(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){Q(j);var I=j.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=j.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var k=j.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),I.appendChild(k),j.display.lineSpace.insertBefore(I,j.display.lineSpace.firstChild)}function Z(j){setTimeout(function(){var I=!1,k=j.getInputField();k.nodeName=="TEXTAREA"?I=!k.value:j.lineCount()==1&&(I=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),I?D(j):Q(j)},20)}function B(j){z(j)&&D(j)}function P(j){var I=j.getWrapperElement(),k=z(j);I.className=I.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?D(j):Q(j)}function z(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){"use strict";var Q={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function(Z,B){var P=Z.indentUnit,z={},j=B.htmlMode?Q:D;for(var I in j)z[I]=j[I];for(var I in B)z[I]=B[I];var k,v;function A(a,x){function y(U){return x.tokenize=U,U(a,x)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(S("atom","]]>")):null:a.match("--")?y(S("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(T(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=S("meta","?>"),"meta"):(k=a.eat("/")?"closeTag":"openTag",x.tokenize=O,"tag bracket");if(E=="&"){var N;return a.eat("#")?a.eat("x")?N=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):N=a.eatWhile(/[\d]/)&&a.eat(";"):N=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),N?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function O(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=A,k=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return k="equals",null;if(y=="<"){x.tokenize=A,x.state=d,x.tagName=x.tagStart=null;var E=x.tokenize(a,x);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=_(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var x=function(y,E){for(;!y.eol();)if(y.next()==a){E.tokenize=O;break}return"string"};return x.isInAttribute=!0,x}function S(a,x){return function(y,E){for(;!y.eol();){if(y.match(x)){E.tokenize=A;break}y.next()}return a}}function T(a){return function(x,y){for(var E;(E=x.next())!=null;){if(E=="<")return y.tokenize=T(a+1),y.tokenize(x,y);if(E==">")if(a==1){y.tokenize=A;break}else return y.tokenize=T(a-1),y.tokenize(x,y)}return"meta"}}function h(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(z.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!z.contextGrabbers.hasOwnProperty(y)||!z.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function d(a,x,y){return a=="openTag"?(y.tagStart=x.column(),C):a=="closeTag"?p:d}function C(a,x,y){return a=="word"?(y.tagName=x.current(),v="tag",b):z.allowMissingTagName&&a=="endTag"?(v="tag bracket",b(a,x,y)):(v="error",C)}function p(a,x,y){if(a=="word"){var E=x.current();return y.context&&y.context.tagName!=E&&z.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==E||z.matchClosing===!1?(v="tag",f):(v="tag error",L)}else return z.allowMissingTagName&&a=="endTag"?(v="tag bracket",f(a,x,y)):(v="error",L)}function f(a,x,y){return a!="endTag"?(v="error",f):(o(y),d)}function L(a,x,y){return v="error",f(a,x,y)}function b(a,x,y){if(a=="word")return v="attribute",m;if(a=="endTag"||a=="selfcloseTag"){var E=y.tagName,N=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(E)?l(y,E):(l(y,E),y.context=new h(y,E,N==y.indented)),d}return v="error",b}function m(a,x,y){return a=="equals"?c:(z.allowMissing||(v="error"),b(a,x,y))}function c(a,x,y){return a=="string"?u:a=="word"&&z.allowUnquoted?(v="string",b):(v="error",b(a,x,y))}function u(a,x,y){return a=="string"?u:b(a,x,y)}return{startState:function(a){var x={tokenize:A,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;k=null;var y=x.tokenize(a,x);return(y||k)&&y!="comment"&&(v=null,x.state=x.state(k||y,a,x),v&&(y=v=="error"?y+" error":v)),y},indent:function(a,x,y){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(E&&E.noIndent)return ue.Pass;if(a.tokenize!=O&&a.tokenize!=A)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var N=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(N&&N[1])for(;E;)if(E.tagName==N[2]){E=E.prev;break}else if(z.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(N)for(;E;){var U=z.contextGrabbers[E.tagName];if(U&&U.hasOwnProperty(N[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return p});var ue=ae("+L6B"),Q=ae("2/Rp"),D=ae("2qtc"),Z=ae("kLXV"),B=ae("9og8"),P=ae("k1fw"),z=ae("miYZ"),j=ae("tsqr"),I=ae("oBTY"),k=ae("tJVT"),v=ae("DZo9"),A=ae("8z0m"),O=ae("WmNS"),_=ae.n(O),S=ae("q1tI"),T=ae.n(S),h=ae("m3rI"),o=ae("wzkS"),l=ae("y5JW"),d=ae("LtfV"),C=A.a.Dragger;function p(f){var L=[];return f&&f.length>0&&(L=f.map(function(b){return{uid:b.id,id:b.id,name:b.title+l.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),L}Je.b=function(f){var L=f.value,b=f.onChange,m=f.action,c=f.className,u=f.maxSize,a=u===void 0?150:u,x=f.title,y=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,E=f.showRemoveModal,N=E===void 0?!1:E,U=f.accept,K=U===void 0?"":U,V=f.additionalText,R=f.isDragger,M=f.number,$=M===void 0?1e3:M,ee=f.aloneClear,oe=ee===void 0?!1:ee,ce=f.restrict,De=ce===void 0?!0:ce,Ee=Object(S.useState)(!1),Ce=Object(k.a)(Ee,2),Te=Ce[0],we=Ce[1],me=Object(S.useState)(L||[]),le=Object(k.a)(me,2),te=le[0],he=le[1];Object(S.useEffect)(function(){L&&(he(Object(I.a)(L)),$===(L==null?void 0:L.length)&&we(!0))},[L]);var ie=function(){setTimeout(function(){te.pop(),he(Object(I.a)(te))},500)},Ae={multiple:!0,disabled:Te,accept:K,withCredentials:!0,fileList:te,beforeUpload:function(Oe,Me){var Ie=Oe.size/1024/1024;return te.concat(Me).length>$?(te.pop(),he(Object(I.a)(te)),j.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat($,"\u4E2A\u6587\u4EF6")),oe?Promise.reject():(ie(),!1)):Ie<a?!0:(j.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(a,"MB).")),oe?Promise.reject():(ie(),!1))},action:m||"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(Oe){var Me=Object(I.a)(Oe.fileList);Me.length>=$?we(!0):we(!1),he(Object(I.a)(Me)),Me=Me.map(function(Ie){var je;if(Ie!=null&&(je=Ie.response)!==null&&je!==void 0&&je.id){var Be;Ie.url="/api/attachments/".concat(Ie==null||((Be=Ie.response)===null||Be===void 0)?void 0:Be.id)}return Ie.name.indexOf(l.c)===-1&&(Ie.name="".concat(Ie.name).concat(l.c).concat(Object(l.a)(Ie.size))),Object(P.a)({},Ie)}),console.log("info:",Oe),b(Me)},onRemove:function(){var ye=Object(B.a)(_.a.mark(function Me(Ie){var je;return _.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(je=function(){var rt=Object(B.a)(_.a.mark(function qe(){var Ye,$e;return _.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:if(Ye=Ie.response?Ie.response.id:Ie.id,!Ye){Qe.next=8;break}return Qe.next=4,Object(o.d)(Ie.response?Ie.response.id:Ie.uid);case 4:return $e=Qe.sent,Qe.abrupt("return",$e);case 8:return Qe.abrupt("return",!0);case 9:case"end":return Qe.stop()}},qe)}));return function(){return rt.apply(this,arguments)}}(),!N){Ne.next=5;break}return Ne.abrupt("return",new Promise(function(rt,qe){Z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ye=Object(B.a)(_.a.mark(function ht(){var Qe;return _.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,je();case 2:Qe=Pe.sent,j.b.success("\u5220\u9664\u6210\u529F"),rt(!0);case 5:case"end":return Pe.stop()}},ht)}));function $e(){return Ye.apply(this,arguments)}return $e}(),onCancel:function(){return rt(!1)}})}));case 5:return Ne.next=7,je();case 7:return Ne.abrupt("return",Ne.sent);case 8:case"end":return Ne.stop()}},Me)}));function Oe(Me){return ye.apply(this,arguments)}return Oe}()};function Re(ye){ye.preventDefault(),ye.stopPropagation()}return T.a.createElement("div",{className:"multi-upload ".concat(c||"")},R&&T.a.createElement(C,Ae,T.a.createElement("p",{className:"ant-upload-drag-icon"},T.a.createElement(d.a,null)),T.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",T.a.createElement("br",null),T.a.createElement("span",{style:{display:De?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB) ")),V),!R&&T.a.createElement(A.a,Ae,T.a.createElement(Q.a,{disabled:Te},y),T.a.createElement("span",{onClick:Re,style:{marginLeft:10,color:"#FA6400",display:De?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return l}),ae.d(Je,"b",function(){return b});var ue=ae("Ty5D"),Q=ae("dI71"),D=ae("q1tI"),Z=ae.n(D),B=ae("YS25"),P=ae("17x9"),z=ae.n(P),j=ae("wx14"),I=ae("zLVn"),k=ae("9R94"),v=function(c){Object(Q.a)(u,c);function u(){for(var x,y=arguments.length,E=new Array(y),N=0;N<y;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.a)(x.props),x}var a=u.prototype;return a.render=function(){return Z.a.createElement(ue.c,{history:this.history,children:this.props.children})},u}(Z.a.Component),A=function(c){Object(Q.a)(u,c);function u(){for(var x,y=arguments.length,E=new Array(y),N=0;N<y;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.b)(x.props),x}var a=u.prototype;return a.render=function(){return Z.a.createElement(ue.c,{history:this.history,children:this.props.children})},u}(Z.a.Component),O=function(u,a){return typeof u=="function"?u(a):u},_=function(u,a){return typeof u=="string"?Object(B.c)(u,null,null,a):u},S=function(u){return u},T=Z.a.forwardRef;typeof T=="undefined"&&(T=S);function h(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=T(function(c,u){var a=c.innerRef,x=c.navigate,y=c.onClick,E=Object(I.a)(c,["innerRef","navigate","onClick"]),N=E.target,U=Object(j.a)({},E,{onClick:function(V){try{y&&y(V)}catch(R){throw V.preventDefault(),R}!V.defaultPrevented&&V.button===0&&(!N||N==="_self")&&!h(V)&&(V.preventDefault(),x())}});return S!==T?U.ref=u||a:U.ref=a,Z.a.createElement("a",U)}),l=T(function(c,u){var a=c.component,x=a===void 0?o:a,y=c.replace,E=c.to,N=c.innerRef,U=Object(I.a)(c,["component","replace","to","innerRef"]);return Z.a.createElement(ue.e.Consumer,null,function(K){K||Object(k.a)(!1);var V=K.history,R=_(O(E,K.location),K.location),M=R?V.createHref(R):"",$=Object(j.a)({},U,{href:M,navigate:function(){var oe=O(E,K.location),ce=y?V.replace:V.push;ce(oe)}});return S!==T?$.ref=u||N:$.innerRef=N,Z.a.createElement(x,$)})});if(!1)var d,C;var p=function(u){return u},f=Z.a.forwardRef;typeof f=="undefined"&&(f=p);function L(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(x){return x}).join(" ")}var b=f(function(c,u){var a=c["aria-current"],x=a===void 0?"page":a,y=c.activeClassName,E=y===void 0?"active":y,N=c.activeStyle,U=c.className,K=c.exact,V=c.isActive,R=c.location,M=c.sensitive,$=c.strict,ee=c.style,oe=c.to,ce=c.innerRef,De=Object(I.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Z.a.createElement(ue.e.Consumer,null,function(Ee){Ee||Object(k.a)(!1);var Ce=R||Ee.location,Te=_(O(oe,Ce),Ce),we=Te.pathname,me=we&&we.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),le=me?Object(ue.f)(Ce.pathname,{path:me,exact:K,sensitive:M,strict:$}):null,te=!!(V?V(le,Ce):le),he=te?L(U,E):U,ie=te?Object(j.a)({},ee,{},N):ee,Ae=Object(j.a)({"aria-current":te&&x||null,className:he,style:ie,to:Te},De);return p!==f?Ae.ref=u||ce:Ae.innerRef=ce,Z.a.createElement(l,Ae)})});if(!1)var m},"7Cbv":function(bt,Je,ae){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Q=new Uint8Array(16);function D(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(Q)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B(O){return typeof O=="string"&&Z.test(O)}for(var P=B,z=[],j=0;j<256;++j)z.push((j+256).toString(16).substr(1));function I(O){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(z[O[_+0]]+z[O[_+1]]+z[O[_+2]]+z[O[_+3]]+"-"+z[O[_+4]]+z[O[_+5]]+"-"+z[O[_+6]]+z[O[_+7]]+"-"+z[O[_+8]]+z[O[_+9]]+"-"+z[O[_+10]]+z[O[_+11]]+z[O[_+12]]+z[O[_+13]]+z[O[_+14]]+z[O[_+15]]).toLowerCase();if(!P(S))throw TypeError("Stringified UUID is invalid");return S}var k=I;function v(O,_,S){O=O||{};var T=O.random||(O.rng||D)();if(T[6]=T[6]&15|64,T[8]=T[8]&63|128,_){S=S||0;for(var h=0;h<16;++h)_[S+h]=T[h];return _}return k(T)}var A=Je.a=v},"7ahc":function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return C});var ue=ae("k1fw"),Q=ae("0Owb"),D=ae("+L6B"),Z=ae("2/Rp"),B=ae("y8nQ"),P=ae("Vl3Y"),z=ae("tJVT"),j=ae("OaEy"),I=ae("2fM7"),k=ae("q1tI"),v=ae.n(k),A=ae("VrN/"),O=ae.n(A),_=ae("p77/"),S=ae.n(_),T=ae("c5Ni"),h=ae.n(T),o=I.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};Je.b=function(p){var f=p.callback,L=p.onCancel,b=Object(k.useState)("python"),m=Object(z.a)(b,2),c=m[0],u=m[1];function a(y){u(d[y][1])}function x(y){f(y)}return v.a.createElement(P.a,Object(Q.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(I.a,{onChange:a},Object.keys(d).map(function(y){return v.a.createElement(o,{key:y,value:y},d[y][0])}))),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(C,{mode:c})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(Z.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function C(p){var f=p.value,L=p.onChange,b=p.mode,m=p.options,c=m===void 0?{}:m,u=Object(k.useRef)(),a=Object(k.useState)(),x=Object(z.a)(a,2),y=x[0],E=x[1];return Object(k.useEffect)(function(){if(y){function N(U){var K=U.getValue();L&&L(K)}return y.on("change",N),function(){y.off("change",N)}}},[y,L]),Object(k.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(k.useEffect)(function(){y&&((f!==y.getValue()||f==="")&&setTimeout(function(){y.setValue(f||" ")},300))},[y,f]),Object(k.useEffect)(function(){if(u.current&&!y){var N=O.a.fromTextArea(u.current,Object(ue.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(N)}},[u.current,y]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:u}))}},"8EBN":function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){"use strict";ue.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Q=0;Q<ue.modeInfo.length;Q++){var D=ue.modeInfo[Q];D.mimes&&(D.mime=D.mimes[0])}ue.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var P=ue.modeInfo[B];if(P.mime==Z)return P;if(P.mimes){for(var z=0;z<P.mimes.length;z++)if(P.mimes[z]==Z)return P}}if(/\+xml$/.test(Z))return ue.findModeByMIME("application/xml");if(/\+json$/.test(Z))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var P=ue.modeInfo[B];if(P.ext){for(var z=0;z<P.ext.length;z++)if(P.ext[z]==Z)return P}}},ue.findModeByFileName=function(Z){for(var B=0;B<ue.modeInfo.length;B++){var P=ue.modeInfo[B];if(P.file&&P.file.test(Z))return P}var z=Z.lastIndexOf("."),j=z>-1&&Z.substring(z+1,Z.length);if(j)return ue.findModeByExtension(j)},ue.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var P=ue.modeInfo[B];if(P.name.toLowerCase()==Z)return P;if(P.alias){for(var z=0;z<P.alias.length;z++)if(P.alias[z].toLowerCase()==Z)return P}}}})},"8hTe":function(bt,Je,ae){bt.exports={button:"button___1wy9m"}},"9Bee":function(bt,Je,ae){"use strict";var ue=ae("DYRE"),Q=ae("zeV3"),D=ae("+L6B"),Z=ae("2/Rp"),B=ae("k1fw"),P=ae("9og8"),z=ae("tJVT"),j=ae("WmNS"),I=ae.n(j),k=ae("q1tI"),v=ae.n(k),A=ae("vg9a"),O=ae("DlQD"),_=ae.n(O),S=ae("rUJ1");function T(G,s){var g=G.match(/^(\s+)(?:```)/);if(g===null)return s;var W=g[1];return s.split(`
`).map(function(X){var H=X.match(/^\s+/);if(H===null)return X;var ve=Object(z.a)(H,1),He=ve[0];return He.length>=W.length?X.slice(W.length):X}).join(`
`)}var h=[],o=["<ul>"],l=new _.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,o=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function f(G,s,g,W){if(s>=G.length||G[s].level<=g)return s;var X=G[s];W.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),s++;var H=[];return s=f(G,s,X.level,H),H.length>0&&(W.push("<ul>"),H.forEach(function(ve){W.push(ve)}),W.push("</ul>")),W.push("</li>"),s=f(G,s,g,W),s}function L(){return f(h,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(s){var g=d.exec(s);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(s){var g=this.rules.block.fences.exec(s);if(g){var W=g[0],X=T(W,g[3]||""),H=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(H)>=0){var ve=u(),He=X;X=ve,a[ve]={type:"block",expression:He}}return{type:"code",raw:W,lang:H,text:X}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function x(){return a}function y(){c=0,a={}}function E(G){return G=G.replace(m,function(s,g){var W=u();return a[W]={type:"inline",expression:g},W}),G}var N=l.listitem;l.listitem=function(G){return N(E(G))};var U=l.paragraph;l.paragraph=function(G){return U(E(G))};var K=l.tablecell;l.tablecell=function(G,s){return K(E(G),s)},l.code=function(G,s,g){var W=(s||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(G,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(g?G:Object(S.escape)(G,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(g?G:Object(S.escape)(G,!0))+"</code></pre>"},l.heading=function(G,s,g){var W=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:W,level:s,text:G}),"<h"+s+' id="'+W+'">'+G+"</h"+s+">"},_.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:b,renderer:l});var V=_.a,R=ae("SJMd"),M=ae("ulZh"),$=ae.n(M),ee=ae("m3rI"),oe=ae("Oy/b"),ce=ae("p5ED"),De=ae("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 Ee=function(G,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,W){g.__proto__=W}||function(g,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(g[X]=W[X])})(G,s)};function Ce(G,s){function g(){this.constructor=G}Ee(G,s),G.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function Te(G,s,g,W){return new(g||(g=Promise))(function(X,H){function ve(lt){try{Ze(W.next(lt))}catch(ze){H(ze)}}function He(lt){try{Ze(W.throw(lt))}catch(ze){H(ze)}}function Ze(lt){var ze;lt.done?X(lt.value):(ze=lt.value,ze instanceof g?ze:new g(function(Et){Et(ze)})).then(ve,He)}Ze((W=W.apply(G,s||[])).next())})}function we(G,s){var g,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(Ze){return function(lt){return function(ze){if(g)throw new TypeError("Generator is already executing.");for(;ve;)try{if(g=1,W&&(X=2&ze[0]?W.return:ze[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,ze[1])).done)return X;switch(W=0,X&&(ze=[2&ze[0],X.value]),ze[0]){case 0:case 1:X=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,W=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!X||ze[1]>X[0]&&ze[1]<X[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<X[1]){ve.label=X[1],X=ze;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(ze);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=s.call(G,ve)}catch(Et){ze=[6,Et],W=0}finally{g=X=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Ze,lt])}}}function me(){for(var G=0,s=0,g=arguments.length;s<g;s++)G+=arguments[s].length;var W=Array(G),X=0;for(s=0;s<g;s++)for(var H=arguments[s],ve=0,He=H.length;ve<He;ve++,X++)W[X]=H[ve];return W}var le=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(s,g){for(var W=0,X=g;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},G.createRect=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",g.toString()),W&&G.setAttributes(X,W),X},G.createLine=function(s,g,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",g.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&G.setAttributes(ve,H),ve},G.createPolygon=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),g&&G.setAttributes(W,g),W},G.createCircle=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),g&&G.setAttributes(W,g),W},G.createEllipse=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(g/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(g/2).toString()),W&&G.setAttributes(X,W),X},G.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&G.setAttributes(g,s),g},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(s,g,W,X,H,ve,He){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(Ze,[["id",s],["orient",g],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Ze.appendChild(He),Ze},G.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&G.setAttributes(g,s),g},G.createTSpan=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,g&&G.setAttributes(W,g),W},G.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&G.setAttributes(g,s),g},G.createPoint=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=g,W},G.createPath=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),g&&G.setAttributes(W,g),W},G}(),te=function(){function G(){}return G.addKey=function(s){G.key=s},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),he=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(s,g,W){var X=this;return new Promise(function(H){var ve=W!==void 0?W:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",g.width.baseVal.valueAsString),He.setAttribute("height",g.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+g.viewBox.baseVal.width.toString()+" "+g.viewBox.baseVal.height.toString()),He.innerHTML=g.innerHTML,X.naturalSize===!0?(He.width.baseVal.value=s.naturalWidth,He.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(He.width.baseVal.value=X.width,He.height.baseVal.value=X.height),ve.width=He.width.baseVal.value,ve.height=He.height.baseVal.value;var Ze=He.outerHTML,lt=ve.getContext("2d");X.markersOnly!==!0&&lt.drawImage(s,0,0,ve.width,ve.height);var ze=window.URL,Et=new Image(ve.width,ve.height);Et.setAttribute("crossOrigin","anonymous");var Dt=new Blob([Ze],{type:"image/svg+xml"}),Vt=ze.createObjectURL(Dt);Et.onload=function(){lt.drawImage(Et,0,0),ze.revokeObjectURL(Vt);var Ir=ve.toDataURL(X.imageType,X.imageQuality);H(Ir)},Et.src=Vt})},G}(),ie=function(){},Ae=function(){function G(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},G.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ye("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ye("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),Re=function(G,s){this.selector=G,this.style=s},ye=function(G,s){this.localName=G,this.style=s},Oe=function(){function G(s,g,W,X,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=g,this.markerItems=W,this.uiStyleSettings=X,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return G.prototype.show=function(s){var g=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(H){var ve=document.createElement("div");ve.className=""+g.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",H.typeName),ve.innerHTML=H.icon,ve.addEventListener("click",function(){g.markerToolbarButtonClicked(ve,H)}),g.buttons.push(ve),g.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 X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},G.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var g=0;g<this.markerButtons.length;g++)g<s||g===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[g]):(g===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[g]))}},G.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")},G.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(g){g.className=g.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),g.className=g.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),g.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(s,g,W){var X=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=g,H.setAttribute("data-action",W),H.addEventListener("click",function(){X.actionToolbarButtonClicked(H,W)}),W){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(H),this.buttons.push(H)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ye("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 ye("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ye("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ye("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 ye("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ye("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},G.prototype.markerToolbarButtonClicked=function(s,g){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(s,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},G.prototype.setActiveMarkerButton=function(s){var g=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===s});g&&this.setActiveButton(g)},G.prototype.setCurrentMarker=function(s){var g=this;this.currentMarker=s,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){g.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},G}(),Me=function(){function G(s,g,W,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=g,this.uiStyleSettings=W,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new ye("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 ye("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ye("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ye("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ye("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 ye("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ye("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
padding: `+g+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},G.prototype.show=function(s){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(s){var g,W,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ve;H.uiStyleSettings=X.uiStyleSettings;var He=document.createElement("div");He.className=X.toolboxButtonStyleClass.name+" "+((ve=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:X.toolboxButtonStyleColorsClass.name),He.innerHTML=H.icon,He.title=H.title,He.addEventListener("click",function(){X.panelButtonClick(H)}),X.panelButtons.push(He),X.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(s){var g=this,W=-1;if(s!==this.activePanel){W=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ve){var He,Ze;H.className=g.toolboxButtonStyleClass.name+" "+(ve===W?""+((He=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:g.toolboxActiveButtonStyleColorsClass.name):""+((Ze=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:g.toolboxButtonStyleColorsClass.name))})},G}(),Ie=function(G,s){this.title=G,this.icon=s},je=function(G){function s(g,W,X,H){var ve=G.call(this,g,H||'<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=W,ve.currentColor=X,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(X){var H=g.getColorBox(X);W.appendChild(H),g.colorBoxes.push(H)}),W},s.prototype.getColorBox=function(g){var W=this,X=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-X,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=H-2+"px",ve.style.height=H-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=(H+2)/2+"px",ve.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){W.setCurrentColor(g,ve)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=H-2+"px",He.style.height=H-2+"px",He.style.backgroundColor=g,He.style.borderRadius=H/2+"px",g==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.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(He),ve},s.prototype.setCurrentColor=function(g,W){var X=this;this.currentColor=g,this.colorBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},s}(Ie),Be=function(){function G(s,g,W){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=g,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(s){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(s,g){},G.prototype.dblClick=function(s,g){},G.prototype.manipulate=function(s){},G.prototype.pointerUp=function(s){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},G.prototype.scale=function(s,g){},G.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},G.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},G.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},G.typeName="MarkerBase",G}(),Ne=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},G}(),rt=function(){function G(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},G}(),qe=function(){function G(){}return G.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},G.toSVGMatrix=function(s,g){return s.a=g.a,s.b=g.b,s.c=g.c,s.d=g.d,s.e=g.e,s.f=g.f,s},G}(),Ye=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(le.createTransform()),H.setupControlBox(),H}return Ce(s,G),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(g){this._visual=g;var W=le.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!!G.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(g);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.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"},s.prototype.pointerUp=function(g){var W=this.state;G.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},s.prototype.manipulate=function(g){var W=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(g)},s.prototype.resize=function(g){var W=this.manipulationStartLeft,X=this.manipulationStartWidth,H=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+g.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+g.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+g.y-this.manipulationStartY}X>=0?(this.left=W,this.width=X):(this.left=W+X,this.width=-X),ve>=0?(this.top=H,this.height=ve):(this.top=H+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var W=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},s.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},s.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var W=this.container.getCTM(),X=le.createPoint(g.x,g.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var W=this.container.getCTM();W=W.inverse();var X=le.createPoint(g.x,g.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var g=le.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.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 Ne,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,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()},s.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()},s.prototype.createGrip=function(){var g=new rt;return g.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,W=-g/2,X=W,H=(this.width+this.CB_DISTANCE)/2-g/2,ve=(this.height+this.CB_DISTANCE)/2-g/2,He=this.height+this.CB_DISTANCE-g/2,Ze=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,W,X),this.positionGrip(this.controlGrips.topCenter.visual,H,X),this.positionGrip(this.controlGrips.topRight.visual,Ze,X),this.positionGrip(this.controlGrips.centerLeft.visual,W,ve),this.positionGrip(this.controlGrips.centerRight.visual,Ze,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,W,He),this.positionGrip(this.controlGrips.bottomCenter.visual,H,He),this.positionGrip(this.controlGrips.bottomRight.visual,Ze,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(g,W,X){var H=g.transform.baseVal.getItem(0);H.setTranslate(W,X),g.transform.baseVal.replaceItem(H,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var W=g;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W);var X=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:X.x*g,y:X.y*W});this.left=H.x,this.top=H.y,this.width=this.width*g,this.height=this.height*W,this.adjustControlBox()},s}(Be),$e=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.prototype.createVisual=function(){this.visual=le.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)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){G.prototype.resize.call(this,g),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){G.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this))},s.prototype.restoreState=function(g){var W=g;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.setSize()},s.title="Rectangle marker",s}(Ye),ht=function(G){function s(g,W,X,H){var ve=G.call(this,g,H||'<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=W,ve.currentWidth=X,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentWidth(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=X.toString(),ve.style.marginRight="5px",H.appendChild(ve);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var Ze=document.createElement("hr");Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop=X+"px solid "+g.uiStyleSettings.toolboxColor,Ze.style.flexGrow="2",He.appendChild(Ze),H.appendChild(He),g.widthBoxes.push(H)}),W},s.prototype.setCurrentWidth=function(g,W){var X=this;this.currentWidth=g,this.widthBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ie),Qe=function(G){function s(g,W,X,H){var ve=G.call(this,g,H||'<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=W,ve.currentStyle=X,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.styles.length-5+"%",H.style.borderColor=X===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentStyle(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+g.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;ve.innerHTML=He,H.appendChild(ve),g.styleBoxes.push(H)}),W},s.prototype.setCurrentStyle=function(g,W){var X=this;this.currentStyle=g,this.styleBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ie),nt=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}($e),Pe=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},ct=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!!G.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(g){var W=this.state;G.prototype.pointerUp.call(this,g),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(g),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},s.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var g=new rt;return g.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},s.prototype.positionGrip=function(g,W,X){var H=g.transform.baseVal.getItem(0);H.setTranslate(W,X),g.transform.baseVal.replaceItem(H,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var W=g;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.x1=this.x1*g,this.y1=this.y1*W,this.x2=this.x2*g,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},s}(Be),at=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.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)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var W=g;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(ct),Ue=function(G){function s(g,W,X,H){var ve=G.call(this,g,H||'<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=W,ve.currentFont=X,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(X){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.fonts.length-5+"%",H.style.borderColor=X===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentFont(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=X,ve.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(He),H.appendChild(ve),g.fontBoxes.push(H)}),W},s.prototype.setCurrentFont=function(g,W){var X=this;this.currentFont=g,this.fontBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ie),Ke=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=X.defaultColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new je("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Ue("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return Ce(s,G),s.prototype.ownsTarget=function(g){if(G.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(X){X===g&&(W=!0)}),W},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.renderText=function(){var g=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(W){g.textElement.appendChild(le.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var g=this.textElement.getBBox(),W=1;if(g.width>0&&g.height>0){var X=(1*this.width-this.width*this.padding*2/100)/g.width,H=(1*this.height-this.height*this.padding*2/100)/g.height;W=Math.min(X,H)}return W},s.prototype.getTextPosition=function(g){var W=this.textElement.getBBox(),X=0,H=0;return W.width>0&&W.height>0&&(X=(this.width-W.width*g)/2,H=this.height/2-W.height*g/2),{x:X,y:H}},s.prototype.sizeText=function(){var g=this.textElement.getBBox(),W=this.getTextScale(),X=this.getTextPosition(W);X.y-=g.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},s.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(g){G.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(g){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,g),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var g=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&W>.9;)W-=.1,g.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var X=W.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(X)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var g=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),H={x:X.width*g,y:X.height*g};W.x-=H.x/2,W.y-=H.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},s.prototype.dblClick=function(g,W){G.prototype.dblClick.call(this,g,W),this.showTextEditor()},s.prototype.setColor=function(g){this.textElement&&le.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},s.prototype.setFont=function(g){this.textElement&&le.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(Ye),xe=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=X.defaultColor,H.lineWidth=X.defaultStrokeWidth,H.pixelRatio=X.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new je("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var g=le.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(g,W){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(g.x,g.y),this.drawing=!0):G.prototype.pointerDown.call(this,g,W)},s.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){G.prototype.resize.call(this,g),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,g)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),G.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=W[0],H=W[1],ve=W[2],He=W[3],Ze=!1,lt=0;lt<this.canvasElement.height;lt++)for(var ze=0;ze<this.canvasElement.width;ze++)g.data[lt*this.canvasElement.width*4+4*ze+3]>0&&(Ze=!0,lt<H&&(H=lt),ze<X&&(X=ze),lt>He&&(He=lt),ze>ve&&(ve=ze));if(Ze){this.left=X/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ve-X)/this.pixelRatio,this.height=(He-H)/this.pixelRatio;var Et=document.createElement("canvas");Et.width=ve-X,Et.height=He-H,Et.getContext("2d").putImageData(this.canvasContext.getImageData(X,H,ve-X,He-H),0,0),this.drawingImgUrl=Et.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},s.prototype.setLineWidth=function(g){this.lineWidth=g},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){this.createVisual(),G.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(Ye),ge=function(G){function s(g,W,X){var H=G.call(this,g,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=W,H.setCurrentType=H.setCurrentType.bind(H),H}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var X=function(He){var Ze="both";switch(He){case 0:Ze="both";break;case 1:Ze="start";break;case 2:Ze="end";break;case 3:Ze="none"}var lt=document.createElement("div");if(lt.style.display="flex",lt.style.flexGrow="2",lt.style.alignItems="center",lt.style.justifyContent="space-between",lt.style.padding="5px",lt.style.borderWidth="2px",lt.style.borderStyle="solid",lt.style.borderColor=Ze===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){g.setCurrentType(Ze,lt)}),W.appendChild(lt),Ze==="both"||Ze==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ze.style.marginLeft="5px",lt.appendChild(ze)}var Et=document.createElement("div");Et.style.display="flex",Et.style.alignItems="center",Et.style.minHeight="20px",Et.style.flexGrow="2";var Dt=document.createElement("hr");if(Dt.style.minWidth="20px",Dt.style.border="0px",Dt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Dt.style.flexGrow="2",Et.appendChild(Dt),lt.appendChild(Et),Ze==="both"||Ze==="end"){var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Vt.style.marginRight="5px",lt.appendChild(Vt)}H.typeBoxes.push(lt)},H=this,ve=0;ve<4;ve++)X(ve);return W},s.prototype.setCurrentType=function(g,W){var X=this;this.currentType=g,this.typeBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ie),be=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ge("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},s.prototype.getArrowPoints=function(g,W){var X=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return g-X/2+","+(W+H/2)+" "+g+","+(W-H/2)+" "+(g+X/2)+","+(W+H/2)},s.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(g){this.arrowType=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var W=g;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(at),re=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.fillColor=X.defaultFillColor,H.strokeWidth=0,H.fillPanel=new je("Color",X.defaultColorSet,X.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}($e),ne=function(G){function s(g,W,X,H){var ve=G.call(this,g,H||'<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=W,ve.currentOpacity=X,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ce(s,G),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentOpacity(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=100*X+"%",H.appendChild(ve),g.opacityBoxes.push(H)}),W},s.prototype.setCurrentOpacity=function(g,W){var X=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ie),se=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=X.defaultHighlightColor,H.strokeWidth=0,H.opacity=X.defaultHighlightOpacity,H.fillPanel=new je("Color",X.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ce(s,G),s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(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(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=X.defaultStrokeColor,H.bgColor=X.defaultFillColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new je("Text color",X.defaultColorSet,H.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>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new je("Fill color",X.defaultColorSet,H.bgColor,de),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Ue("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new rt,H.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return Ce(s,G),s.prototype.ownsTarget=function(g){return G.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},s.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(g,W){this.state==="new"&&G.prototype.pointerDown.call(this,g,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,g,W)},s.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,g);else{var W=this.state==="creating";G.prototype.pointerUp.call(this,g),this.setTipPoints(W),this.positionTip()}},s.prototype.manipulate=function(g){if(this.tipMoving){var W=this.unrotatePoint(g);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,g)},s.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",g]]),le.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},s.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},s.prototype.setTipPoints=function(g){g===void 0&&(g=!1);var W=Math.min(this.height/2,15),X=this.height/5;g&&(this.tipPosition={x:W+X/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+X,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-X},this.tipBase2Position={x:this.width,y:this.height-W}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-X})},s.prototype.resize=function(g){G.prototype.resize.call(this,g),this.positionTip()},s.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var g=this.tipGrip.visual.transform.baseVal.getItem(0);g.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(g,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),G.prototype.select.call(this)},s.prototype.getState=function(){var g=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,G.prototype.restoreState.call(this,g),this.createTip(),this.setTipPoints()},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.tipPosition={x:this.tipPosition.x*g,y:this.tipPosition.y*W},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(Ke),Se=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.fillColor=X.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new je("Line color",me(X.defaultColorSet,["transparent"]),X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new je("Fill color",me(X.defaultColorSet,["transparent"]),H.fillColor,de),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.prototype.createVisual=function(){this.visual=le.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)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){G.prototype.resize.call(this,g),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),le.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(g){G.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){G.prototype.scale.call(this,g,W),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(Ye),We=function(G){function s(g,W,X){return G.call(this,g,W,X)||this}return Ce(s,G),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==this.tip2)},s.prototype.createTips=function(){this.tip1=le.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(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.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(le.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.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()]]),le.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 g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(at),it=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.strokePanel.colors=X.defaultColorSet,H.fillColor="transparent",H}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(Se),ft=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},G.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),st=function(G){function s(g,W,X){var H=G.call(this,g,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new je("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Qe("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,G),s.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.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)},s.prototype.pointerDown=function(g,W){G.prototype.pointerDown.call(this,g,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,G.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/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()))},s.prototype.manipulate=function(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),G.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),G.prototype.resize.call(this,g),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},s.prototype.scale=function(g,W){this.curveX=this.curveX*g,this.curveY=this.curveY*W,G.prototype.scale.call(this,g,W)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var W=g;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(ct),wt=function(){function G(s,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=g}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),St=function(G){function s(g,W,X){var H=G.call(this,g,!1)||this;return H.dataUrl=W,H.state=X,H}return Ce(s,G),s}(wt),dt=function(G){function s(g,W,X){X===void 0&&(X=!1);var H=G.call(this,g,X)||this;return H.marker=W,H}return Ce(s,G),s}(wt),Gt=function(){function G(){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 G.prototype.addEventListener=function(s,g){this[s].push(g)},G.prototype.removeEventListener=function(s,g){var W=this[s].indexOf(g);W>-1&&this[s].splice(W,1)},G}(),It=function(){function G(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Pe,this._isOpen=!1,this.undoRedoManager=new ft,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 Gt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,it,Se,se,Le,We,re,at,st]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,Se,se,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[nt,xe,be,Ke,se]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var g=this;this._availableMarkerTypes.splice(0),s.forEach(function(W){if(typeof W=="string"){var X=g.ALL_MARKER_TYPES.find(function(H){return H.typeName===W});X!==void 0&&g._availableMarkerTypes.push(X)}else g._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.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},G.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ie.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ie.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(g){return g(new wt(s))})},G.prototype.render=function(){return Te(this,void 0,void 0,function(){var s;return we(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(s=new he).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return g.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},G.prototype.close=function(s){var g=this;if(s===void 0&&(s=!1),this.isOpen){var W=!1;s||this.eventListeners.beforeclose.forEach(function(X){var H=new wt(g,!0);X(H),H.defaultPrevented&&(W=!0)}),W||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new wt(g))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var s,g=[],W=0;W<arguments.length;W++)g[W]=arguments[W];(s=this._availableMarkerTypes).push.apply(s,g)},G.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(g){s(g.dataUrl,g.state)})},G.prototype.removeRenderEventListener=function(s){},G.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},G.prototype.removeCloseEventListener=function(s){},G.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,W=g<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(g,W)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(s,g){this._isResizing=!0;var W=s/this.imageWidth,X=g/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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(W,X),this._isResizing=!1},G.prototype.scaleMarkers=function(s,g){var W,X=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(s,g):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==X._currentMarker&&H.scale(s,g)}),W!==void 0&&this.setCurrentMarker(W)},G.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"},G.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left,this.top=s.top-g.top},G.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)},G.prototype.addDefs=function(){for(var s,g=[],W=0;W<arguments.length;W++)g[W]=arguments[W];this.defs=le.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,g)},G.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},G.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)},G.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},G.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},G.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)},G.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},G.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)},G.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},G.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")},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 Oe(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 Me(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},G.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},G.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())},G.prototype.toolbarButtonClicked=function(s,g){if(s==="marker"&&g!==void 0)this.createNewMarker(g);else if(s==="action")switch(g){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()}},G.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var H=new dt(s,s._currentMarker,!0);X(H),H.defaultPrevented&&(g=!0)}),!g){var W=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new dt(s,W))})}}},G.prototype.clear=function(){var s=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var He=new dt(s,void 0,!0);ve(He),He.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var W=function(ve){var He=X.markers[ve];X.setCurrentMarker(X.markers[ve]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(Ze){return Ze(new dt(s,He))})},X=this,H=this.markers.length-1;H>=0;H--)W(H);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},G.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)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===g.width&&W.height===g.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}else this.undoRedoManager.replaceLastUndoStep(g),this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var s=this,g=this.undoRedoManager.undo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var s=this,g=this.undoRedoManager.redo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},G.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},G.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},G.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var s,g,W=this;return we(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),g=this.getState(),this.eventListeners.render.forEach(function(H){return H(new St(W,s,g))}),this.close(!0),[2]}})})},G.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var g={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return g.markers.push(W.getState())}),g},G.prototype.restoreState=function(s){var g=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(W){var X=g._availableMarkerTypes.find(function(ve){return ve.typeName===W.typeName});if(X!==void 0){var H=g.addNewMarker(X);H.restoreState(W),g.markers.push(H)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(W){return W(new wt(g))})},G.prototype.addNewMarker=function(s){var g=le.createGroup();return this.markerImage.appendChild(g),new s(g,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(s){var g,W=this;(g=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(g),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(g.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new dt(W,W._currentMarker))}))},G.prototype.markerCreated=function(s){var g=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new dt(g,g._currentMarker))})},G.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},G.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},G.prototype.markerStateChanged=function(s){var g=this;this.eventListeners.markerchange.forEach(function(W){return W(new dt(g,s))})},G.prototype.setCurrentMarker=function(s){var g=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new dt(g,g._currentMarker))})),this._currentMarker=s,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(W){return W(new dt(g,g._currentMarker))}))},G.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var g=this.markers.find(function(W){return W.ownsTarget(s.target)});g!==void 0?(this.setCurrentMarker(g),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},G.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var g=this.markers.find(function(W){return W.ownsTarget(s.target)});g!==void 0&&g!==this._currentMarker&&this.setCurrentMarker(g),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},G.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},G.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(s,g){var W=this.markerImage.getBoundingClientRect();return{x:(s-W.left)/this.zoomLevel,y:(g-W.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},G.prototype.addLicenseKey=function(s){te.addKey(s)},G.prototype.addEventListener=function(s,g){this.eventListeners.addEventListener(s,g)},G.prototype.removeEventListener=function(s,g){this.eventListeners.removeEventListener(s,g)},G.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(g){return g(new wt(s))}))},G.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new wt(s))}))},G.instanceCounter=0,G}();/* **********************************
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(G,s){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,W){g.__proto__=W}||function(g,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(g[X]=W[X])})(G,s)};function Wt(G,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function g(){this.constructor=G}Kt(G,s),G.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function _t(G,s,g,W){return new(g||(g=Promise))(function(X,H){function ve(lt){try{Ze(W.next(lt))}catch(ze){H(ze)}}function He(lt){try{Ze(W.throw(lt))}catch(ze){H(ze)}}function Ze(lt){var ze;lt.done?X(lt.value):(ze=lt.value,ze instanceof g?ze:new g(function(Et){Et(ze)})).then(ve,He)}Ze((W=W.apply(G,s||[])).next())})}function Wr(G,s){var g,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(Ze){return function(lt){return function(ze){if(g)throw new TypeError("Generator is already executing.");for(;ve;)try{if(g=1,W&&(X=2&ze[0]?W.return:ze[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,ze[1])).done)return X;switch(W=0,X&&(ze=[2&ze[0],X.value]),ze[0]){case 0:case 1:X=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,W=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!X||ze[1]>X[0]&&ze[1]<X[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<X[1]){ve.label=X[1],X=ze;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(ze);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=s.call(G,ve)}catch(Et){ze=[6,Et],W=0}finally{g=X=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Ze,lt])}}}var ai=function(){function G(){}return G.addKey=function(s){G.key=s},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),vt=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(s,g){for(var W=0,X=g;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},G.createRect=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",g.toString()),W&&G.setAttributes(X,W),X},G.createLine=function(s,g,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",g.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&G.setAttributes(ve,H),ve},G.createPolygon=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),g&&G.setAttributes(W,g),W},G.createCircle=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),g&&G.setAttributes(W,g),W},G.createEllipse=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(g/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(g/2).toString()),W&&G.setAttributes(X,W),X},G.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&G.setAttributes(g,s),g},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(s,g,W,X,H,ve,He){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(Ze,[["id",s],["orient",g],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Ze.appendChild(He),Ze},G.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&G.setAttributes(g,s),g},G.createTSpan=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,g&&G.setAttributes(W,g),W},G.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&G.setAttributes(g,s),g},G.createPoint=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=g,W},G.createPath=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),g&&G.setAttributes(W,g),W},G.createElement=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg",s);return g&&G.setAttributes(W,g),W},G.getHollowRectanglePath=function(s,g,W,X,H,ve,He,Ze){return"M"+s+","+g+"V"+(g+X)+"H"+(s+W)+"V"+g+"H"+H+"V"+ve+"H"+(H+He)+"V"+(ve+Ze)+"H"+H+"V"+g+"Z"},G}(),Vr=function(){function G(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},G.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new nr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new cr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new cr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},G.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),nr=function(G,s){this.selector=G,this.style=s},cr=function(G,s){this.localName=G,this.style=s},Hr=function(){function G(){this.blocks=[],this.display=""}return G.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},G.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},G.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(g){return s.appendChild(g.getUI())}),s},G}(),oi=function(){function G(){}return G.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},G}(),si=function(G){function s(){var g=G!==null&&G.apply(this,arguments)||this;return g.buttons=[],g}return Wt(s,G),s.prototype.addButton=function(g){g.className=this.buttonClassName,g.colorsClassName=this.buttonColorsClassName,g.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(g)},s.prototype.getUI=function(){var g=G.prototype.getUI.call(this);return this.buttons.forEach(function(W){return g.appendChild(W.getUI())}),g},s}(oi),Pt=function(){function G(s,g){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=g,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(G.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},G.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,"")))},G.prototype.hide=function(){this._isHidden=!0},G}(),pt=function(G){function s(){var g=G!==null&&G.apply(this,arguments)||this;return g.elements=[],g}return Wt(s,G),s.prototype.addElement=function(g){this.elements.push(g)},s.prototype.getUI=function(){var g=G.prototype.getUI.call(this);return this.elements.forEach(function(W){return g.appendChild(W)}),g},s}(oi),Pr=function(){function G(s,g){this.horizontal=s,this.vertical=g}return Object.defineProperty(G.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),G.prototype.getVerticalLength=function(s){return s/this.ratio},G.prototype.getHorizontalLength=function(s){return s*this.ratio},G}(),li=function(){function G(){}return G.getIcon=function(s,g){if(s>0&&g>0){var W=new Pr(s,g),X=W.ratio>=1?20:W.getHorizontalLength(20),H=W.ratio<1?20:W.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 He=vt.createDefs();ve.appendChild(He);var Ze=vt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(Ze);var lt=vt.createPath(vt.getHollowRectanglePath((24-X)/2,(24-H)/2,X,H,(24-X)/2+2,(24-H)/2+2,X-4,H-4));ve.appendChild(lt);var ze=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(vt.createTSpan(s+":"+g)),ve.appendChild(ze);var Et=ze.getBBox();vt.setAttributes(ze,[["x",((24-Et.width)/2).toString()],["y",((24-Et.height)/2-Et.y).toString()]]);var Dt=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Et.width))/2,(24-Math.ceil(Et.height))/2,Math.ceil(Et.width),Math.ceil(Et.height)));return Ze.appendChild(Dt),vt.setAttributes(lt,[["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>'},G}(),xr=function(G){function s(g,W,X){var H=G.call(this,g,W)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=X,H}return Wt(s,G),s.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=g.className,W.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Pt),Lt=function(){function G(s,g){this.GRIP_SIZE=10,this.color=s,this.fillColor=g,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},G.prototype.setCenter=function(s,g){this.visual.childNodes.forEach(function(W){return vt.setAttributes(W,[["cx",s.toString()],["cy",g.toString()]])})},G}(),Mr=function(){function G(s,g,W,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=g,this.margin=W,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(G.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var s=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;g<this.numberOfGridLines;g++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},G.prototype.setCropRectangle=function(s){this.cropRect=s;var g=Object.assign({},this.cropRect);this.zoomFactor!==1&&(g.width=this.cropRect.width*this.zoomFactor,g.height=this.cropRect.height*this.zoomFactor,g.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-g.width/2,g.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),vt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var W=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ve){var He=g.y+W*(ve+1);vt.setAttributes(H,[["x1",""+g.x],["y1",""+He],["x2",""+(g.x+g.width)],["y2",""+He]])});var X=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ve){var He=g.x+X*(ve+1);vt.setAttributes(H,[["x1",""+He],["y1",""+g.y],["x2",""+He],["y2",""+(g.y+g.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.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)},G.prototype.clientToLocalCoordinates=function(s,g){var W=this.container.getBoundingClientRect();return{x:s-W.left+this.margin,y:g-W.top+this.margin}},G.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},G.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(g)}s.preventDefault()},G.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},G.prototype.move=function(s){var g=s.x-this.previousPoint.x,W=s.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},G.prototype.resize=function(s){var g=Object.assign({},this.cropRect),W=s.x-this.previousPoint.x,X=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+W<this.margin&&(W=this.margin-g.x),g.x+=W,g.width=this.cropRect.x+this.cropRect.width-g.x;break;case this.bottomRightGrip:case this.topRightGrip:g.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-g.width),g.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=X,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=X}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=s,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,g=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=s-this.cropRect.width/2,this.cropRect.y=g-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)}},G.prototype.getRescaledRect=function(s,g,W,X,H,ve){var He=W/s,Ze=X/g;return{x:(H.x-ve)*He+ve,y:(H.y-ve)*Ze+ve,width:H.width*He,height:H.height*Ze}},G.prototype.scaleCanvas=function(s,g){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,g,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=g,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},G}(),Xr=function(){function G(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(G.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.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},G.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},G.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},G.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},G.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},G.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var X=W%5==0?this.height/3:this.height/6;g+="h4v"+-X+"h1v"+X}g+="v1H0Z",this.scaleShape=vt.createPath(g);var H=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),s.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=vt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},G}(),ui=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(s,g,W,X,H,ve,He){var Ze=this;return new Promise(function(lt){var ze=document.createElement("canvas");ze.width=s.width.baseVal.value-2*X,ze.height=s.height.baseVal.value-2*X;var Et=1,Dt=1;Ze.naturalSize===!0?(Et=g.naturalWidth/(s.width.baseVal.value-2*X)/ve,Dt=g.naturalHeight/(s.height.baseVal.value-2*X)/He,ze.width=g.naturalWidth/ve,ze.height=g.naturalHeight/He):Ze.width!==void 0&&Ze.height!==void 0&&(Et=Ze.width/W.width,Dt=Ze.height/W.height,ze.width*=Et,ze.height*=Dt);var Vt=ze.getContext("2d");Vt.translate(ze.width/2,ze.height/2),Vt.rotate(H*Math.PI/180),Vt.scale(ve,He),Vt.translate(-ze.width/2,-ze.height/2),Vt.drawImage(g,0,0,ze.width,ze.height);var Ir=document.createElement("canvas");Ir.width=W.width*Et,Ir.height=W.height*Dt,Ir.getContext("2d").putImageData(Vt.getImageData((W.x-X)*Et,(W.y-X)*Dt,W.width*Et,W.height*Dt),0,0),lt(Ir.toDataURL(Ze.imageType,Ze.imageQuality))})},G}(),Ve=function(){function G(s){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=G.instanceCounter++,this.styles=new Vr(this.instanceNo),this.target=s,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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),G.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},G.prototype.show=function(){this.showUI(),this.open()},G.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(g){return g()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},G.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},G.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},G.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},G.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=g+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(g,W)}},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.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",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},G.prototype.resize=function(s,g){this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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()},G.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var g=s.toDataURL();vt.setAttributes(this.editingTarget,[["href",g]]),this.setEditingTargetSize()},G.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left-this.CANVAS_MARGIN,this.top=s.top-g.top-this.CANVAS_MARGIN},G.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=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var g=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(g),this.editingTargetContainer=vt.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)},G.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},G.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Mr(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()},G.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,g=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=s+"px "+g+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-g+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},G.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)},G.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},G.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,g=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Hr,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 g=new si;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var W=[];this.aspectRatios.forEach(function(Dt){var Vt=new Pt(li.getIcon(Dt.horizontal,Dt.vertical),Dt.horizontal===0&&Dt.vertical===0?"FREE":Dt.horizontal+":"+Dt.vertical);Vt.onClick=function(){return s.ratioButtonClicked(Dt)},W.push(Vt)}),this.aspectRatioButton=new xr(li.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Pt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){s.isGridVisible=!s.isGridVisible,X.isActive=s.isGridVisible},g.addButton(X);var H=new Pt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(H.isActive=this.zoomToCropEnabled,H.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,H.isActive=s.zoomToCropEnabled},g.addButton(H),!ai.isLicensed){var ve=new pt;this.topToolbar.addElementBlock(ve);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ze=document.createElement("a");Ze.style.color="currentColor",Ze.href="https://markerjs.com/products/cropro",Ze.target="_blank",Ze.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>',He.appendChild(Ze),ve.addElement(He)}var lt=new si;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var ze=new Pt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");ze.onClick=this.startRenderAndClose,lt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Et=new Pt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Et.onClick=this.close,lt.addButton(Et),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Et.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Hr,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 g=new si;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var W=new Pt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");W.onClick=this.rotateLeftButtonClicked,g.addButton(W);var X=new Pt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,g.addButton(X);var H=new pt;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new Xr("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(lt){s.rotateBy(lt),s.straightener.angle=s.rotationAngle},H.addElement(this.straightener.getUI());var ve=new si;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var He=new Pt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");He.onClick=this.flipHorizontallyButtonClicked,ve.addButton(He);var Ze=new Pt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Ze.onClick=this.flipVerticallyButtonClicked,ve.addButton(Ze)},G.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Pr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(s){if(s){var g=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(s,g){var W=this.cropImage.getBoundingClientRect();return{x:s-W.left,y:g-W.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},G.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},G.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},G.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},G.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},G.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return _t(this,void 0,void 0,function(){var s,g;return Wr(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return s=W.sent(),g=this.getState(),this.renderEventListeners.forEach(function(X){return X(s,g)}),this.close(!0),[2]}})})},G.prototype.render=function(){return _t(this,void 0,void 0,function(){var s;return Wr(this,function(g){switch(g.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 g.sent(),[4,s.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,g.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new cr("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 cr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new cr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new cr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new cr("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 cr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new cr("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 cr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new cr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},G.instanceCounter=0,G}(),Tt=ae("8hTe"),hi=ae.n(Tt),_i=/<pre[^>]*>/g;function di(G){var s=document.createElement("div");return s.innerHTML=G,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Li=Je.a=function(G){var s=G.value,g=s===void 0?"":s,W=G.edit,X=W===void 0?!1:W,H=G.className,ve=G.showTextOnly,He=G.showLines,Ze=G.replaces,lt=G.zoomImg,ze=G.hasMask,Et=G.style,Dt=Et===void 0?{}:Et,Vt=G.stylesPrev,Ir=Vt===void 0?{}:Vt,Nr=String(g),ar=Object(k.useRef)(),zr=Object(k.useRef)(),Hi=Object(k.useState)(""),Er=Object(z.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(k.useState)("office"),Yr=Object(z.a)(gi,2),ci=Yr[0],ei=Yr[1],dn=function(){var Nt=new Ve(zr.current);Nt.displayMode="popup",Nt.addRenderEventListener(function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return ar.current.style.display="none",Qt.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er}});case 3:Ft=Qt.sent,Ft!=null&&Ft.id&&Ze(zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 5:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show()},zi=function(){var Nt=new It(zr.current);Nt.settings.displayMode="popup",Nt.addEventListener("render",function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(ar.current.style.display="none",!zr.current){Qt.next=6;break}return Qt.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er.dataUrl}});case 4:Ft=Qt.sent,Ft!=null&&Ft.id&&Ze(zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 6:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show(),window.markerArea=Nt},$r=Object(k.useMemo)(function(){try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Nr=Nr.replace(Zt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(fr,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),Nr=Nr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ti){}var Mt=V(Nr),er=x();if(Nr.match(/\[TOC\]/)&&(Mt=Mt.replace("<p>[TOC]</p>",L()),C()),Mt=Mt.replace(/(__special_katext_id_\d+__)/g,function(ti,Qt){var Sr=er[Qt],Gi=Sr.type,Ki=Sr.expression;return Object(oe.renderToString)(di(Ki)||"",{displayMode:Gi==="block",throwOnError:!1,output:"html"})}),Mt=Mt.replace(/▁/g,"\u2581\u2581\u2581"),y(),ve){var Ft=document.createElement("div");return Ft.innerHTML=Mt,Ft.innerText}return setTimeout(function(){return Di()},500),Mt},[Nr]),Ur=Object(k.useRef)();p.WebkitLineClamp=He,He&&(Dt=Object(B.a)(Object(B.a)({},Dt),p));function ki(Zt){var Nt=Zt.target;if(Nt.tagName.toUpperCase()==="IMG"){if(lt){var fr=Nt.getAttribute("src");kr(fr),ei("image")}}else if(Nt.tagName.toUpperCase()==="A"){var Mt=Nt.getAttribute("href");if(Mt.indexOf("office")>-1)Zt.preventDefault(),kr(Mt),ei("office");else if(Mt.indexOf("application/pdf")>-1)Zt.preventDefault(),kr(Mt),ei("pdf");else if(Mt.indexOf("type=text")>-1)Zt.preventDefault(),kr(Mt),ei("html");else if(Mt.startsWith("#")){Zt.preventDefault();var er=document.getElementById(Mt.replace("#",""));er&&er.scrollIntoView(!0)}}}var Di=function(){var Nt,fr=(Nt=Ur.current)===null||Nt===void 0?void 0:Nt.querySelectorAll("video");fr==null||fr.forEach(function(Mt){if(Mt.oncontextmenu=function(){return!1},Mt.src.indexOf(".m3u8")>-1&&!Mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var er=new $.a;er.loadSource(Mt.src),er.attachMedia(Mt)}}})};Object(k.useEffect)(function(){if(Ur.current&&$r&&($r.match(_i)&&window.PR.prettyPrint()),Ur.current)return Ur.current.addEventListener("click",ki),function(){Ur.current.removeEventListener("click",ki),y(),C()}},[$r,Ur.current,ki]);var cn=function(Nt){if(!X)return;Nt.target.nodeName==="IMG"?(ar.current.style.display="flex",ar.current.style.width=Nt.target.clientWidth+"px",ar.current.style.height=Nt.target.clientHeight+"px",ar.current.style.top=Nt.target.offsetTop+"px",ar.current.style.left=Nt.target.offsetLeft+"px",zr.current.src=Nt.target.getAttribute("src")):ar.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Ur,style:Object(B.a)({},Dt),className:"".concat(H||""," markdown-body ").concat(hi.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:$r}}),v.a.createElement("div",{ref:ar,className:hi.a.button},v.a.createElement(Q.a,null,v.a.createElement(Z.a,{onClick:function(){return dn()}},"\u88C1\u526A"),v.a.createElement(Z.a,{onClick:function(){return zi()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:zr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(ce.a,{close:!0,data:Br,hasMask:ze,type:Br!=null&&Br.length?ci:"",style:Object(B.a)({},Ir),onClose:function(){return kr("")}}))}},"9VGf":function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return D});var ue=ae("q1tI"),Q=ae.n(ue);function D(Z,B){var P=Object(ue.useRef)();Object(ue.useEffect)(function(){P.current=Z}),Object(ue.useEffect)(function(){function z(){P.current()}if(B!==null){var j=setInterval(z,B);return function(){return clearInterval(j)}}},[B])}},BU3w:function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return P});var ue=ae("MNnm"),Q="rc-util-key";function D(z){if(z.attachTo)return z.attachTo;var j=document.querySelector("head");return j||document.body}function Z(z){var j,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var k=document.createElement("style");if((j=I.csp)===null||j===void 0?void 0:j.nonce){var v;k.nonce=(v=I.csp)===null||v===void 0?void 0:v.nonce}k.innerHTML=z;var A=D(I),O=A.firstChild;return I.prepend&&A.prepend?A.prepend(k):I.prepend&&O?A.insertBefore(k,O):A.appendChild(k),k}var B=new Map;function P(z,j){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=D(I);if(!B.has(k)){var v=Z("",I),A=v.parentNode;B.set(k,A),A.removeChild(v)}var O=Array.from(B.get(k).children).find(function(o){return o.tagName==="STYLE"&&o[Q]===j});if(O){var _,S;if(((_=I.csp)===null||_===void 0?void 0:_.nonce)&&O.nonce!==((S=I.csp)===null||S===void 0?void 0:S.nonce)){var T;O.nonce=(T=I.csp)===null||T===void 0?void 0:T.nonce}return O.innerHTML!==z&&(O.innerHTML=z),O}var h=Z(z,I);return h[Q]=j,h}},Bd2K:function(bt,Je,ae){(function(ue){ue(ae("VrN/"),ae("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(I,k,v){if(v!=ue.Init&&v&&I.removeKeyMap("autoCloseTags"),!k)return;var A={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(A["'/'"]=function(O){return P(O)}),(typeof k!="object"||k.whenOpening!==!1)&&(A["'>'"]=function(O){return Z(O)}),I.addKeyMap(A)});var Q=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Z(I){if(I.getOption("disableInput"))return ue.Pass;for(var k=I.listSelections(),v=[],A=I.getOption("autoCloseTags"),O=0;O<k.length;O++){if(!k[O].empty())return ue.Pass;var _=k[O].head,S=I.getTokenAt(_),T=ue.innerMode(I.getMode(),S.state),h=T.state,o=T.mode.xmlCurrentTag&&T.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return ue.Pass;var d=T.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||d&&Q,p=typeof A=="object"&&A.indentTags||d&&D;S.end>_.ch&&(l=l.slice(0,l.length-S.end+_.ch));var f=l.toLowerCase();if(!l||S.type=="string"&&(S.end!=_.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&o.close||S.string.indexOf("/")==_.ch-S.start-1||C&&z(C,f)>-1||j(I,T.mode.xmlCurrentContext&&T.mode.xmlCurrentContext(h)||[],l,_,!0))return ue.Pass;var L=typeof A=="object"&&A.emptyTags;if(L&&z(L,l)>-1){v[O]={text:"/>",newPos:ue.Pos(_.line,_.ch+2)};continue}var b=p&&z(p,f)>-1;v[O]={indent:b,text:">"+(b?`
`:"")+"</"+l+">",newPos:b?ue.Pos(_.line+1,0):ue.Pos(_.line,_.ch+1)}}for(var m=typeof A=="object"&&A.dontIndentOnAutoClose,O=k.length-1;O>=0;O--){var c=v[O];I.replaceRange(c.text,k[O].head,k[O].anchor,"+insert");var u=I.listSelections().slice(0);u[O]={head:c.newPos,anchor:c.newPos},I.setSelections(u),!m&&c.indent&&(I.indentLine(c.newPos.line,null,!0),I.indentLine(c.newPos.line+1,null,!0))}}function B(I,k){for(var v=I.listSelections(),A=[],O=k?"/":"</",_=I.getOption("autoCloseTags"),S=typeof _=="object"&&_.dontIndentOnSlash,T=0;T<v.length;T++){if(!v[T].empty())return ue.Pass;var h=v[T].head,o=I.getTokenAt(h),l=ue.innerMode(I.getMode(),o.state),d=l.state;if(k&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return ue.Pass;var C,p=l.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(p&&l.mode.name=="javascript")C=O+"script";else if(p&&l.mode.name=="css")C=O+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!f||f.length&&j(I,f,f[f.length-1],h))return ue.Pass;C=O+f[f.length-1]}I.getLine(h.line).charAt(o.end)!=">"&&(C+=">"),A[T]=C}if(I.replaceSelections(A),v=I.listSelections(),!S)for(var T=0;T<v.length;T++)(T==v.length-1||v[T].head.line<v[T+1].head.line)&&I.indentLine(v[T].head.line)}function P(I){return I.getOption("disableInput")?ue.Pass:B(I,!0)}ue.commands.closeTag=function(I){return B(I)};function z(I,k){if(I.indexOf)return I.indexOf(k);for(var v=0,A=I.length;v<A;++v)if(I[v]==k)return v;return-1}function j(I,k,v,A,O){if(!ue.scanForClosingTag)return!1;var _=Math.min(I.lastLine()+1,A.line+500),S=ue.scanForClosingTag(I,A,null,_);if(!S||S.tag!=v)return!1;for(var T=O?1:0,h=k.length-1;h>=0&&k[h]==v;h--)++T;A=S.to;for(var h=1;h<T;h++){var o=ue.scanForClosingTag(I,A,null,_);if(!o||o.tag!=v)return!1;A=o.to}return!0}})},BjJ7:function(bt,Je,ae){"use strict";ae.d(Je,"d",function(){return Q}),ae.d(Je,"c",function(){return D}),ae.d(Je,"e",function(){return Z}),ae.d(Je,"b",function(){return B}),ae.d(Je,"a",function(){return z});var ue=ae("m3rI");function Q(j){var I=!0;if(j.length>0){for(var k=0;k<j.length;k++)if(j[k].compile_success==0||!j[k].compile_success){I=!1;break}}else I=!1;return I}function D(j){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",k=[],v=0;v<j.length;v++){var A=j[v],O=I?"".concat(I,"/").concat(A.name):"".concat(A.name);k.push({title:A.name,isLeaf:!(A.type==="tree"),key:O})}return k}function Z(j,I,k){for(var v=0;v<j.length;v++){var A=j[v];if(A.key===I){A.children=k;break}A.children&&Z(A.children,I,k)}return j}function B(j,I,k){var v;return function(){var A=this,O=arguments,_=function(){v=null,k||j.apply(A,O)},S=k&&!v;clearTimeout(v),v=setTimeout(_,I),S&&j.apply(A,O)}}var P=!0,z=ue.a.API_SERVER},"C+DQ":function(bt,Je,ae){},DlQD:function(bt,Je,ae){(function(ue,Q){bt.exports=Q()})(this,function(){"use strict";function ue(xe,ge){for(var be=0;be<ge.length;be++){var re=ge[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(xe,re.key,re)}}function Q(xe,ge,be){return ge&&ue(xe.prototype,ge),be&&ue(xe,be),xe}function D(xe,ge){if(!xe)return;if(typeof xe=="string")return Z(xe,ge);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Z(xe,ge)}function Z(xe,ge){(ge==null||ge>xe.length)&&(ge=xe.length);for(var be=0,re=new Array(ge);be<ge;be++)re[be]=xe[be];return re}function B(xe,ge){var be;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(be=D(xe))||ge&&xe&&typeof xe.length=="number"){be&&(xe=be);var re=0;return function(){return re>=xe.length?{done:!0}:{done:!1,value:xe[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 be=xe[Symbol.iterator](),be.next.bind(be)}function P(xe,ge){return ge={exports:{}},xe(ge,ge.exports),ge.exports}var z=P(function(xe){function ge(){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 be(re){xe.exports.defaults=re}xe.exports={defaults:ge(),getDefaults:ge,changeDefaults:be}}),j=z.defaults,I=z.getDefaults,k=z.changeDefaults,v=/[&<>"']/,A=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},T=function(ge){return S[ge]};function h(xe,ge){if(ge){if(v.test(xe))return xe.replace(A,T)}else if(O.test(xe))return xe.replace(_,T);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(xe){return xe.replace(o,function(ge,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var d=/(^|[^\[])\^/g;function C(xe,ge){xe=xe.source||xe,ge=ge||"";var be={replace:function(ne,se){return se=se.source||se,se=se.replace(d,"$1"),xe=xe.replace(ne,se),be},getRegex:function(){return new RegExp(xe,ge)}};return be}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(xe,ge,be){if(xe){var re;try{re=decodeURIComponent(l(be)).replace(p,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ge&&!f.test(be)&&(be=a(ge,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ne){return null}return be}var b={},m=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,ge){b[" "+xe]||(m.test(xe)?b[" "+xe]=xe+"/":b[" "+xe]=N(xe,"/",!0)),xe=b[" "+xe];var be=xe.indexOf(":")===-1;return ge.substring(0,2)==="//"?be?ge:xe.replace(c,"$1")+ge:ge.charAt(0)==="/"?be?ge:xe.replace(u,"$1")+ge:xe+ge}var x={exec:function(){}};function y(xe){for(var ge=1,be,re;ge<arguments.length;ge++){be=arguments[ge];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(xe[re]=be[re])}return xe}function E(xe,ge){var be=xe.replace(/\|/g,function(se,de,Le){for(var Se=!1,We=de;--We>=0&&Le[We]==="\\";)Se=!Se;return Se?"|":" |"}),re=be.split(/ \|/),ne=0;if(re.length>ge)re.splice(ge);else for(;re.length<ge;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function N(xe,ge,be){var re=xe.length;if(re===0)return"";for(var ne=0;ne<re;){var se=xe.charAt(re-ne-1);if(se===ge&&!be)ne++;else if(se!==ge&&be)ne++;else break}return xe.substr(0,re-ne)}function U(xe,ge){if(xe.indexOf(ge[1])===-1)return-1;for(var be=xe.length,re=0,ne=0;ne<be;ne++)if(xe[ne]==="\\")ne++;else if(xe[ne]===ge[0])re++;else if(xe[ne]===ge[1]&&(re--,re<0))return ne;return-1}function K(xe){xe&&xe.sanitize&&!xe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:l,edit:C,cleanUrl:L,resolveUrl:a,noopTest:x,merge:y,splitCells:E,rtrim:N,findClosingBracket:U,checkSanitizeDeprecation:K},R=z.defaults,M=V.rtrim,$=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function ce(xe,ge,be){var re=ge.href,ne=ge.title?ee(ge.title):null,se=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ne,text:se}:{type:"image",raw:be,href:re,title:ne,text:ee(se)}}function De(xe,ge){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return ge;var re=be[1];return ge.split(`
`).map(function(ne){var se=ne.match(/^\s+/);if(se===null)return ne;var de=se[0];return de.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var Ee=function(){function xe(be){this.options=be||R}var ge=xe.prototype;return ge.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ge.code=function(re,ne){var se=this.rules.block.code.exec(re);if(se){var de=ne[ne.length-1];if(de&&de.type==="paragraph")return{raw:se[0],text:se[0].trimRight()};var Le=se[0].replace(/^ {4}/gm,"");return{type:"code",raw:se[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:M(Le,`
`)}}},ge.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var se=ne[0],de=De(se,ne[3]||"");return{type:"code",raw:se,lang:ne[2]?ne[2].trim():ne[2],text:de}}},ge.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ge.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(se.header.length===se.align.length){var de=se.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(de=se.cells.length,Le=0;Le<de;Le++)se.cells[Le]=$(se.cells[Le],se.header.length);return se}}},ge.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},ge.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var se=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:se}}},ge.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var se=ne[0],de=ne[2],Le=de.length>1,Se=de[de.length-1]===")",We={type:"list",raw:se,ordered:Le,start:Le?+de.slice(0,-1):"",loose:!1,items:[]},it=ne[0].match(this.rules.block.item),ft=!1,st,wt,St,dt,Gt,It,Kt,Wt=it.length,_t=0;_t<Wt;_t++)st=it[_t],se=st,wt=st.length,st=st.replace(/^ *([*+-]|\d+[.)]) */,""),~st.indexOf(`
`)&&(wt-=st.length,st=this.options.pedantic?st.replace(/^ {1,4}/gm,""):st.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),_t!==Wt-1&&(St=this.rules.block.bullet.exec(it[_t+1])[0],(Le?St.length===1||!Se&&St[St.length-1]===")":St.length>1||this.options.smartLists&&St!==de)&&(dt=it.slice(_t+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-dt.length),_t=Wt-1)),Gt=ft||/\n\n(?!\s*$)/.test(st),_t!==Wt-1&&(ft=st.charAt(st.length-1)===`
`,Gt||(Gt=ft)),Gt&&(We.loose=!0),It=/^\[[ xX]\] /.test(st),Kt=void 0,It&&(Kt=st[1]!==" ",st=st.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:se,task:It,checked:Kt,loose:Gt,text:st});return We}},ge.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ee(ne[0]):ne[0]}},ge.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var se=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:se,raw:ne[0],href:ne[2],title:ne[3]}}},ge.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(se.header.length===se.align.length){se.raw=ne[0];var de=se.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(de=se.cells.length,Le=0;Le<de;Le++)se.cells[Le]=$(se.cells[Le].replace(/^ *\| *| *\| *$/g,""),se.header.length);return se}}},ge.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ge.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ge.text=function(re,ne){var se=this.rules.block.text.exec(re);if(se){var de=ne[ne.length-1];return de&&de.type==="text"?{raw:se[0],text:se[0]}:{type:"text",raw:se[0],text:se[0]}}},ge.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ee(ne[1])}},ge.tag=function(re,ne,se){var de=this.rules.inline.tag.exec(re);if(de)return!ne&&/^<a /i.test(de[0])?ne=!0:ne&&/^<\/a>/i.test(de[0])&&(ne=!1),!se&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?se=!0:se&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(se=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ne,inRawBlock:se,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]}},ge.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var se=oe(ne[2],"()");if(se>-1){var de=ne[0].indexOf("!")===0?5:4,Le=de+ne[1].length+se;ne[2]=ne[2].substring(0,se),ne[0]=ne[0].substring(0,Le).trim(),ne[3]=""}var Se=ne[2],We="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);it?(Se=it[1],We=it[3]):We=""}else We=ne[3]?ne[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=ce(ne,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ne[0]);return ft}},ge.reflink=function(re,ne){var se;if((se=this.rules.inline.reflink.exec(re))||(se=this.rules.inline.nolink.exec(re))){var de=(se[2]||se[1]).replace(/\s+/g," ");if(de=ne[de.toLowerCase()],!de||!de.href){var Le=se[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Se=ce(se,de,se[0]);return Se}},ge.strong=function(re,ne,se){se===void 0&&(se="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Se;(de=Le.exec(ne))!=null;)if(Se=this.rules.inline.strong.middle.exec(ne.slice(0,de.index+3)),Se)return{type:"strong",raw:re.slice(0,Se[0].length),text:re.slice(2,Se[0].length-2)}}},ge.em=function(re,ne,se){se===void 0&&(se="");var de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Se;(de=Le.exec(ne))!=null;)if(Se=this.rules.inline.em.middle.exec(ne.slice(0,de.index+2)),Se)return{type:"em",raw:re.slice(0,Se[0].length),text:re.slice(1,Se[0].length-1)}}},ge.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var se=ne[2].replace(/\n/g," "),de=/[^ ]/.test(se),Le=se.startsWith(" ")&&se.endsWith(" ");return de&&Le&&(se=se.substring(1,se.length-1)),se=ee(se,!0),{type:"codespan",raw:ne[0],text:se}}},ge.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},ge.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ge.autolink=function(re,ne){var se=this.rules.inline.autolink.exec(re);if(se){var de,Le;return se[2]==="@"?(de=ee(this.options.mangle?ne(se[1]):se[1]),Le="mailto:"+de):(de=ee(se[1]),Le=de),{type:"link",raw:se[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},ge.url=function(re,ne){var se;if(se=this.rules.inline.url.exec(re)){var de,Le;if(se[2]==="@")de=ee(this.options.mangle?ne(se[0]):se[0]),Le="mailto:"+de;else{var Se;do Se=se[0],se[0]=this.rules.inline._backpedal.exec(se[0])[0];while(Se!==se[0]);de=ee(se[0]),se[1]==="www."?Le="http://"+de:Le=de}return{type:"link",raw:se[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},ge.inlineText=function(re,ne,se){var de=this.rules.inline.text.exec(re);if(de){var Le;return ne?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]:Le=ee(this.options.smartypants?se(de[0]):de[0]),{type:"text",raw:de[0],text:Le}}},xe}(),Ce=V.noopTest,Te=V.edit,we=V.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:Ce,table:Ce,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=Te(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=Te(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Te(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=Te(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Te(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=Te(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=we({},me),me.gfm=we({},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=Te(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=Te(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=we({},me.normal,{html:Te(`^ *(?: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:Ce,paragraph:Te(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 le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=Te(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Te(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Te(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Te(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Te(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Te(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Te(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Te(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Te(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Te(le._blockSkip,"g").getRegex(),le.overlapSkip=Te(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Te(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Te(le.tag).replace("comment",me._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Te(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Te(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Te(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=we({},le),le.pedantic=we({},le.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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=we({},le.normal,{escape:Te(le.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=Te(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=we({},le.gfm,{br:Te(le.br).replace("{2,}","*").getRegex(),text:Te(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:me,inline:le},he=z.defaults,ie=te.block,Ae=te.inline;function Re(xe){return xe.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 ye(xe){var ge="",be,re,ne=xe.length;for(be=0;be<ne;be++)re=xe.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),ge+="&#"+re+";";return ge}var Oe=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||he,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ie.normal,inline:Ae.normal};this.options.pedantic?(re.block=ie.pedantic,re.inline=Ae.pedantic):this.options.gfm&&(re.block=ie.gfm,this.options.breaks?re.inline=Ae.breaks:re.inline=Ae.gfm),this.tokenizer.rules=re}xe.lex=function(re,ne){var se=new xe(ne);return se.lex(re)};var ge=xe.prototype;return ge.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},ge.blockTokens=function(re,ne,se){ne===void 0&&(ne=[]),se===void 0&&(se=!0),re=re.replace(/^ +$/gm,"");for(var de,Le,Se,We;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&ne.push(de);continue}if(de=this.tokenizer.code(re,ne)){re=re.substring(de.raw.length),de.type?ne.push(de):(We=ne[ne.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],se),ne.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Se=de.items.length,Le=0;Le<Se;Le++)de.items[Le].tokens=this.blockTokens(de.items[Le].text,[],!1);ne.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(se&&(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),ne.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(se&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.text(re,ne)){re=re.substring(de.raw.length),de.type?ne.push(de):(We=ne[ne.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(re){var it="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return ne},ge.inline=function(re){var ne,se,de,Le,Se,We,it=re.length;for(ne=0;ne<it;ne++){We=re[ne];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},Le=We.header.length,se=0;se<Le;se++)We.tokens.header[se]=[],this.inlineTokens(We.header[se],We.tokens.header[se]);for(Le=We.cells.length,se=0;se<Le;se++)for(Se=We.cells[se],We.tokens.cells[se]=[],de=0;de<Se.length;de++)We.tokens.cells[se][de]=[],this.inlineTokens(Se[de],We.tokens.cells[se][de]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(Le=We.items.length,se=0;se<Le;se++)this.inline(We.items[se].tokens);break}}}return re},ge.inlineTokens=function(re,ne,se,de,Le){ne===void 0&&(ne=[]),se===void 0&&(se=!1),de===void 0&&(de=!1),Le===void 0&&(Le="");var Se,We=re,it;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ft.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Se=this.tokenizer.escape(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.tag(re,se,de)){re=re.substring(Se.raw.length),se=Se.inLink,de=Se.inRawBlock,ne.push(Se);continue}if(Se=this.tokenizer.link(re)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ne.push(Se);continue}if(Se=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ne.push(Se);continue}if(Se=this.tokenizer.strong(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.em(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.codespan(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.br(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.del(re)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.autolink(re,ye)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(!se&&(Se=this.tokenizer.url(re,ye))){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.inlineText(re,de,Re)){re=re.substring(Se.raw.length),Le=Se.raw.slice(-1),ne.push(Se);continue}if(re){var st="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return ne},Q(xe,null,[{key:"rules",get:function(){return{block:ie,inline:Ae}}}]),xe}(),Me=z.defaults,Ie=V.cleanUrl,je=V.escape,Be=function(){function xe(be){this.options=be||Me}var ge=xe.prototype;return ge.code=function(re,ne,se){var de=(ne||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(re,de);Le!=null&&Le!==re&&(se=!0,re=Le)}return de?'<pre><code class="'+this.options.langPrefix+je(de,!0)+'">'+(se?re:je(re,!0))+`</code></pre>
`:"<pre><code>"+(se?re:je(re,!0))+`</code></pre>
`},ge.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ge.html=function(re){return re},ge.heading=function(re,ne,se,de){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+de.slug(se)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},ge.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ge.list=function(re,ne,se){var de=ne?"ol":"ul",Le=ne&&se!==1?' start="'+se+'"':"";return"<"+de+Le+`>
`+re+"</"+de+`>
`},ge.listitem=function(re){return"<li>"+re+`</li>
`},ge.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(re){return"<p>"+re+`</p>
`},ge.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},ge.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ge.tablecell=function(re,ne){var se=ne.header?"th":"td",de=ne.align?"<"+se+' align="'+ne.align+'">':"<"+se+">";return de+re+"</"+se+`>
`},ge.strong=function(re){return"<strong>"+re+"</strong>"},ge.em=function(re){return"<em>"+re+"</em>"},ge.codespan=function(re){return"<code>"+re+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(re){return"<del>"+re+"</del>"},ge.link=function(re,ne,se){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var de='<a href="'+je(re)+'"';return ne&&(de+=' title="'+ne+'"'),de+=">"+se+"</a>",de},ge.image=function(re,ne,se){if(re=Ie(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var de='<img src="'+re+'" alt="'+se+'"';return ne&&(de+=' title="'+ne+'"'),de+=this.options.xhtml?"/>":">",de},ge.text=function(re){return re},xe}(),Ne=function(){function xe(){}var ge=xe.prototype;return ge.strong=function(re){return re},ge.em=function(re){return re},ge.codespan=function(re){return re},ge.del=function(re){return re},ge.html=function(re){return re},ge.text=function(re){return re},ge.link=function(re,ne,se){return""+se},ge.image=function(re,ne,se){return""+se},ge.br=function(){return""},xe}(),rt=function(){function xe(){this.seen={}}var ge=xe.prototype;return ge.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var se=ne;do this.seen[se]++,ne=se+"-"+this.seen[se];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},xe}(),qe=z.defaults,Ye=V.unescape,$e=function(){function xe(be){this.options=be||qe,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new rt}xe.parse=function(re,ne){var se=new xe(ne);return se.parse(re)};var ge=xe.prototype;return ge.parse=function(re,ne){ne===void 0&&(ne=!0);var se="",de,Le,Se,We,it,ft,st,wt,St,dt,Gt,It,Kt,Wt,_t,Wr,ai,vt,Vr=re.length;for(de=0;de<Vr;de++){dt=re[de];switch(dt.type){case"space":continue;case"hr":{se+=this.renderer.hr();continue}case"heading":{se+=this.renderer.heading(this.parseInline(dt.tokens),dt.depth,Ye(this.parseInline(dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{se+=this.renderer.code(dt.text,dt.lang,dt.escaped);continue}case"table":{for(wt="",st="",We=dt.header.length,Le=0;Le<We;Le++)st+=this.renderer.tablecell(this.parseInline(dt.tokens.header[Le]),{header:!0,align:dt.align[Le]});for(wt+=this.renderer.tablerow(st),St="",We=dt.cells.length,Le=0;Le<We;Le++){for(ft=dt.tokens.cells[Le],st="",it=ft.length,Se=0;Se<it;Se++)st+=this.renderer.tablecell(this.parseInline(ft[Se]),{header:!1,align:dt.align[Se]});St+=this.renderer.tablerow(st)}se+=this.renderer.table(wt,St);continue}case"blockquote":{St=this.parse(dt.tokens),se+=this.renderer.blockquote(St);continue}case"list":{for(Gt=dt.ordered,It=dt.start,Kt=dt.loose,We=dt.items.length,St="",Le=0;Le<We;Le++)_t=dt.items[Le],Wr=_t.checked,ai=_t.task,Wt="",_t.task&&(vt=this.renderer.checkbox(Wr),Kt?_t.tokens.length>0&&_t.tokens[0].type==="text"?(_t.tokens[0].text=vt+" "+_t.tokens[0].text,_t.tokens[0].tokens&&_t.tokens[0].tokens.length>0&&_t.tokens[0].tokens[0].type==="text"&&(_t.tokens[0].tokens[0].text=vt+" "+_t.tokens[0].tokens[0].text)):_t.tokens.unshift({type:"text",text:vt}):Wt+=vt),Wt+=this.parse(_t.tokens,Kt),St+=this.renderer.listitem(Wt,ai,Wr);se+=this.renderer.list(St,Gt,It);continue}case"html":{se+=this.renderer.html(dt.text);continue}case"paragraph":{se+=this.renderer.paragraph(this.parseInline(dt.tokens));continue}case"text":{for(St=dt.tokens?this.parseInline(dt.tokens):dt.text;de+1<Vr&&re[de+1].type==="text";)dt=re[++de],St+=`
`+(dt.tokens?this.parseInline(dt.tokens):dt.text);se+=ne?this.renderer.paragraph(St):St;continue}default:{var nr='Token with "'+dt.type+'" type was not found.';if(this.options.silent){console.error(nr);return}else throw new Error(nr)}}}return se},ge.parseInline=function(re,ne){ne=ne||this.renderer;var se="",de,Le,Se=re.length;for(de=0;de<Se;de++){Le=re[de];switch(Le.type){case"escape":{se+=ne.text(Le.text);break}case"html":{se+=ne.html(Le.text);break}case"link":{se+=ne.link(Le.href,Le.title,this.parseInline(Le.tokens,ne));break}case"image":{se+=ne.image(Le.href,Le.title,Le.text);break}case"strong":{se+=ne.strong(this.parseInline(Le.tokens,ne));break}case"em":{se+=ne.em(this.parseInline(Le.tokens,ne));break}case"codespan":{se+=ne.codespan(Le.text);break}case"br":{se+=ne.br();break}case"del":{se+=ne.del(this.parseInline(Le.tokens,ne));break}case"text":{se+=ne.text(Le.text);break}default:{var We='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return se},xe}(),ht=V.merge,Qe=V.checkSanitizeDeprecation,nt=V.escape,Pe=z.getDefaults,ct=z.changeDefaults,at=z.defaults;function Ue(xe,ge,be){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ge=="function"&&(be=ge,ge=null),ge=ht({},Ue.defaults,ge||{}),Qe(ge),be){var re=ge.highlight,ne;try{ne=Oe.lex(xe,ge)}catch(Se){return be(Se)}var se=function(We){var it;if(!We)try{it=$e.parse(ne,ge)}catch(ft){We=ft}return ge.highlight=re,We?be(We):be(null,it)};if(!re||re.length<3)return se();if(delete ge.highlight,!ne.length)return se();var de=0;Ue.walkTokens(ne,function(Se){Se.type==="code"&&(de++,setTimeout(function(){re(Se.text,Se.lang,function(We,it){if(We)return se(We);it!=null&&it!==Se.text&&(Se.text=it,Se.escaped=!0),de--,de===0&&se()})},0))}),de===0&&se();return}try{var Le=Oe.lex(xe,ge);return ge.walkTokens&&Ue.walkTokens(Le,ge.walkTokens),$e.parse(Le,ge)}catch(Se){if(Se.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+nt(Se.message+"",!0)+"</pre>";throw Se}}Ue.options=Ue.setOptions=function(xe){return ht(Ue.defaults,xe),ct(Ue.defaults),Ue},Ue.getDefaults=Pe,Ue.defaults=at,Ue.use=function(xe){var ge=ht({},xe);if(xe.renderer&&function(){var re=Ue.defaults.renderer||new Be,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,it=new Array(We),ft=0;ft<We;ft++)it[ft]=arguments[ft];var st=xe.renderer[Le].apply(re,it);return st===!1&&(st=Se.apply(re,it)),st}};for(var se in xe.renderer)ne(se);ge.renderer=re}(),xe.tokenizer&&function(){var re=Ue.defaults.tokenizer||new Ee,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,it=new Array(We),ft=0;ft<We;ft++)it[ft]=arguments[ft];var st=xe.tokenizer[Le].apply(re,it);return st===!1&&(st=Se.apply(re,it)),st}};for(var se in xe.tokenizer)ne(se);ge.tokenizer=re}(),xe.walkTokens){var be=Ue.defaults.walkTokens;ge.walkTokens=function(re){xe.walkTokens(re),be&&be(re)}}Ue.setOptions(ge)},Ue.walkTokens=function(xe,ge){for(var be=B(xe),re;!(re=be()).done;){var ne=re.value;ge(ne);switch(ne.type){case"table":{for(var se=B(ne.tokens.header),de;!(de=se()).done;){var Le=de.value;Ue.walkTokens(Le,ge)}for(var Se=B(ne.tokens.cells),We;!(We=Se()).done;)for(var it=We.value,ft=B(it),st;!(st=ft()).done;){var wt=st.value;Ue.walkTokens(wt,ge)}break}case"list":{Ue.walkTokens(ne.items,ge);break}default:ne.tokens&&Ue.walkTokens(ne.tokens,ge)}}},Ue.Parser=$e,Ue.parser=$e.parse,Ue.Renderer=Be,Ue.TextRenderer=Ne,Ue.Lexer=Oe,Ue.lexer=Oe.lex,Ue.Tokenizer=Ee,Ue.Slugger=rt,Ue.parse=Ue;var Ke=Ue;return Ke})},ELLl:function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){var Q={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(S,T,h){h&&h!=ue.Init&&(S.removeKeyMap(B),S.state.closeBrackets=null),T&&(P(Z(T,"pairs")),S.state.closeBrackets=T,S.addKeyMap(B))});function Z(S,T){return T=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[T]!=null?S[T]:Q[T]}var B={Backspace:I,Enter:k};function P(S){for(var T=0;T<S.length;T++){var h=S.charAt(T),o="'"+h+"'";B[o]||(B[o]=z(h))}}P(Q.pairs+"`");function z(S){return function(T){return A(T,S)}}function j(S){var T=S.state.closeBrackets;if(!T||T.override)return T;var h=S.getModeAt(S.getCursor());return h.closeBrackets||T}function I(S){var T=j(S);if(!T||S.getOption("disableInput"))return ue.Pass;for(var h=Z(T,"pairs"),o=S.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return ue.Pass;var d=O(S,o[l].head);if(!d||h.indexOf(d)%2!=0)return ue.Pass}for(var l=o.length-1;l>=0;l--){var C=o[l].head;S.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function k(S){var T=j(S),h=T&&Z(T,"explode");if(!h||S.getOption("disableInput"))return ue.Pass;for(var o=S.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return ue.Pass;var d=O(S,o[l].head);if(!d||h.indexOf(d)%2!=0)return ue.Pass}S.operation(function(){var C=S.lineSeparator()||`
`;S.replaceSelection(C+C,null),S.execCommand("goCharLeft"),o=S.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;S.indentLine(f,null,!0),S.indentLine(f+1,null,!0)}})}function v(S){var T=ue.cmpPos(S.anchor,S.head)>0;return{anchor:new D(S.anchor.line,S.anchor.ch+(T?-1:1)),head:new D(S.head.line,S.head.ch+(T?1:-1))}}function A(S,T){var h=j(S);if(!h||S.getOption("disableInput"))return ue.Pass;var o=Z(h,"pairs"),l=o.indexOf(T);if(l==-1)return ue.Pass;for(var d=Z(h,"closeBefore"),C=Z(h,"triples"),p=o.charAt(l+1)==T,f=S.listSelections(),L=l%2==0,b,m=0;m<f.length;m++){var c=f[m],u=c.head,a,x=S.getRange(u,D(u.line,u.ch+1));if(L&&!c.empty())a="surround";else if((p||!L)&&x==T)p&&_(S,u)?a="both":C.indexOf(T)>=0&&S.getRange(u,D(u.line,u.ch+3))==T+T+T?a="skipThree":a="skip";else if(p&&u.ch>1&&C.indexOf(T)>=0&&S.getRange(D(u.line,u.ch-2),u)==T+T){if(u.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(u.line,u.ch-2))))return ue.Pass;a="addFour"}else if(p){var y=u.ch==0?" ":S.getRange(D(u.line,u.ch-1),u);if(!ue.isWordChar(x)&&y!=T&&!ue.isWordChar(y))a="both";else return ue.Pass}else if(L&&(x.length===0||/\s/.test(x)||d.indexOf(x)>-1))a="both";else return ue.Pass;if(!b)b=a;else if(b!=a)return ue.Pass}var E=l%2?o.charAt(l-1):T,N=l%2?T:o.charAt(l+1);S.operation(function(){if(b=="skip")S.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)S.execCommand("goCharRight");else if(b=="surround"){for(var K=S.getSelections(),U=0;U<K.length;U++)K[U]=E+K[U]+N;S.replaceSelections(K,"around"),K=S.listSelections().slice();for(var U=0;U<K.length;U++)K[U]=v(K[U]);S.setSelections(K)}else b=="both"?(S.replaceSelection(E+N,null),S.triggerElectric(E+N),S.execCommand("goCharLeft")):b=="addFour"&&(S.replaceSelection(E+E+E+E,"before"),S.execCommand("goCharRight"))})}function O(S,T){var h=S.getRange(D(T.line,T.ch-1),D(T.line,T.ch+1));return h.length==2?h:null}function _(S,T){var h=S.getTokenAt(D(T.line,T.ch+1));return/\bstring/.test(h.type)&&h.start==T.ch&&(T.ch==0||!/\bstring/.test(S.getTokenTypeAt(T)))}})},GfqC:function(bt,Je,ae){"use strict";var ue=ae("q1tI"),Q=ae.n(ue),D=ae("TSYQ"),Z=ae.n(D);function B(V,R){var M="cannot "+V.method+" "+V.action+" "+R.status+"'",$=new Error(M);return $.status=R.status,$.method=V.method,$.url=V.action,$}function P(V){var R=V.responseText||V.response;if(!R)return R;try{return JSON.parse(R)}catch(M){return R}}function z(V){var R=new XMLHttpRequest;V.onProgress&&R.upload&&(R.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var M=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(ce){M.append(ee+"[]",ce)});return}M.append(ee,V.data[ee])}),V.file instanceof Blob?M.append(V.filename,V.file,V.file.name):M.append(V.filename,V.file),R.onerror=function(oe){V.onError(oe)},R.onload=function(){return R.status<200||R.status>=300?V.onError(B(V,R),P(R)):V.onSuccess(P(R),R)},R.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in R&&(R.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&R.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ee){$[ee]!==null&&R.setRequestHeader(ee,$[ee])}),R.send(M),{abort:function(){R.abort()}}}var j=+new Date,I=0;function k(){return"rc-upload-"+j+"-"+ ++I}function v(V,R){return V.indexOf(R,V.length-R.length)!==-1}var A=function(V,R){if(V&&R){var M=Array.isArray(R)?R:R.split(","),$=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return M.some(function(ce){var De=ce.trim();return De.charAt(0)==="."?v($.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?oe===De.replace(/\/.*$/,""):ee===De})}return!0};function O(V,R){var M=V.createReader(),$=[];function ee(){M.readEntries(function(oe){var ce=Array.prototype.slice.apply(oe);$=$.concat(ce);var De=!ce.length;De?R($):ee()})}ee()}var _=function(R,M,$){var ee=function oe(ce,De){De=De||"",ce.isFile?ce.file(function(Ee){$(Ee)&&(ce.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=ce.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),M([Ee]))}):ce.isDirectory&&O(ce,function(Ee){Ee.forEach(function(Ce){oe(Ce,""+De+ce.name+"/")})})};R.forEach(function(oe){ee(oe.webkitGetAsEntry())})},S=_,T=Object.assign||function(V){for(var R=1;R<arguments.length;R++){var M=arguments[R];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},h=function(){function V(R,M){var $=[],ee=!0,oe=!1,ce=void 0;try{for(var De=R[Symbol.iterator](),Ee;!(ee=(Ee=De.next()).done)&&!($.push(Ee.value),M&&$.length===M);ee=!0);}catch(Ce){oe=!0,ce=Ce}finally{try{!ee&&De.return&&De.return()}finally{if(oe)throw ce}}return $}return function(R,M){if(Array.isArray(R))return R;if(Symbol.iterator in Object(R))return V(R,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(R,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(R,ee.key,ee)}}return function(R,M,$){return M&&V(R.prototype,M),$&&V(R,$),R}}();function l(V,R,M){return R in V?Object.defineProperty(V,R,{value:M,enumerable:!0,configurable:!0,writable:!0}):V[R]=M,V}function d(V,R){var M={};for(var $ in V){if(R.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;M[$]=V[$]}return M}function C(V,R){if(!(V instanceof R))throw new TypeError("Cannot call a class as a function")}function p(V,R){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R&&(typeof R=="object"||typeof R=="function")?R:V}function f(V,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof R);V.prototype=Object.create(R&&R.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),R&&(Object.setPrototypeOf?Object.setPrototypeOf(V,R):V.__proto__=R)}var L=function(R){return Object.keys(R).reduce(function(M,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(M[$]=R[$]),M},{})},b=function(V){f(R,V);function R(){var M,$,ee,oe;C(this,R);for(var ce=arguments.length,De=Array(ce),Ee=0;Ee<ce;Ee++)De[Ee]=arguments[Ee];return oe=($=(ee=p(this,(M=R.__proto__||Object.getPrototypeOf(R)).call.apply(M,[this].concat(De))),ee),ee.state={uid:k()},ee.reqs={},ee.onChange=function(Ce){var Te=Ce.target.files;ee.uploadFiles(Te),ee.reset()},ee.onClick=function(Ce){var Te=ee.fileInput;if(!Te)return;var we=ee.props,me=we.children,le=we.onClick;me&&me.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),le&&le(Ce)},ee.onKeyDown=function(Ce){Ce.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Ce){var Te=ee.props.multiple;if(Ce.preventDefault(),Ce.type==="dragover")return;if(ee.props.directory)S(Array.prototype.slice.call(Ce.dataTransfer.items),ee.uploadFiles,function(me){return A(me,ee.props.accept)});else{var we=Array.prototype.slice.call(Ce.dataTransfer.files).filter(function(me){return A(me,ee.props.accept)});Te===!1&&(we=we.slice(0,1)),ee.uploadFiles(we)}},ee.uploadFiles=function(Ce){var Te=Array.prototype.slice.call(Ce);Te.map(function(we){return we.uid=k(),we}).forEach(function(we){ee.upload(we,Te)})},ee.saveFileInput=function(Ce){ee.fileInput=Ce},$),p(ee,oe)}return o(R,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ee){var oe=this,ce=this.props;if(!ce.beforeUpload)return setTimeout(function(){return oe.post($)},0);var De=ce.beforeUpload($,ee);De&&De.then?De.then(function(Ee){var Ce=Object.prototype.toString.call(Ee);return Ce==="[object File]"||Ce==="[object Blob]"?oe.post(Ee):oe.post($)}).catch(function(Ee){console.log(Ee)}):De!==!1&&setTimeout(function(){return oe.post($)},0);return}},{key:"post",value:function($){var ee=this;if(!this._isMounted)return;var oe=this.props,ce=oe.onStart,De=oe.onProgress,Ee=oe.transformFile,Ce=Ee===void 0?function(Te){return Te}:Ee;new Promise(function(Te){var we=oe.action;return typeof we=="function"&&(we=we($)),Te(we)}).then(function(Te){var we=$.uid,me=oe.customRequest||z,le=Promise.resolve(Ce($)).then(function(te){var he=oe.data;return typeof he=="function"&&(he=he(te)),Promise.all([te,he])}).catch(function(te){console.error(te)});le.then(function(te){var he=h(te,2),ie=he[0],Ae=he[1],Re={action:Te,filename:oe.name,data:Ae,file:ie,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:De?function(ye){De(ye,$)}:null,onSuccess:function(Oe,Me){delete ee.reqs[we],oe.onSuccess(Oe,$,Me)},onError:function(Oe,Me){delete ee.reqs[we],oe.onError(Oe,Me,$)}};ce($),ee.reqs[we]=me(Re)})})}},{key:"reset",value:function(){this.setState({uid:k()})}},{key:"abort",value:function($){var ee=this.reqs;if($){var oe=$;$&&$.uid&&(oe=$.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(ce){ee[ce]&&ee[ce].abort&&ee[ce].abort(),delete ee[ce]})}},{key:"render",value:function(){var $,ee=this.props,oe=ee.component,ce=ee.prefixCls,De=ee.className,Ee=ee.disabled,Ce=ee.id,Te=ee.style,we=ee.multiple,me=ee.accept,le=ee.children,te=ee.directory,he=ee.openFileDialogOnClick,ie=ee.onMouseEnter,Ae=ee.onMouseLeave,Re=d(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=Z()(($={},l($,ce,!0),l($,ce+"-disabled",Ee),l($,De,De),$)),Oe=Ee?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:ie,onMouseLeave:Ae,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Q.a.createElement(oe,T({},Oe,{className:ye,role:"button",style:Te}),Q.a.createElement("input",T({},L(Re),{id:Ce,type:"file",ref:this.saveFileInput,onClick:function(Ie){return Ie.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:we,onChange:this.onChange})),le)}}]),R}(ue.Component),m=b,c=Object.assign||function(V){for(var R=1;R<arguments.length;R++){var M=arguments[R];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},u=function(){function V(R,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(R,ee.key,ee)}}return function(R,M,$){return M&&V(R.prototype,M),$&&V(R,$),R}}();function a(V,R){if(!(V instanceof R))throw new TypeError("Cannot call a class as a function")}function x(V,R){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R&&(typeof R=="object"||typeof R=="function")?R:V}function y(V,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof R);V.prototype=Object.create(R&&R.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),R&&(Object.setPrototypeOf?Object.setPrototypeOf(V,R):V.__proto__=R)}function E(){}var N=function(V){y(R,V);function R(){var M,$,ee,oe;a(this,R);for(var ce=arguments.length,De=Array(ce),Ee=0;Ee<ce;Ee++)De[Ee]=arguments[Ee];return oe=($=(ee=x(this,(M=R.__proto__||Object.getPrototypeOf(R)).call.apply(M,[this].concat(De))),ee),ee.saveUploader=function(Ce){ee.uploader=Ce},$),x(ee,oe)}return u(R,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Q.a.createElement(m,c({},this.props,{ref:this.saveUploader}))}}]),R}(ue.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=N,K=Je.a=U},HmJG:function(bt,Je,ae){},LdHM:function(bt,Je,ae){"use strict";ae.d(Je,"b",function(){return d}),ae.d(Je,"a",function(){return p});var ue=ae("1OyB"),Q=ae("vuIU"),D=ae("Ji7U"),Z=ae("LK+K"),B=ae("q1tI"),P=ae("rePB"),z=ae("Ff2n"),j=ae("ODXe"),I=ae("4IlW"),k=ae("bX4T"),v=ae("YrtM"),A=ae("TSYQ"),O=ae.n(A),_=ae("+nKL"),S=ae("8OUc"),T=function($,ee){var oe=$.prefixCls,ce=$.id,De=$.flattenOptions,Ee=$.childrenAsData,Ce=$.values,Te=$.searchValue,we=$.multiple,me=$.defaultActiveFirstOption,le=$.height,te=$.itemHeight,he=$.notFoundContent,ie=$.open,Ae=$.menuItemSelectedIcon,Re=$.virtual,ye=$.onSelect,Oe=$.onToggleOpen,Me=$.onActiveValue,Ie=$.onScroll,je=$.onMouseEnter,Be="".concat(oe,"-item"),Ne=Object(v.a)(function(){return De},[ie,De],function(Ke,xe){return xe[0]&&Ke[1]!==xe[1]}),rt=B.useRef(null),qe=function(xe){xe.preventDefault()},Ye=function(xe){rt.current&&rt.current.scrollTo({index:xe})},$e=function(xe){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ne.length,re=0;re<be;re+=1){var ne=(xe+re*ge+be)%be,se=Ne[ne],de=se.group,Le=se.data;if(!de&&!Le.disabled)return ne}return-1},ht=B.useState(function(){return $e(0)}),Qe=Object(j.a)(ht,2),nt=Qe[0],Pe=Qe[1],ct=function(xe){Pe(xe);var ge=Ne[xe];if(!ge){Me(null,-1);return}Me(ge.data.value,xe)};B.useEffect(function(){ct(me!==!1?$e(0):-1)},[Ne.length,Te]),B.useEffect(function(){var Ke=setTimeout(function(){if(!we&&ie&&Ce.size===1){var xe=Array.from(Ce)[0],ge=Ne.findIndex(function(be){var re=be.data;return re.value===xe});ct(ge),Ye(ge)}});return function(){return clearTimeout(Ke)}},[ie]);var at=function(xe){xe!==void 0&&ye(xe,{selected:!Ce.has(xe)}),we||Oe(!1)};if(B.useImperativeHandle(ee,function(){return{onKeyDown:function(xe){var ge=xe.which;switch(ge){case I.a.UP:case I.a.DOWN:{var be=0;if(ge===I.a.UP?be=-1:ge===I.a.DOWN&&(be=1),be!==0){var re=$e(nt+be,be);Ye(re),ct(re)}break}case I.a.ENTER:{var ne=Ne[nt];ne&&!ne.data.disabled?at(ne.data.value):at(void 0),ie&&xe.preventDefault();break}case I.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(xe){Ye(xe)}}}),Ne.length===0)return B.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),className:"".concat(Be,"-empty"),onMouseDown:qe},he);function Ue(Ke){var xe=Ne[Ke];if(!xe)return null;var ge=xe.data||{},be=ge.value,re=ge.label,ne=ge.children,se=Object(k.a)(ge,!0),de=Ee?ne:re;return xe?B.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},se,{key:Ke,role:"option",id:"".concat(ce,"_list_").concat(Ke),"aria-selected":Ce.has(be)}),be):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ue(nt-1),Ue(nt),Ue(nt+1)),B.createElement(_.a,{itemKey:"key",ref:rt,data:Ne,height:le,itemHeight:te,fullHeight:!1,onMouseDown:qe,onScroll:Ie,virtual:Re,onMouseEnter:je},function(Ke,xe){var ge,be=Ke.group,re=Ke.groupOption,ne=Ke.data,se=ne.label,de=ne.key;if(be)return B.createElement("div",{className:O()(Be,"".concat(Be,"-group"))},se!==void 0?se:de);var Le=ne.disabled,Se=ne.value,We=ne.title,it=ne.children,ft=ne.style,st=ne.className,wt=Object(z.a)(ne,["disabled","value","title","children","style","className"]),St=Ce.has(Se),dt="".concat(Be,"-option"),Gt=O()(Be,dt,st,(ge={},Object(P.a)(ge,"".concat(dt,"-grouped"),re),Object(P.a)(ge,"".concat(dt,"-active"),nt===xe&&!Le),Object(P.a)(ge,"".concat(dt,"-disabled"),Le),Object(P.a)(ge,"".concat(dt,"-selected"),St),ge)),It=Ee?it:se,Kt=!Ae||typeof Ae=="function"||St;return B.createElement("div",Object.assign({},wt,{"aria-selected":St,className:Gt,title:We,onMouseMove:function(){if(nt===xe||Le)return;ct(xe)},onClick:function(){Le||at(Se)},style:ft}),B.createElement("div",{className:"".concat(dt,"-content")},It||Se),B.isValidElement(Ae)||St,Kt&&B.createElement(S.a,{className:"".concat(Be,"-option-state"),customizeIcon:Ae,customizeIconProps:{isSelected:St}},St?"\u2713":null))}))},h=B.forwardRef(T);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var d=l,C=function(){return null};C.isSelectOptGroup=!0;var p=C,f=ae("VTBJ"),L=ae("Zm9Q");function b(M){var $=M.key,ee=M.props,oe=ee.children,ce=ee.value,De=Object(z.a)(ee,["children","value"]);return Object(f.a)({key:$,value:ce!==void 0?ce:$,children:oe},De)}function m(M){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(M).map(function(ee,oe){if(!B.isValidElement(ee)||!ee.type)return null;var ce=ee.type.isSelectOptGroup,De=ee.key,Ee=ee.props,Ce=Ee.children,Te=Object(z.a)(Ee,["children"]);return $||!ce?b(ee):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(De===null?oe:De,"__"),label:De},Te),{},{options:m(Ce)})}).filter(function(ee){return ee})}var c=ae("2Qr1"),u=ae("qNPg"),a=ae("U8pU"),x=ae("Kwbf"),y=ae("WKfj");function E(M){var $=M.mode,ee=M.options,oe=M.children,ce=M.backfill,De=M.allowClear,Ee=M.placeholder,Ce=M.getInputElement,Te=M.showSearch,we=M.onSearch,me=M.defaultOpen,le=M.autoFocus,te=M.labelInValue,he=M.value,ie=M.inputValue,Ae=M.optionLabelProp,Re=$==="multiple"||$==="tags",ye=Te!==void 0?Te:Re||$==="combobox",Oe=ee||m(oe);if(Object(x.a)($!=="tags"||Oe.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Me=Oe.some(function(Be){return Be.options?Be.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(x.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)($!=="combobox"||!Ae,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)($==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(x.a)($==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(x.b)($!=="combobox"||!Ce||!De||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),we&&!ye&&$!=="combobox"&&$!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!me||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var Ie=Object(y.d)(he);Object(x.a)(!te||Ie.every(function(Be){return Object(a.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Re||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var je=null;Object(L.a)(oe).some(function(Be){if(!B.isValidElement(Be)||!Be.type)return!1;var Ne=Be.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var rt=Object(L.a)(Be.props.children).every(function(qe){return!B.isValidElement(qe)||!Be.type||qe.type.isSelectOption?!0:(je=qe.type,!1)});return!rt}return je=Ne,!0}),je&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(x.a)(ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:m,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:N,fillOptionsWithMissingValue:c.a}),K=function(M){Object(D.a)(ee,M);var $=Object(Z.a)(ee);function ee(){var oe;return Object(ue.a)(this,ee),oe=$.apply(this,arguments),oe.selectRef=B.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(Q.a)(ee,[{key:"render",value:function(){return B.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),ee}(B.Component);K.Option=d,K.OptGroup=p;var V=K,R=Je.c=V},M8RZ:function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return I});var ue=ae("fWQN"),Q=ae("mtLc"),D=ae("yKVA"),Z=ae("879j"),B=ae("q1tI"),P=ae.n(B),z=ae("i8i4"),j=ae.n(z),I=function(k){Object(D.a)(A,k);var v=Object(Z.a)(A);function A(O){var _;Object(ue.a)(this,A),_=v.call(this,O);var S=window.document;return _.node=S.createElement("div"),S.body.appendChild(_.node),_}return Object(Q.a)(A,[{key:"render",value:function(){var _=this.props.children;return Object(z.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},Ot1p:function(bt,Je,ae){"use strict";var ue=ae("2qtc"),Q=ae("kLXV"),D=ae("rAM+"),Z=ae("miYZ"),B=ae("tsqr"),P=ae("9og8"),z=ae("tJVT"),j=ae("jrin"),I=ae("WmNS"),k=ae.n(I),v=ae("q1tI"),A=ae.n(v),O=ae("VrN/"),_=ae.n(O),S=ae("bdgK"),T=ae("p77/"),h=ae("Bd2K"),o=ae("ELLl"),l=ae("19Vz"),d=ae("lZu9"),C=ae("+NIl"),p=ae("kSUc"),f=ae("9Bee"),L=function(Se){var We=Se.value,it=We===void 0?"":We,ft=Se.className,st=Se.showTextOnly,wt=Se.showLines,St=Se.style,dt=St===void 0?{}:St,Gt=Object(v.useMemo)(function(){return""},[it]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:Gt}}))},b=ae("0Owb"),m=ae("dejd"),c=ae("C+DQ"),u=ae("1vsH"),a=ae("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function y(Se){var We=Se.onActionCallback,it=Se.title,ft=Se.icon,st=Se.actionName,wt=Se.className,St=wt===void 0?"":wt,dt=Se.children;function Gt(){We(st)}return A.a.createElement("a",{title:it,className:St,onClick:Gt},A.a.createElement("i",{className:"md-iconfont ".concat(ft)}),dt)}var E=function(Se){var We=Se.watch,it=Se.showNullButton,ft=Se.onActionCallback,st=Se.fullScreen,wt=Se.insertTemp,St=Se.hidetoolBar,dt=Se.uuid,Gt=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.E)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var It=[].concat(x,[{title:"".concat(We?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(We?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!St&&It.map(function(Kt,Wt){return A.a.createElement("li",{key:Wt},Kt.actionName?A.a.createElement(y,Object(b.a)({},Kt,{onActionCallback:ft})):A.a.createElement("span",{className:"v-line"}))}),it?A.a.createElement("li",null,A.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ft},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,wt&&A.a.createElement("li",null,A.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(wt),onActionCallback:ft},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(y,{icon:"".concat(st?"icon-shrink":"icon-enlarge"),title:st?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ft})))},N=ae("M8RZ"),U=ae("+L6B"),K=ae("2/Rp"),V=ae("y8nQ"),R=ae("Vl3Y"),M=ae("5NDa"),$=ae("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(Se){var We=Se.callback,it=Se.onCancel;function ft(st){We(st)}return A.a.createElement(R.a,Object(b.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ft}),A.a.createElement(R.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement($.a,null)),A.a.createElement(R.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement($.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},ce=ae("7ahc"),De=ae("k1fw"),Ee=ae("HmJG"),Ce=ae("BjJ7"),Te=R.a.useForm,we={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},le=function(Se){var We=Se.callback,it=Se.onCancel,ft=Te(),st=Object(z.a)(ft,1),wt=st[0],St=Object(v.useRef)();function dt(Kt){We(Object(De.a)(Object(De.a)({},Kt),{},{name:St.current}))}function Gt(Kt,Wt){wt.setFieldsValue({src:"/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type),type:Wt.type})}function It(Kt){var Wt=Kt.target.files[0];St.current=Wt.name,he(Wt,Gt)}return A.a.createElement(R.a,Object(b.a)({form:wt},me,{className:"upload-image-panel",onFinish:dt}),A.a.createElement(R.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(R.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},A.a.createElement($.a,{style:we})),A.a.createElement(te,{onFileChange:It}))),A.a.createElement(R.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},A.a.createElement($.a,{style:{width:264}})),A.a.createElement(R.a.Item,{style:{textAlign:"right"}},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function te(Se){var We=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:We}))}function he(Se,We){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",Se),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var ft=new window.XMLHttpRequest;ft.withCredentials=!0,ft.addEventListener("load",function(st){We(JSON.parse(st.target.responseText),Se)},!1),ft.addEventListener("error",function(st){console.error(st)},!1),ft.open("POST","".concat(Ce.a,"/api/attachments.json")),ft.send(it)}var ie=ae("giR+"),Ae=ae("fyUT"),Re=ae("7Kak"),ye=ae("9yH6"),Oe=ye.a.Group,Me={margin:"0 8px"},Ie=function(Se){var We=Se.callback,it=Se.onCancel;function ft(st){We(st)}return A.a.createElement(R.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ft},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Me},"\u884C\u6570"),A.a.createElement(R.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(Ae.a,null)),A.a.createElement("span",{style:Me},"\u5217\u6570"),A.a.createElement(R.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(Ae.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(R.a.Item,{name:"align"},A.a.createElement(Oe,null,A.a.createElement(ye.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(ye.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(ye.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(ye.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},je=ae("ErOA"),Be=ae("7Cbv"),Ne="link",rt="upload-image",qe="code-block",Ye="add-table",$e="------------",ht={default:$e,left:":".concat($e),center:":".concat($e,":"),right:"".concat($e,":")},Qe=ae("9VGf"),nt,Pe;function ct(){}var at=0,Ue=1e4,Ke="\u2581",xe=`
**\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 ge(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var be=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=be?"Cmd":"Ctrl",ne=["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"],se=(nt={},Object(j.a)(nt,re+"-B","bold"),Object(j.a)(nt,re+"-I","italic"),nt),de=(Pe={},Object(j.a)(Pe,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(Pe,qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(Pe,rt,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(Pe,Ye,"\u6DFB\u52A0\u8868\u683C"),Pe),Le=Je.a=function(Se){var We=Se.defaultValue,it=We===void 0?"":We,ft=Se.onChange,st=Se.width,wt=st===void 0?"100%":st,St=Se.height,dt=St===void 0?400:St,Gt=Se.miniToolbar,It=Gt===void 0?!1:Gt,Kt=Se.isFocus,Wt=Kt===void 0?!1:Kt,_t=Se.watch,Wr=Se.insertTemp,ai=Se.mode,vt=ai===void 0?"markdown":ai,Vr=Se.id,nr=Vr===void 0?"markdown-editor-id":Vr,cr=Se.showResizeBar,Hr=cr===void 0?!1:cr,oi=Se.noStorage,si=oi===void 0?!1:oi,Pt=Se.showNullButton,pt=Pt===void 0?!1:Pt,Pr=Se.hidetoolBar,li=Pr===void 0?!1:Pr,xr=Se.fullScreen,Lt=xr===void 0?!1:xr,Mr=Se.onBlur,Xr=Se.onCMBeforeChange,ui=Se.onFullScreen,Ve=Se.className,Tt=Ve===void 0?"":Ve,hi=Se.disablePaste,_i=hi===void 0?!1:hi,di=Se.placeholder,Li=di===void 0?"":di,G=Se.values,s=G===void 0?"":G,g=Object(v.useState)(null),W=Object(z.a)(g,2),X=W[0],H=W[1],ve=Object(v.useState)(it),He=Object(z.a)(ve,2),Ze=He[0],lt=He[1],ze=Object(v.useState)(_t),Et=Object(z.a)(ze,2),Dt=Et[0],Vt=Et[1],Ir=Object(v.useState)(Lt),Nr=Object(z.a)(Ir,2),ar=Nr[0],zr=Nr[1],Hi=Object(v.useState)(""),Er=Object(z.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(v.useState)(0),Yr=Object(z.a)(gi,2),ci=Yr[0],ei=Yr[1],dn=Object(v.useState)(dt),zi=Object(z.a)(dn,2),$r=zi[0],Ur=zi[1],ki=Object(v.useState)(!1),Di=Object(z.a)(ki,2),cn=Di[0],Zt=Di[1],Nt=Object(v.useRef)(Object(Be.a)()),fr=Object(v.useRef)(!1),Mt=Object(v.useRef)(),er=Object(v.useRef)(),Ft=Object(v.useRef)(),ti=Object(v.useRef)(),Qt=Object(v.useRef)(),Sr=function(){var mt=Object(P.a)(k.a.mark(function Ct(){var yt,kt;return k.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Nt.current}});case 2:kt=Ht.sent,kt!=null&&(yt=kt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",X,er),kt.attachments.map(function(Ot){Ot.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(Ot.id,"?type=").concat(Ot.content_type,")")):Ot.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ot.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):X.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,")"))}));case 4:case"end":return Ht.stop()}},Ct)}));return function(){return mt.apply(this,arguments)}}();Object(v.useEffect)(function(){lt(s),X==null||X.setValue(s)},[s]),Object(v.useEffect)(function(){ui==null||ui(ar)},[ar]),Object(v.useEffect)(function(){if(er.current){var mt=_.a.fromTextArea(er.current,{mode:vt,lineNumbers:!It,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Wt&&mt.focus();function Ct(yt,kt){if(_i){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Ht=Bt.types.toString(),Ot=Bt.items;if(Ht==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),vt=="stex")return;try{var tr,Tr=Ot[1];((tr=Ot[0])===null||tr===void 0?void 0:tr.kind)==="file"&&(Tr=Ot[0]);var Rt=Tr.getAsFile(),yi=Rt.name.split(".").pop();he(Rt,function(Ut){if(Ut.id){var sr,Gr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((Gr=Rt.type)===null||Gr===void 0)?void 0:Gr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",Ct),mt.on("dragleave",function(yt,kt){Ft.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(yt,kt){Ft.current.classList.add("mouse-hover-md")}),mt.on("drop",function(yt,kt){Ft.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Ht=function(Tr){var Rt=Bt[Tr],yi=Rt.name.split(".").pop();he(Rt,function(Ut){if(Ut.id){var sr,Gr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((Gr=Rt.type)===null||Gr===void 0)?void 0:Gr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Ot=0;Ot<Bt.length;Ot++)Ht(Ot)}}),H(mt),function(){mt.off("paste",Ct)}}},[]);var Gi=Object(v.useCallback)(function(){if(Ft.current)try{}catch(mt){console.log(mt,"---- to set md editor body height")}},[$r,Ft,ar]);Object(v.useEffect)(function(){function mt(){var yt=new S.default(function(kt){var Bt=Object(D.a)(kt),Ht;try{for(Bt.s();!(Ht=Bt.n()).done;){var Ot=Ht.value;(Ot.target.offsetHeight>0||Ot.target.offsetWidth>0)&&(Gi(),X.setSize("100%","100%"),X.refresh())}}catch(tr){Bt.e(tr)}finally{Bt.f()}});return yt.observe(er.current.parentElement),yt}if(X){var Ct=mt();return function(){Ct.unobserve(er.current.parentElement)}}},[X,Gi]),Object(v.useEffect)(function(){if(X){for(var mt=[],Ct=function(){var Ot=kt[yt];Bt=Object(z.a)(Ot,2);var tr=Bt[0],Tr=Bt[1],Rt=Object(j.a)({},tr,function(){Ki(Tr)});mt.push(Rt),X.addKeyMap(Rt)},yt=0,kt=Object.entries(se);yt<kt.length;yt++){var Bt;Ct()}return Mt.current=setInterval(function(){fr.current&&Sr()},4e3),function(){clearInterval(Mt.current);var Ht=Object(D.a)(mt),Ot;try{for(Ht.s();!(Ot=Ht.n()).done;){var tr=Ot.value;X.removeKeyMap(tr)}}catch(Tr){Ht.e(Tr)}finally{Ht.f()}}}},[X]),Object(v.useEffect)(function(){Lt!==ar&&zr(Lt)},[Lt]),Object(Qe.a)(function(){if(!si&&ci>0){var mt=new Date().getTime(),Ct=window.sessionStorage.getItem(nr);mt>=ci+Ue&&(!Ct||Ct!==Ze)&&(window.sessionStorage.setItem(nr,Ze),Zt(!0))}},Ue),Object(v.useEffect)(function(){Vt(_t)},[X,_t]),Object(v.useEffect)(function(){X&&(Wt&&X.focus())},[X,Wt]),Object(v.useEffect)(function(){if(Dt&&X){var mt=X.getScrollerElement();function Ct(yt){var kt=yt.target;if(Qt.current){var Bt=kt.scrollTop/kt.scrollHeight;Qt.current.scrollTop=Qt.current.scrollHeight*Bt}}return mt.addEventListener("scroll",Ct),function(){mt.removeEventListener("scroll",Ct)}}},[X,Dt]),Object(v.useEffect)(function(){if(X&&Xr){function mt(Ct,yt){Xr(Ct,yt)}return X.on("beforeChange",mt),function(){X.off("beforeChange",mt)}}},[X,Xr]),Object(v.useEffect)(function(){if(X&&Mr){function mt(){Mr(X.getValue())}return X.on("blur",mt),function(){X.off("blur",mt)}}},[X,Mr]),Object(v.useEffect)(function(){if(X){function mt(Ct){var yt=Ct.getValue();lt(yt),ei(new Date().getTime()),Ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ft&&ft(yt)}return X.on("change",mt),function(){X.off("change",mt)}}},[X,ft]),Object(v.useEffect)(function(){X&&(it==null?(X.setValue(""),lt("")):it!==X.getValue()&&(X.setValue(it),lt(it),X.setCursor(X.lineCount(),0)))},[X,it]);var Ki=Object(v.useCallback)(function(mt){var Ct=X.getCursor(),yt=X.getSelection(),kt=yt.split(`
`);switch(mt){case"bold":return X.replaceSelection("**"+yt+"**"),yt===""&&X.setCursor(Ct.line,Ct.ch+2),X.focus();case"italic":return X.replaceSelection("*"+yt+"*"),yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.focus();case"code":return X.replaceSelection("`"+yt+"`"),yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+yt+"$$`"),yt===""&&X.setCursor(Ct.line,Ct.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+yt+"\n```"),X.setCursor(Ct.line+1,yt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
`),X.focus();case"list-ul":return yt===""?X.replaceSelection("- "+yt):X.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
`)),X.focus();case"list-ol":return yt===""?X.replaceSelection("1. "+yt):X.replaceSelection(kt.map(function(Bt,Ht){return Bt===""?"":"".concat(Ht+1,". ").concat(Bt)}).join(`
`)),X.focus();case"add-null-ch":return yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.replaceSelection(Ke),X.focus();case"inster-template-1":return yt===""&&X.setCursor(Ct.line,Ct.ch),X.replaceSelection(xe),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return Vt(!Dt),X.focus();case"trigger-full-screen":return zr(!ar),X.focus();case Ne:kr(Ne);return;case qe:kr(qe);return;case rt:kr(rt);return;case Ye:kr(Ye);return;default:throw new Error}},[X,Dt,ar]),vi=Object(v.useCallback)(function(mt){kr("");switch(Br){case Ne:var Ct=mt.title,yt=mt.link;return X.replaceSelection("[".concat(Ct,"](").concat(yt,")")),X.focus();case qe:var kt=mt.language,Bt=mt.content;return X.replaceSelection(["```"+kt,Bt,"```"].join(`
`)),X.focus();case rt:var Ht=mt.src,Ot=mt.alt,tr=mt.name;return Ht.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(Ot||""," ]( ").concat(Ht,' "').concat(Ot||"",'" )')):Ht.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(tr,"</a>")):X.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(tr,"</a>")),X.focus();case Ye:for(var Tr=mt.row,Rt=mt.col,yi=mt.align,Ut=`
`,sr=0;sr<Tr;sr++){for(var Gr=[],Kr=[],Wn=0;Wn<Rt;Wn++)sr===1&&Kr.push(ht[yi]),Gr.push(" ");sr===1&&(Ut+="| ".concat(Kr.join(" | "),` |
`)),Ut+="| ".concat(Gr.join(Rt===1?"":" | "),` |
`)}return X.replaceSelection(Ut+`
`),X.focus();default:throw new Error}},[X,Br]),Fn=Object(v.useMemo)(function(){switch(Br){case Ne:return A.a.createElement(oe,{callback:vi,onCancel:Dr});case qe:return A.a.createElement(ce.b,{callback:vi,onCancel:Dr});case rt:return A.a.createElement(le,{callback:vi,onCancel:Dr});case Ye:return A.a.createElement(Ie,{callback:vi,onCancel:Dr});default:return null}},[Br]);function Dr(){kr("")}Object(v.useEffect)(function(){if(ti.current){var mt=ti.current,Ct=!1,yt=0;function kt(Ot){Ct=!0,yt=Ot.pageY}function Bt(){Ct=!1}function Ht(Ot){if(Ct){var tr=Ot.pageY-yt;tr<0&&(tr=0),tr>300&&(tr=300);var Tr=dt+tr+"px";Ur(Tr)}}return mt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Bt),function(){mt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Bt)}}},[X,ti]),Object(v.useEffect)(function(){Ur(dt)},[dt]);var fn=ge(wt),Zr=ge($r),Vi={width:fn,height:Zr},jn=Object(v.useMemo)(function(){if(ci){var mt=new Date(ci),Ct=mt.getHours(),yt=mt.getMinutes(),kt=mt.getSeconds();return Ct=Ct<10?"0"+Ct:Ct,yt=yt<10?"0"+yt:yt,kt=kt<10?"0"+kt:kt,"".concat(Ct,":").concat(yt,":").concat(kt)}return 0},[ci]);function Ri(){window.sessionStorage.removeItem(nr),Zt(!1),ei(0)}function $a(){Zt(!1),ei(0),X.setValue(window.sessionStorage.getItem(nr))}function ha(mt,Ct){var yt=X.getValue();yt=yt.replace(mt,Ct),lt(yt),X==null||X.setValue(yt)}return A.a.createElement(v.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ft},A.a.createElement("div",{className:"markdown-editor-container ".concat(Tt," ").concat(Dt?"on-preview":""," ").concat(It?"mini":""," ").concat(ar?"full-screen":""),style:Vi},A.a.createElement(E,{insertTemp:Wr,watch:Dt,fullScreen:ar,showNullButton:pt,onActionCallback:Ki,hidetoolBar:li,uuid:Nt.current,setOpenPhones:function(){fr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:er,placeholder:Li})),Dt?A.a.createElement("div",{ref:Qt,className:"preview-container"},vt==="stex"&&A.a.createElement(L,{value:Ze}),vt!=="stex"&&A.a.createElement(f.a,{edit:!0,value:Ze,replaces:ha})):null))),Hr?A.a.createElement("a",{ref:ti,className:"editor-resize"}):null,A.a.createElement(N.a,null,de[Br]?A.a.createElement(Q.a,{centered:!0,title:de[Br],visible:!0,onCancel:Dr,footer:null},Fn):null))}},SJMd:function(bt,Je){/**
* @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 ae,ue,Q,D=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var P,z;(function(){var j=window,I=["break,continue,do,else,for,if,return,while"],k=[I,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],v=[k,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[v,"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"],O=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[v,"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",T=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="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",o=[I,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[I,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[A,_,O,T,h,o,l,d],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",L="kwd",b="com",m="typ",c="lit",u="pun",a="pln",x="tag",y="dec",E="src",N="atn",U="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function R(ye){for(var Oe=0,Me=!1,Ie=!1,je=0,Be=ye.length;je<Be;++je){var Ne=ye[je];if(Ne.ignoreCase)Ie=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,Ie=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function qe(nt){var Pe=nt.charCodeAt(0);if(Pe!==92)return Pe;var ct=nt.charAt(1);return Pe=rt[ct],Pe||("0"<=ct&&ct<="7"?parseInt(nt.substring(1),8):ct==="u"||ct==="x"?parseInt(nt.substring(2),16):nt.charCodeAt(1))}function Ye(nt){if(nt<32)return(nt<16?"\\x0":"\\x")+nt.toString(16);var Pe=String.fromCharCode(nt);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function $e(nt){var Pe=nt.substring(1,nt.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")),ct=[],at=Pe[0]==="^",Ue=["["];at&&Ue.push("^");for(var Ke=at?1:0,xe=Pe.length;Ke<xe;++Ke){var ge=Pe[Ke];if(/\\[bdsw]/i.test(ge))Ue.push(ge);else{var be=qe(ge),re;Ke+2<xe&&Pe[Ke+1]==="-"?(re=qe(Pe[Ke+2]),Ke+=2):re=be,ct.push([be,re]),re<65||be>122||(re<65||be>90||ct.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||ct.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}ct.sort(function(Le,Se){return Le[0]-Se[0]||Se[1]-Le[1]});for(var ne=[],se=[],Ke=0;Ke<ct.length;++Ke){var de=ct[Ke];de[0]<=se[1]+1?se[1]=Math.max(se[1],de[1]):ne.push(se=de)}for(var Ke=0;Ke<ne.length;++Ke){var de=ne[Ke];Ue.push(Ye(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Ue.push("-"),Ue.push(Ye(de[1])))}return Ue.push("]"),Ue.join("")}function ht(nt){for(var Pe=nt.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")),ct=Pe.length,at=[],Ue=0,Ke=0;Ue<ct;++Ue){var xe=Pe[Ue];if(xe==="(")++Ke;else if(xe.charAt(0)==="\\"){var ge=+xe.substring(1);ge&&(ge<=Ke?at[ge]=-1:Pe[Ue]=Ye(ge))}}for(var Ue=1;Ue<at.length;++Ue)at[Ue]===-1&&(at[Ue]=++Oe);for(var Ue=0,Ke=0;Ue<ct;++Ue){var xe=Pe[Ue];if(xe==="(")++Ke,at[Ke]||(Pe[Ue]="(?:");else if(xe.charAt(0)==="\\"){var ge=+xe.substring(1);ge&&ge<=Ke&&(Pe[Ue]="\\"+at[ge])}}for(var Ue=0;Ue<ct;++Ue)Pe[Ue]==="^"&&Pe[Ue+1]!=="^"&&(Pe[Ue]="");if(nt.ignoreCase&&Me)for(var Ue=0;Ue<ct;++Ue){var xe=Pe[Ue],be=xe.charAt(0);xe.length>=2&&be==="["?Pe[Ue]=$e(xe):be!=="\\"&&(Pe[Ue]=xe.replace(/[a-zA-Z]/g,function(se){var de=se.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return Pe.join("")}for(var Qe=[],je=0,Be=ye.length;je<Be;++je){var Ne=ye[je];if(Ne.global||Ne.multiline)throw new Error(""+Ne);Qe.push("(?:"+ht(Ne)+")")}return new RegExp(Qe.join("|"),Ie?"gi":"g")}function M(ye,Oe){var Me=/(?:^|\s)nocode(?:\s|$)/,Ie=[],je=0,Be=[],Ne=0;function rt(qe){var Ye=qe.nodeType;if(Ye==1){if(Me.test(qe.className))return;for(var $e=qe.firstChild;$e;$e=$e.nextSibling)rt($e);var ht=qe.nodeName.toLowerCase();(ht==="br"||ht==="li")&&(Ie[Ne]=`
`,Be[Ne<<1]=je++,Be[Ne++<<1|1]=qe)}else if(Ye==3||Ye==4){var Qe=qe.nodeValue;Qe.length&&(Oe?Qe=Qe.replace(/\r\n?/g,`
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Ie[Ne]=Qe,Be[Ne<<1]=je,je+=Qe.length,Be[Ne++<<1|1]=qe)}}return rt(ye),{sourceCode:Ie.join("").replace(/\n$/,""),spans:Be}}function $(ye,Oe,Me,Ie,je){if(!Me)return;var Be={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:Oe,decorations:null};Ie(Be),je.push.apply(je,Be.decorations)}var ee=/\S/;function oe(ye){for(var Oe=void 0,Me=ye.firstChild;Me;Me=Me.nextSibling){var Ie=Me.nodeType;Oe=Ie===1?Oe?ye:Me:Ie===3&&ee.test(Me.nodeValue)?ye:Oe}return Oe===ye?void 0:Oe}function ce(ye,Oe){var Me={},Ie;(function(){for(var Ne=ye.concat(Oe),rt=[],qe={},Ye=0,$e=Ne.length;Ye<$e;++Ye){var ht=Ne[Ye],Qe=ht[3];if(Qe)for(var nt=Qe.length;--nt>=0;)Me[Qe.charAt(nt)]=ht;var Pe=ht[1],ct=""+Pe;qe.hasOwnProperty(ct)||(rt.push(Pe),qe[ct]=null)}rt.push(/[\0-\uffff]/),Ie=R(rt)})();var je=Oe.length,Be=function(Ne){for(var rt=Ne.sourceCode,qe=Ne.basePos,Ye=Ne.sourceNode,$e=[qe,a],ht=0,Qe=rt.match(Ie)||[],nt={},Pe=0,ct=Qe.length;Pe<ct;++Pe){var at=Qe[Pe],Ue=nt[at],Ke=void 0,xe;if(typeof Ue=="string")xe=!1;else{var ge=Me[at.charAt(0)];if(ge)Ke=at.match(ge[1]),Ue=ge[0];else{for(var be=0;be<je;++be)if(ge=Oe[be],Ke=at.match(ge[1]),Ke){Ue=ge[0];break}Ke||(Ue=a)}xe=Ue.length>=5&&Ue.substring(0,5)==="lang-",xe&&!(Ke&&typeof Ke[1]=="string")&&(xe=!1,Ue=E),xe||(nt[at]=Ue)}var re=ht;if(ht+=at.length,!xe)$e.push(qe+re,Ue);else{var ne=Ke[1],se=at.indexOf(ne),de=se+ne.length;Ke[2]&&(de=at.length-Ke[2].length,se=de-ne.length);var Le=Ue.substring(5);$(Ye,qe+re,at.substring(0,se),Be,$e),$(Ye,qe+re+se,ne,le(Le,ne),$e),$(Ye,qe+re+de,at.substring(de),Be,$e)}}Ne.decorations=$e};return Be}function De(ye){var Oe=[],Me=[];ye.tripleQuotedStrings?Oe.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Oe.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Me.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ie=ye.hashComments;Ie&&(ye.cStyleComments?(Ie>1?Oe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Me.push([b,/^\/\/[^\r\n]*/,null]),Me.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=ye.regexLiterals;if(je){var Be=je>1?"":`
\r`,Ne=Be?".":"[\\S\\s]",rt="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+V+"("+rt+")")])}var qe=ye.types;qe&&Me.push([m,qe]);var Ye=(""+ye.keywords).replace(/^ | $/g,"");Ye.length&&Me.push([L,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([a,/^\s+/,null,` \r
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&($e+="(?!s*/)"),Me.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[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"],[a,/^\\[\s\S]?/,null],[u,new RegExp($e),null]),ce(Oe,Me)}var Ee=De({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(ye,Oe,Me){for(var Ie=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Be=ye.ownerDocument,Ne=Be.createElement("li");ye.firstChild;)Ne.appendChild(ye.firstChild);var rt=[Ne];function qe(Pe){var ct=Pe.nodeType;if(ct==1&&!Ie.test(Pe.className))if(Pe.nodeName==="br")Ye(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var at=Pe.firstChild;at;at=at.nextSibling)qe(at);else if((ct==3||ct==4)&&Me){var Ue=Pe.nodeValue,Ke=Ue.match(je);if(Ke){var xe=Ue.substring(0,Ke.index);Pe.nodeValue=xe;var ge=Ue.substring(Ke.index+Ke[0].length);if(ge){var be=Pe.parentNode;be.insertBefore(Be.createTextNode(ge),Pe.nextSibling)}Ye(Pe),xe||Pe.parentNode.removeChild(Pe)}}}function Ye(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function ct(Ke,xe){var ge=xe?Ke.cloneNode(!1):Ke,be=Ke.parentNode;if(be){var re=ct(be,1),ne=Ke.nextSibling;re.appendChild(ge);for(var se=ne;se;se=ne)ne=se.nextSibling,re.appendChild(se)}return ge}for(var at=ct(Pe.nextSibling,0),Ue;(Ue=at.parentNode)&&Ue.nodeType===1;)at=Ue;rt.push(at)}for(var $e=0;$e<rt.length;++$e)qe(rt[$e]);Oe===(Oe|0)&&rt[0].setAttribute("value",Oe);var ht=Be.createElement("ol");ht.className="linenums";for(var Qe=Math.max(0,Oe-1|0)||0,$e=0,nt=rt.length;$e<nt;++$e)Ne=rt[$e],Ne.className="L"+($e+Qe)%10,Ne.firstChild||Ne.appendChild(Be.createTextNode("\xA0")),ht.appendChild(Ne);ye.appendChild(ht)}function Te(ye){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Me=/\n/g,Ie=ye.sourceCode,je=Ie.length,Be=0,Ne=ye.spans,rt=Ne.length,qe=0,Ye=ye.decorations,$e=Ye.length,ht=0;Ye[$e]=je;var Qe,nt;for(nt=Qe=0;nt<$e;)Ye[nt]!==Ye[nt+2]?(Ye[Qe++]=Ye[nt++],Ye[Qe++]=Ye[nt++]):nt+=2;for($e=Qe,nt=Qe=0;nt<$e;){for(var Pe=Ye[nt],ct=Ye[nt+1],at=nt+2;at+2<=$e&&Ye[at+1]===ct;)at+=2;Ye[Qe++]=Pe,Ye[Qe++]=ct,nt=at}$e=Ye.length=Qe;var Ue=ye.sourceNode,Ke="";Ue&&(Ke=Ue.style.display,Ue.style.display="none");try{for(var xe=null;qe<rt;){var ge=Ne[qe],be=Ne[qe+2]||je,re=Ye[ht+2]||je,at=Math.min(be,re),ne=Ne[qe+1],se;if(ne.nodeType!==1&&(se=Ie.substring(Be,at))){Oe&&(se=se.replace(Me,"\r")),ne.nodeValue=se;var de=ne.ownerDocument,Le=de.createElement("span");Le.className=Ye[ht+1];var Se=ne.parentNode;Se.replaceChild(Le,ne),Le.appendChild(ne),Be<be&&(Ne[qe+1]=ne=de.createTextNode(Ie.substring(at,be)),Se.insertBefore(ne,Le.nextSibling))}Be=at,Be>=be&&(qe+=2),Be>=re&&(ht+=2)}}finally{Ue&&(Ue.style.display=Ke)}}var we={};function me(ye,Oe){for(var Me=Oe.length;--Me>=0;){var Ie=Oe[Me];we.hasOwnProperty(Ie)?j.console&&console.warn("cannot override language handler %s",Ie):we[Ie]=ye}}function le(ye,Oe){return ye&&we.hasOwnProperty(ye)||(ye=/^\s*</.test(Oe)?"default-markup":"default-code"),we[ye]}me(Ee,["default-code"]),me(ce([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["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(ce([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["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(ce([],[[U,/^[\s\S]+/]]),["uq.val"]),me(De({keywords:A,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),me(De({keywords:"null,true,false"}),["json"]),me(De({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),me(De({keywords:O,cStyleComments:!0}),["java"]),me(De({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(De({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(De({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(De({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(De({keywords:T,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(De({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ce([],[[f,/^[\s\S]+/]]),["regex"]);function te(ye){var Oe=ye.langExtension;try{var Me=M(ye.sourceNode,ye.pre),Ie=Me.sourceCode;ye.sourceCode=Ie,ye.spans=Me.spans,ye.basePos=0,le(Oe,Ie)(ye),Te(ye)}catch(je){j.console&&console.log(je&&je.stack||je)}}function he(ye,Oe,Me){var Ie=Me||!1,je=Oe||null,Be=document.createElement("div");Be.innerHTML="<pre>"+ye+"</pre>",Be=Be.firstChild,Ie&&Ce(Be,Ie,!0);var Ne={langExtension:je,numberLines:Ie,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ne),Be.innerHTML}function ie(ye,Oe){var Me=Oe||document.body,Ie=Me.ownerDocument||document;function je(ge){return Me.getElementsByTagName(ge)}for(var Be=[je("pre"),je("code"),je("xmp")],Ne=[],rt=0;rt<Be.length;++rt)for(var qe=0,Ye=Be[rt].length;qe<Ye;++qe)Ne.push(Be[rt][qe]);Be=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var ht=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,nt=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,ct=/pre|xmp/i,at=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ke={};function xe(){for(var ge=j.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;ht<Ne.length&&$e.now()<ge;ht++){for(var be=Ne[ht],re=Ke,ne=be;ne=ne.previousSibling;){var se=ne.nodeType,de=(se===7||se===8)&&ne.nodeValue;if(de?!/^\??prettify\b/.test(de):se!==3||/\S/.test(ne.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,_t,Wr){re[_t]=Wr});break}}var Le=be.className;if((re!==Ke||nt.test(Le))&&!Pe.test(Le)){for(var Se=!1,We=be.parentNode;We;We=We.parentNode){var it=We.tagName;if(Ue.test(it)&&We.className&&nt.test(We.className)){Se=!0;break}}if(!Se){be.className+=" prettyprinted";var ft=re.lang;if(!ft){ft=Le.match(Qe);var st;!ft&&(st=oe(be))&&at.test(st.tagName)&&(ft=st.className.match(Qe)),ft&&(ft=ft[1])}var wt;if(ct.test(be.tagName))wt=1;else{var St=be.currentStyle,dt=Ie.defaultView,Gt=St?St.whiteSpace:dt&&dt.getComputedStyle?dt.getComputedStyle(be,null).getPropertyValue("white-space"):0;wt=Gt&&Gt.substring(0,3)==="pre"}var It=re.linenums;(It=It==="true"||+It)||(It=Le.match(/\blinenums\b(?::(\d+))?/),It=It?It[1]&&It[1].length?+It[1]:!0:!1),It&&Ce(be,It,wt);var Kt={langExtension:ft,sourceNode:be,numberLines:It,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}ht<Ne.length?j.setTimeout(xe,250):typeof ye=="function"&&ye()}xe()}var Ae=j.PR={createSimpleLexer:ce,registerLangHandler:me,sourceDecorator:De,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:E,PR_STRING:f,PR_TAG:x,PR_TYPE:m,prettyPrintOne:D?j.prettyPrintOne=he:P=he,prettyPrint:z=D?j.prettyPrint=ie:z=ie},Re=j.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return Ae})})()},"VrN/":function(bt,Je,ae){(function(ue,Q){bt.exports=Q()})(this,function(){"use strict";var ue=navigator.userAgent,Q=navigator.platform,D=/gecko\/\d/i.test(ue),Z=/MSIE \d/.test(ue),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),P=/Edge\/(\d+)/.exec(ue),z=Z||B||P,j=z&&(Z?document.documentMode||6:+(P||B)[1]),I=!P&&/WebKit\//.test(ue),k=I&&/Qt\/\d+\.\d+/.test(ue),v=!P&&/Chrome\//.test(ue),A=/Opera\//.test(ue),O=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),S=/PhantomJS/.test(ue),T=!P&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),h=/Android/.test(ue),o=T||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),l=T||/Mac/.test(Q),d=/\bCrOS\b/.test(ue),C=/win/i.test(Q),p=A&&ue.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(A=!1,I=!0);var f=l&&(k||A&&(p==null||p<12.11)),L=D||z&&j>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var i=e.className,r=b(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 u(e,t){return c(e).appendChild(t)}function a(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 w=0;w<t.length;++w)n.appendChild(t[w]);return n}function x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var y;document.createRange?y=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:y=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 E(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 N(){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;b(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!b(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};T?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(V=function(e){try{e.select()}catch(t){}});function R(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(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 $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var w=r||0,F=n||0;;){var Y=e.indexOf(" ",w);if(Y<0||Y>=t)return F+(t-w);F+=Y-w,F+=i-F%i,w=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var ce=50,De={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},Ce={origin:"*mouse"},Te={origin:"+move"};function we(e,t,i){for(var r=0,n=0;;){var w=e.indexOf(" ",r);w==-1&&(w=e.length);var F=w-r;if(w==e.length||n+F>=t)return r+Math.min(F,t-n);if(n+=w-r,n+=i-n%i,r=w+1,n>=t)return r}}var me=[""];function le(e){for(;me.length<=e;)me.push(te(me)+" ");return me[e]}function te(e){return e[e.length-1]}function he(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ie(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Ae(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(Ae.prototype=e,i=new Ae),t&&M(t,i),i}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function Ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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 Be(e){return e.charCodeAt(0)>=768&&je.test(e)}function Ne(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function rt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,w=r<0?Math.ceil(n):Math.floor(n);if(w==t)return e(w)?t:i;e(w)?i=w:t=w+r}}function qe(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,w=0;w<e.length;++w){var F=e[w];(F.from<i&&F.to>t||t==i&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,i),F.level==1?"rtl":"ltr",w),n=!0)}n||r(t,i,"ltr")}var Ye=null;function $e(e,t,i){var r;Ye=null;for(var n=0;n<e.length;++n){var w=e[n];if(w.from<t&&w.to>t)return n;w.to==t&&(w.from!=w.to&&i=="before"?r=n:Ye=n),w.from==t&&(w.from!=w.to&&i!="before"?r=n:Ye=n)}return r!=null?r:Ye}var ht=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,w=/[LRr]/,F=/[Lb1n]/,Y=/[1n]/;function J(q,fe,pe){this.level=q,this.from=fe,this.to=pe}return function(q,fe){var pe=fe=="ltr"?"L":"R";if(q.length==0||fe=="ltr"&&!r.test(q))return!1;for(var ke=q.length,_e=[],Fe=0;Fe<ke;++Fe)_e.push(i(q.charCodeAt(Fe)));for(var Ge=0,Xe=pe;Ge<ke;++Ge){var et=_e[Ge];et=="m"?_e[Ge]=Xe:Xe=et}for(var ot=0,tt=pe;ot<ke;++ot){var ut=_e[ot];ut=="1"&&tt=="r"?_e[ot]="n":w.test(ut)&&(tt=ut,ut=="r"&&(_e[ot]="R"))}for(var xt=1,gt=_e[0];xt<ke-1;++xt){var At=_e[xt];At=="+"&&gt=="1"&&_e[xt+1]=="1"?_e[xt]="1":At==","&&gt==_e[xt+1]&&(gt=="1"||gt=="n")&&(_e[xt]=gt),gt=At}for(var Xt=0;Xt<ke;++Xt){var hr=_e[Xt];if(hr==",")_e[Xt]="N";else if(hr=="%"){var $t=void 0;for($t=Xt+1;$t<ke&&_e[$t]=="%";++$t);for(var Or=Xt&&_e[Xt-1]=="!"||$t<ke&&_e[$t]=="1"?"1":"N",Ar=Xt;Ar<$t;++Ar)_e[Ar]=Or;Xt=$t-1}}for(var rr=0,_r=pe;rr<ke;++rr){var mr=_e[rr];_r=="L"&&mr=="1"?_e[rr]="L":w.test(mr)&&(_r=mr)}for(var or=0;or<ke;++or)if(n.test(_e[or])){var ir=void 0;for(ir=or+1;ir<ke&&n.test(_e[ir]);++ir);for(var Jt=(or?_e[or-1]:pe)=="L",Lr=(ir<ke?_e[ir]:pe)=="L",un=Jt==Lr?Jt?"L":"R":pe,Ai=or;Ai<ir;++Ai)_e[Ai]=un;or=ir-1}for(var vr=[],ni,dr=0;dr<ke;)if(F.test(_e[dr])){var Xa=dr;for(++dr;dr<ke&&F.test(_e[dr]);++dr);vr.push(new J(0,Xa,dr))}else{var mi=dr,ji=vr.length,Wi=fe=="rtl"?1:0;for(++dr;dr<ke&&_e[dr]!="L";++dr);for(var br=mi;br<dr;)if(Y.test(_e[br])){mi<br&&(vr.splice(ji,0,new J(1,mi,br)),ji+=Wi);var hn=br;for(++br;br<dr&&Y.test(_e[br]);++br);vr.splice(ji,0,new J(2,hn,br)),ji+=Wi,mi=br}else++br;mi<dr&&vr.splice(ji,0,new J(1,mi,dr))}return fe=="ltr"&&(vr[0].level==1&&(ni=q.match(/^\s+/))&&(vr[0].from=ni[0].length,vr.unshift(new J(0,0,ni[0].length))),te(vr).level==1&&(ni=q.match(/\s+$/))&&(te(vr).to-=ni[0].length,vr.push(new J(0,ke-ni[0].length,ke)))),fe=="rtl"?vr.reverse():vr}}();function Qe(e,t){var i=e.order;return i==null&&(i=e.order=ht(e.text,t)),i}var nt=[],Pe=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]||nt).concat(i)}};function ct(e,t){return e._handlers&&e._handlers[t]||nt}function at(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 w=oe(n,i);w>-1&&(r[t]=n.slice(0,w).concat(n.slice(w+1)))}}}function Ue(e,t){var i=ct(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 Ke(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ue(e,i||t.type,e,t),se(t)||t.codemirrorIgnore}function xe(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)oe(i,t[r])==-1&&i.push(t[r])}function ge(e,t){return ct(e,t).length>0}function be(e){e.prototype.on=function(t,i){Pe(this,t,i)},e.prototype.off=function(t,i){at(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){re(e),ne(e)}function Le(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(z&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),it;function ft(e){if(it==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&j<8))}var i=it?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var st;function wt(e){if(st!=null)return st;var t=u(e,document.createTextNode("A\u062EA")),i=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:st=r.right-i.right<3}var St=`
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 w=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),F=w.indexOf("\r");F!=-1?(i.push(w.slice(0,F)),t+=F+1):(i.push(w),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},dt=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},Gt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),It=null;function Kt(e){if(It!=null)return It;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return It=Math.abs(i.left-r.left)>1}var Wt={},_t={};function Wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function ai(e,t){_t[e]=t}function vt(e){if(typeof e=="string"&&_t.hasOwnProperty(e))e=_t[e];else if(e&&typeof e.name=="string"&&_t.hasOwnProperty(e.name)){var t=_t[e.name];typeof t=="string"&&(t={name:t}),e=Re(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Vr(e,t){t=vt(t);var i=Wt[t.name];if(!i)return Vr(e,"text/plain");var r=i(e,t);if(nr.hasOwnProperty(t.name)){var n=nr[t.name];for(var w in n){if(!n.hasOwnProperty(w))continue;r.hasOwnProperty(w)&&(r["_"+w]=r[w]),r[w]=n[w]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var nr={};function cr(e,t){var i=nr.hasOwnProperty(e)?nr[e]:nr[e]={};M(t,i)}function Hr(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 oi(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 si(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=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};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(F){return i?F.toLowerCase():F},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var w=this.string.slice(this.pos).match(e);return w&&w.index>0?null:(w&&t!==!1&&(this.pos+=w[0].length),w)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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],w=n.chunkSize();if(t<w){i=n;break}t-=w}return i.lines[t]}function Pr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(w){var F=w.text;n==i.line&&(F=F.slice(0,i.ch)),n==t.line&&(F=F.slice(t.ch)),r.push(F),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(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 Mr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],w=n.height;if(t<w){e=n;continue e}t-=w,i+=n.chunkSize()}return i}while(!e.lines);for(var F=0;F<e.lines.length;++F){var Y=e.lines[F],J=Y.height;if(t<J)break;t-=J}return i+F}function Xr(e,t){return t>=e.first&&t<e.first+e.size}function ui(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function hi(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function _i(e){return Ve(e.line,e.ch)}function di(e,t){return Tt(e,t)<0?t:e}function Li(e,t){return Tt(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,pt(e,i).text.length):g(t,pt(e,t.line).text.length)}function g(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function W(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var X=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof X?new H(e,Hr(e.mode,t.state),i,t.lookAhead):new H(e,Hr(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?Hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],w={};Nr(e,t.text,e.doc.mode,i,function(q,fe){return n.push(q,fe)},w,r);for(var F=i.state,Y=function(q){i.baseTokens=n;var fe=e.state.overlays[q],pe=1,ke=0;i.state=!0,Nr(e,t.text,fe.mode,i,function(_e,Fe){for(var Ge=pe;ke<_e;){var Xe=n[pe];Xe>_e&&n.splice(pe,1,_e,n[pe+1],Xe),pe+=2,ke=Math.min(_e,Xe)}if(!Fe)return;if(fe.opaque)n.splice(Ge,pe-Ge,_e,"overlay "+Fe),pe=Ge+2;else for(;Ge<pe;Ge+=2){var et=n[Ge+1];n[Ge+1]=(et?et+" ":"")+"overlay "+Fe}},w),i.state=F,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:n,classes:w.bgClass||w.textClass?w:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ze(e,Lt(t)),n=t.text.length>e.options.maxHighlightLength&&Hr(e.doc.mode,r.state),w=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=w.styles,w.classes?t.styleClasses=w.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 Ze(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var w=ar(e,t,i),F=w>r.first&&pt(r,w-1).stateAfter,Y=F?H.fromSaved(r,F,w):new H(r,si(r.mode),w);return r.iter(w,t,function(J){lt(e,J.text,Y);var q=Y.line;J.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function lt(e,t,i,r){var n=e.doc.mode,w=new Pt(t,e.options.tabSize,i);for(w.start=w.pos=r||0,t==""&&ze(n,i.state);!w.eol();)Et(n,w,i.state),w.start=w.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=oi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Et(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=oi(e,i).mode);var w=e.token(t,i);if(t.pos>t.start)return w}throw new Error("Mode "+e.name+" failed to advance stream.")}var Dt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vt(e,t,i,r){var n=e.doc,w=n.mode,F;t=s(n,t);var Y=pt(n,t.line),J=Ze(e,t.line,i),q=new Pt(Y.text,e.options.tabSize,J),fe;for(r&&(fe=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,F=Et(w,q,J.state),r&&fe.push(new Dt(q,F,Hr(n.mode,J.state)));return r?fe:new Dt(q,F,J.state)}function Ir(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 Nr(e,t,i,r,n,w,F){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,q=null,fe=new Pt(t,e.options.tabSize,r),pe,ke=e.options.addModeClass&&[null];for(t==""&&Ir(ze(i,r.state),w);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Y=!1,F&&lt(e,t,r,fe.pos),fe.pos=t.length,pe=null):pe=Ir(Et(i,fe,r.state,ke),w),ke){var _e=ke[0].name;_e&&(pe="m-"+(pe?_e+" "+pe:_e))}if(!Y||q!=pe){for(;J<fe.start;)J=Math.min(fe.start,J+5e3),n(J,q);q=pe}fe.start=fe.pos}for(;J<fe.pos;){var Fe=Math.min(fe.pos,J+5e3);n(Fe,q),J=Fe}}function ar(e,t,i){for(var r,n,w=e.doc,F=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>F;--Y){if(Y<=w.first)return w.first;var J=pt(w,Y-1),q=J.stateAfter;if(q&&(!i||Y+(q instanceof X?q.lookAhead:0)<=w.modeFrontier))return Y;var fe=$(J.text,null,e.options.tabSize);(n==null||r>fe)&&(n=Y-1,r=fe)}return n}function zr(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=pt(e,r).stateAfter;if(n&&(!(n instanceof X)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Hi=!1,Er=!1;function Br(){Hi=!0}function kr(){Er=!0}function gi(e,t,i){this.marker=e,this.from=t,this.to=i}function Yr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ci(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ei(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function dn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var w=e[n],F=w.marker,Y=w.from==null||(F.inclusiveLeft?w.from<=t:w.from<t);if(Y||w.from==t&&F.type=="bookmark"&&(!i||!w.marker.insertLeft)){var J=w.to==null||(F.inclusiveRight?w.to>=t:w.to>t);(r||(r=[])).push(new gi(F,w.from,J?null:w.to))}}return r}function zi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var w=e[n],F=w.marker,Y=w.to==null||(F.inclusiveRight?w.to>=t:w.to>t);if(Y||w.from==t&&F.type=="bookmark"&&(!i||w.marker.insertLeft)){var J=w.from==null||(F.inclusiveLeft?w.from<=t:w.from<t);(r||(r=[])).push(new gi(F,J?null:w.from-t,w.to==null?null:w.to-t))}}return r}function $r(e,t){if(t.full)return null;var i=Xr(e,t.from.line)&&pt(e,t.from.line).markedSpans,r=Xr(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,w=t.to.ch,F=Tt(t.from,t.to)==0,Y=dn(i,n,F),J=zi(r,w,F),q=t.text.length==1,fe=te(t.text).length+(q?n:0);if(Y)for(var pe=0;pe<Y.length;++pe){var ke=Y[pe];if(ke.to==null){var _e=Yr(J,ke.marker);_e?q&&(ke.to=_e.to==null?null:_e.to+fe):ke.to=n}}if(J)for(var Fe=0;Fe<J.length;++Fe){var Ge=J[Fe];if(Ge.to!=null&&(Ge.to+=fe),Ge.from==null){var Xe=Yr(Y,Ge.marker);Xe||(Ge.from=fe,q&&(Y||(Y=[])).push(Ge))}else Ge.from+=fe,q&&(Y||(Y=[])).push(Ge)}Y&&(Y=Ur(Y)),J&&J!=Y&&(J=Ur(J));var et=[Y];if(!q){var ot=t.text.length-2,tt;if(ot>0&&Y)for(var ut=0;ut<Y.length;++ut)Y[ut].to==null&&(tt||(tt=[])).push(new gi(Y[ut].marker,null,null));for(var xt=0;xt<ot;++xt)et.push(tt);et.push(J)}return et}function Ur(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 ki(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(_e){if(_e.markedSpans)for(var Fe=0;Fe<_e.markedSpans.length;++Fe){var Ge=_e.markedSpans[Fe].marker;Ge.readOnly&&(!r||oe(r,Ge)==-1)&&(r||(r=[])).push(Ge)}}),!r)return null;for(var n=[{from:t,to:i}],w=0;w<r.length;++w)for(var F=r[w],Y=F.find(0),J=0;J<n.length;++J){var q=n[J];if(Tt(q.to,Y.from)<0||Tt(q.from,Y.to)>0)continue;var fe=[J,1],pe=Tt(q.from,Y.from),ke=Tt(q.to,Y.to);(pe<0||!F.inclusiveLeft&&!pe)&&fe.push({from:q.from,to:Y.from}),(ke>0||!F.inclusiveRight&&!ke)&&fe.push({from:Y.to,to:q.to}),n.splice.apply(n,fe),J+=fe.length-3}return n}function Di(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 cn(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function fr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),w=Tt(r.from,n.from)||Zt(e)-Zt(t);if(w)return-w;var F=Tt(r.to,n.to)||Nt(e)-Nt(t);return F||t.id-e.id}function Mt(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=void 0,w=0;w<i.length;++w)n=i[w],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||fr(r,n.marker)<0)&&(r=n.marker);return r}function er(e){return Mt(e,!0)}function Ft(e){return Mt(e,!1)}function ti(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var w=i[n];w.marker.collapsed&&(w.from==null||w.from<t)&&(w.to==null||w.to>t)&&(!r||fr(r,w.marker)<0)&&(r=w.marker)}return r}function Qt(e,t,i,r,n){var w=pt(e,t),F=Er&&w.markedSpans;if(F)for(var Y=0;Y<F.length;++Y){var J=F[Y];if(!J.marker.collapsed)continue;var q=J.marker.find(0),fe=Tt(q.from,i)||Zt(J.marker)-Zt(n),pe=Tt(q.to,r)||Nt(J.marker)-Nt(n);if(fe>=0&&pe<=0||fe<=0&&pe>=0)continue;if(fe<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.to,i)>=0:Tt(q.to,i)>0)||fe>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.from,r)<=0:Tt(q.from,r)<0))return!0}}function Sr(e){for(var t;t=er(e);)e=t.find(-1,!0).line;return e}function Gi(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=Ft(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vi(e,t){var i=pt(e,t),r=Sr(i);return i==r?t:Lt(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=pt(e,t),r;if(!Dr(e,i))return t;for(;r=Ft(i);)i=r.find(1,!0).line;return Lt(i)+1}function Dr(e,t){var i=Er&&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&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Yr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,w=0;w<t.markedSpans.length;++w)if(n=t.markedSpans[w],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function Zr(e){e=Sr(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 w=i.parent;w;i=w,w=i.parent)for(var F=0;F<w.children.length;++F){var Y=w.children[F];if(Y==i)break;t+=Y.height}return t}function Vi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=er(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ft(r);){var w=i.find(0,!0);t-=r.text.length-w.from.ch,r=w.to.line,t+=r.text.length-w.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=pt(i,i.first),t.maxLineLength=Vi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Vi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ri=function(e,t,i){this.text=e,cn(this,t),this.height=i?i(this):1};Ri.prototype.lineNo=function(){return Lt(this)},be(Ri);function $a(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Di(e),cn(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function ha(e){e.parent=null,Di(e)}var mt={},Ct={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ct:mt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function kt(e,t){var i=x("span",null,null,I?"padding-right: .1px":null),r={pre:x("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 w=n?t.rest[n-1]:t.line,F=void 0;r.pos=0,r.addToken=Ht,wt(e.display.measure)&&(F=Qe(w,e.doc.direction))&&(r.addToken=tr(r.addToken,F)),r.map=[];var Y=t!=e.display.externalMeasured&&Lt(w);Rt(w,r,He(e,w,Y)),w.styleClasses&&(w.styleClasses.bgClass&&(r.bgClass=K(w.styleClasses.bgClass,r.bgClass||"")),w.styleClasses.textClass&&(r.textClass=K(w.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(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(I){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 Ue(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Bt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ht(e,t,i,r,n,w,F){if(!t)return;var Y=e.splitSpaces?Ot(t,e.trailingSpace):t,J=e.cm.state.specialChars,q=!1,fe;if(!J.test(t))e.col+=t.length,fe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,fe),z&&j<9&&(q=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var pe=0;;){J.lastIndex=pe;var ke=J.exec(t),_e=ke?ke.index-pe:t.length-pe;if(_e){var Fe=document.createTextNode(Y.slice(pe,pe+_e));z&&j<9?fe.appendChild(a("span",[Fe])):fe.appendChild(Fe),e.map.push(e.pos,e.pos+_e,Fe),e.col+=_e,e.pos+=_e}if(!ke)break;pe+=_e+1;var Ge=void 0;if(ke[0]==" "){var Xe=e.cm.options.tabSize,et=Xe-e.col%Xe;Ge=fe.appendChild(a("span",le(et),"cm-tab")),Ge.setAttribute("role","presentation"),Ge.setAttribute("cm-text"," "),e.col+=et}else ke[0]=="\r"||ke[0]==`
`?(Ge=fe.appendChild(a("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ge.setAttribute("cm-text",ke[0]),e.col+=1):(Ge=e.cm.options.specialCharPlaceholder(ke[0]),Ge.setAttribute("cm-text",ke[0]),z&&j<9?fe.appendChild(a("span",[Ge])):fe.appendChild(Ge),e.col+=1);e.map.push(e.pos,e.pos+1,Ge),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||q||w||F){var ot=i||"";r&&(ot+=r),n&&(ot+=n);var tt=a("span",[fe],ot,w);if(F)for(var ut in F)F.hasOwnProperty(ut)&&ut!="style"&&ut!="class"&&tt.setAttribute(ut,F[ut]);return e.content.appendChild(tt)}e.content.appendChild(fe)}function Ot(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var w=e.charAt(n);w==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(w="\xA0"),r+=w,i=w==" "}return r}function tr(e,t){return function(i,r,n,w,F,Y,J){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,fe=q+r.length;;){for(var pe=void 0,ke=0;ke<t.length&&!(pe=t[ke],pe.to>q&&pe.from<=q);ke++);if(pe.to>=fe)return e(i,r,n,w,F,Y,J);e(i,r.slice(0,pe.to-q),n,w,null,Y,J),w=null,r=r.slice(pe.to-q),q=pe.to}}}function Tr(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 Rt(e,t,i){var r=e.markedSpans,n=e.text,w=0;if(!r){for(var F=1;F<i.length;F+=2)t.addToken(t,n.slice(w,w=i[F]),yt(i[F+1],t.cm.options));return}for(var Y=n.length,J=0,q=1,fe="",pe,ke,_e=0,Fe,Ge,Xe,et,ot;;){if(_e==J){Fe=Ge=Xe=ke="",ot=null,et=null,_e=Infinity;for(var tt=[],ut=void 0,xt=0;xt<r.length;++xt){var gt=r[xt],At=gt.marker;if(At.type=="bookmark"&&gt.from==J&&At.widgetNode)tt.push(At);else if(gt.from<=J&&(gt.to==null||gt.to>J||At.collapsed&&gt.to==J&&gt.from==J)){if(gt.to!=null&&gt.to!=J&&_e>gt.to&&(_e=gt.to,Ge=""),At.className&&(Fe+=" "+At.className),At.css&&(ke=(ke?ke+";":"")+At.css),At.startStyle&&gt.from==J&&(Xe+=" "+At.startStyle),At.endStyle&&gt.to==_e&&(ut||(ut=[])).push(At.endStyle,gt.to),At.title&&((ot||(ot={})).title=At.title),At.attributes)for(var Xt in At.attributes)(ot||(ot={}))[Xt]=At.attributes[Xt];At.collapsed&&(!et||fr(et.marker,At)<0)&&(et=gt)}else gt.from>J&&_e>gt.from&&(_e=gt.from)}if(ut)for(var hr=0;hr<ut.length;hr+=2)ut[hr+1]==_e&&(Ge+=" "+ut[hr]);if(!et||et.from==J)for(var $t=0;$t<tt.length;++$t)Tr(t,0,tt[$t]);if(et&&(et.from||0)==J){if(Tr(t,(et.to==null?Y+1:et.to)-J,et.marker,et.from==null),et.to==null)return;et.to==J&&(et=!1)}}if(J>=Y)break;for(var Or=Math.min(Y,_e);;){if(fe){var Ar=J+fe.length;if(!et){var rr=Ar>Or?fe.slice(0,Or-J):fe;t.addToken(t,rr,pe?pe+Fe:Fe,Xe,J+rr.length==_e?Ge:"",ke,ot)}if(Ar>=Or){fe=fe.slice(Or-J),J=Or;break}J=Ar,Xe=""}fe=n.slice(w,w=i[q++]),pe=yt(i[q++],t.cm.options)}}}function yi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Lt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Dr(e,t)}function Ut(e,t,i){for(var r=[],n,w=t;w<i;w=n){var F=new yi(e.doc,pt(e.doc,w),w);n=w+F.size,r.push(F)}return r}var sr=null;function Gr(e){sr?sr.ops.push(e):e.ownsGroup=sr={ops:[e],delayedCallbacks:[]}}function Kr(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 Wn(e,t){var i=e.ownsGroup;if(!i)return;try{Kr(i)}finally{sr=null,t(i)}}var pn=null;function pr(e,t){var i=ct(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;sr?n=sr.delayedCallbacks:pn?n=pn:(n=pn=[],setTimeout(Os,0));for(var w=function(Y){n.push(function(){return i[Y].apply(null,r)})},F=0;F<i.length;++F)w(F)}function Os(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Za(e,t,i,r){for(var n=0;n<t.changes.length;n++){var w=t.changes[n];w=="text"?Ms(e,t):w=="gutter"?Qa(e,t,i,r):w=="class"?da(e,t):w=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),z&&j<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(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):kt(e,t)}function Ms(e,t){var i=t.text.className,r=Ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):i&&(t.text.className=i)}function da(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=a("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 w=t.line.gutterMarkers;if(e.options.lineNumbers||w){var F=mn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),F.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!w||!w["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",ui(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),w)for(var J=0;J<e.display.gutterSpecs.length;++J){var q=e.display.gutterSpecs[J].className,fe=w.hasOwnProperty(q)&&w[q];fe&&Y.appendChild(a("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,w=void 0;n;n=w)w=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);qa(e,t,i)}function Ns(e,t,i,r){var n=Ja(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),da(e,t),Qa(e,t,i,r),qa(e,t,r),t.node}function qa(e,t,i){if(eo(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,i,!1)}function eo(e,t,i,r,n){if(!t.widgets)return;for(var w=mn(i),F=0,Y=t.widgets;F<Y.length;++F){var J=Y[F],q=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Bs(J,q,i,r),e.display.input.setUneditable(q),n&&J.above?w.insertBefore(q,i.gutter||i.text):w.appendChild(q),pr(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(!E(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;"),u(t.display.measure,a("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 Hn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("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 ri(e){return ce-e.display.nativeBarWidth}function Oi(e){return e.display.scroller.clientWidth-ri(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-ri(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Oi(e);if(!t.measure.heights||r&&t.measure.width!=n){var w=t.measure.heights=[];if(r){t.measure.width=n;for(var F=t.text.firstChild.getClientRects(),Y=0;Y<F.length-1;Y++){var J=F[Y],q=F[Y+1];Math.abs(J.bottom-q.bottom)>2&&w.push((J.bottom+q.top)/2-i.top)}}w.push(i.bottom-i.top)}}function ro(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(Lt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Sr(t);var i=Lt(t),r=e.display.externalMeasured=new yi(e.doc,t,i);r.lineN=i;var n=r.built=kt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function io(e,t,i,r){return ii(e,Xi(e,t),i,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ii(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Lt(t),r=pa(e,i);r&&!r.text?r=null:r&&r.changes&&(Za(e,r,i,xa(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=ro(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ii(e,t,i,r,n){t.before&&(i=-1);var w=i+(r||""),F;return t.cache.hasOwnProperty(w)?F=t.cache[w]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),F=Ws(e,t,i,r),F.bogus||(t.cache[w]=F)),{left:F.left,right:F.right,top:n?F.rtop:F.top,bottom:n?F.rbottom:F.bottom}}var no={left:0,right:0,top:0,bottom:0};function ao(e,t,i){for(var r,n,w,F,Y,J,q=0;q<e.length;q+=3)if(Y=e[q],J=e[q+1],t<Y?(n=0,w=1,F="left"):t<J?(n=t-Y,w=n+1):(q==e.length-3||t==J&&e[q+3]>t)&&(w=J-Y,n=w-1,t>=J&&(F="right")),n!=null){if(r=e[q+2],Y==J&&i==(r.insertLeft?"left":"right")&&(F=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],F="left";if(i=="right"&&n==J-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],F="right";break}return{node:r,start:n,end:w,collapse:F,coverStart:Y,coverEnd:J}}function js(e,t){var i=no;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=ao(t.map,i,r),w=n.node,F=n.start,Y=n.end,J=n.collapse,q;if(w.nodeType==3){for(var fe=0;fe<4;fe++){for(;F&&Be(t.line.text.charAt(n.coverStart+F));)--F;for(;n.coverStart+Y<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+Y));)++Y;if(z&&j<9&&F==0&&Y==n.coverEnd-n.coverStart?q=w.parentNode.getBoundingClientRect():q=js(y(w,F,Y).getClientRects(),r),q.left||q.right||F==0)break;Y=F,F=F-1,J="right"}z&&j<11&&(q=Hs(e.display.measure,q))}else{F>0&&(J=r="right");var pe;e.options.lineWrapping&&(pe=w.getClientRects()).length>1?q=pe[r=="right"?pe.length-1:0]:q=w.getBoundingClientRect()}if(z&&j<9&&!F&&(!q||!q.left&&!q.right)){var ke=w.parentNode.getClientRects()[0];ke?q={left:ke.left,right:ke.left+$i(e.display),top:ke.top,bottom:ke.bottom}:q=no}for(var _e=q.top-t.rect.top,Fe=q.bottom-t.rect.top,Ge=(_e+Fe)/2,Xe=t.view.measure.heights,et=0;et<Xe.length-1&&!(Ge<Xe[et]);et++);var ot=et?Xe[et-1]:0,tt=Xe[et],ut={left:(J=="right"?q.right:q.left)-t.rect.left,right:(J=="left"?q.left:q.right)-t.rect.left,top:ot,bottom:tt};return!q.left&&!q.right&&(ut.bogus=!0),e.options.singleCursorHeightPerLine||(ut.rtop=_e,ut.rbottom=Fe),ut}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 oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vn(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return v&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return v&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function zn(e,t,i,r,n){if(!n){var w=ma(t);i.top+=w,i.bottom+=w}if(r=="line")return i;r||(r="local");var F=Zr(t);if(r=="local"?F+=Hn(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();F+=Y.top+(r=="window"?0:uo());var J=Y.left+(r=="window"?0:lo());i.left+=J,i.right+=J}return i.top+=F,i.bottom+=F,i}function ho(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=lo(),n-=uo();else if(i=="local"||!i){var w=e.display.sizer.getBoundingClientRect();r+=w.left,n+=w.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:n-F.top}}function ga(e,t,i,r,n){return r||(r=pt(e.doc,t.line)),zn(e,r,io(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,w){r=r||pt(e.doc,t.line),n||(n=Xi(e,r));function F(Fe,Ge){var Xe=ii(e,n,Fe,Ge?"right":"left",w);return Ge?Xe.left=Xe.right:Xe.right=Xe.left,zn(e,r,Xe,i)}var Y=Qe(r,e.doc.direction),J=t.ch,q=t.sticky;if(J>=r.text.length?(J=r.text.length,q="before"):J<=0&&(J=0,q="after"),!Y)return F(q=="before"?J-1:J,q=="before");function fe(Fe,Ge,Xe){var et=Y[Ge],ot=et.level==1;return F(Xe?Fe-1:Fe,ot!=Xe)}var pe=$e(Y,J,q),ke=Ye,_e=fe(J,pe,q=="before");return ke!=null&&(_e.other=fe(J,ke,q!="before")),_e}function co(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=pt(e.doc,t.line),n=Zr(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function va(e,t,i,r,n){var w=Ve(e,t,i);return w.xRel=n,r&&(w.outside=r),w}function ya(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return va(r.first,0,null,-1,-1);var n=Mr(r,i),w=r.first+r.size-1;if(n>w)return va(r.first+r.size-1,pt(r,w).text.length,null,1,1);t<0&&(t=0);for(var F=pt(r,n);;){var Y=zs(e,F,n,t,i),J=ti(F,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var q=J.find(1);if(q.line==n)return q;F=pt(r,n=q.line)}}function fo(e,t,i,r){r-=ma(t);var n=t.text.length,w=rt(function(F){return ii(e,i,F-1).bottom<=r},n,0);return n=rt(function(F){return ii(e,i,F).top>r},w,n),{begin:w,end:n}}function po(e,t,i,r){i||(i=Xi(e,t));var n=zn(e,t,ii(e,i,r),"line").top;return fo(e,t,i,n)}function ba(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-=Zr(t);var w=Xi(e,t),F=ma(t),Y=0,J=t.text.length,q=!0,fe=Qe(t,e.doc.direction);if(fe){var pe=(e.options.lineWrapping?Ks:Gs)(e,t,i,w,fe,r,n);q=pe.level!=1,Y=q?pe.from:pe.to-1,J=q?pe.to:pe.from-1}var ke=null,_e=null,Fe=rt(function(xt){var gt=ii(e,w,xt);return gt.top+=F,gt.bottom+=F,ba(gt,r,n,!1)?(gt.top<=n&&gt.left<=r&&(ke=xt,_e=gt),!0):!1},Y,J),Ge,Xe,et=!1;if(_e){var ot=r-_e.left<_e.right-r,tt=ot==q;Fe=ke+(tt?0:1),Xe=tt?"after":"before",Ge=ot?_e.left:_e.right}else{!q&&(Fe==J||Fe==Y)&&Fe++,Xe=Fe==0?"after":Fe==t.text.length?"before":ii(e,w,Fe-(q?1:0)).bottom+F<=n==q?"after":"before";var ut=Jr(e,Ve(i,Fe,Xe),"line",t,w);Ge=ut.left,et=n<ut.top?-1:n>=ut.bottom?1:0}return Fe=Ne(t.text,Fe,1),va(i,Fe,Xe,et,r-Ge)}function Gs(e,t,i,r,n,w,F){var Y=rt(function(pe){var ke=n[pe],_e=ke.level!=1;return ba(Jr(e,Ve(i,_e?ke.to:ke.from,_e?"before":"after"),"line",t,r),w,F,!0)},0,n.length-1),J=n[Y];if(Y>0){var q=J.level!=1,fe=Jr(e,Ve(i,q?J.from:J.to,q?"after":"before"),"line",t,r);ba(fe,w,F,!0)&&fe.top>F&&(J=n[Y-1])}return J}function Ks(e,t,i,r,n,w,F){var Y=fo(e,t,r,F),J=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var fe=null,pe=null,ke=0;ke<n.length;ke++){var _e=n[ke];if(_e.from>=q||_e.to<=J)continue;var Fe=_e.level!=1,Ge=ii(e,r,Fe?Math.min(q,_e.to)-1:Math.max(J,_e.from)).right,Xe=Ge<w?w-Ge+1e9:Ge-w;(!fe||pe>Xe)&&(fe=_e,pe=Xe)}return fe||(fe=n[n.length-1]),fe.from<J&&(fe={from:J,to:fe.to,level:fe.level}),fe.to>q&&(fe={from:fe.from,to:q,level:fe.level}),fe}var Pi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pi==null){Pi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pi.appendChild(document.createTextNode("x")),Pi.appendChild(a("br"));Pi.appendChild(document.createTextNode("x"))}u(e.measure,Pi);var i=Pi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function xa(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,w=t.gutters.firstChild,F=0;w;w=w.nextSibling,++F){var Y=e.display.gutterSpecs[F].className;i[Y]=w.offsetLeft+w.clientLeft+n,r[Y]=w.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(Dr(e.doc,n))return 0;var w=0;if(n.widgets)for(var F=0;F<n.widgets.length;F++)n.widgets[F].height&&(w+=n.widgets[F].height);return i?w+(Math.ceil(n.text.length/r)||1)*t:w+t}}function Sa(e){var t=e.doc,i=mo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Mi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var w,F,Y=n.lineSpace.getBoundingClientRect();try{w=t.clientX-Y.left,F=t.clientY-Y.top}catch(pe){return null}var J=ya(e,w,F),q;if(r&&J.xRel>0&&(q=pt(e.doc,J.line).text).length==J.ch){var fe=$(q,q.length,e.options.tabSize)-q.length;J=Ve(J.line,Math.max(0,Math.round((w-to(e.display).left)/$i(e.display))-fe))}return J}function Ii(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 Cr(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)Er&&vi(e.doc,t)<n.viewTo&&xi(e);else if(i<=n.viewFrom)Er&&Fn(e.doc,i+r)>n.viewFrom?xi(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)xi(e);else if(t<=n.viewFrom){var w=Gn(e,i,i+r,1);w?(n.view=n.view.slice(w.index),n.viewFrom=w.lineN,n.viewTo+=r):xi(e)}else if(i>=n.viewTo){var F=Gn(e,t,t,-1);F?(n.view=n.view.slice(0,F.index),n.viewTo=F.lineN):xi(e)}else{var Y=Gn(e,t,t,-1),J=Gn(e,i,i+r,1);Y&&J?(n.view=n.view.slice(0,Y.index).concat(Ut(e,Y.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):xi(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function bi(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 w=r.view[Ii(e,t)];if(w.node==null)return;var F=w.changes||(w.changes=[]);oe(F,i)==-1&&F.push(i)}function xi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,i,r){var n=Ii(e,t),w,F=e.display.view;if(!Er||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,J=0;J<n;J++)Y+=F[J].size;if(Y!=t){if(r>0){if(n==F.length-1)return null;w=Y+F[n].size-t,n++}else w=Y-t;t+=w,i+=w}for(;vi(e.doc,i)!=i;){if(n==(r<0?0:F.length-1))return null;i+=r*F[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=Ut(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Ut(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ii(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Ut(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ii(e,i)))),r.viewTo=i}function go(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 vo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),w=r.selection=document.createDocumentFragment(),F=0;F<i.sel.ranges.length;F++){if(!t&&F==i.sel.primIndex)continue;var Y=i.sel.ranges[F];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var J=Y.empty();(J||e.options.showCursorWhenSelecting)&&yo(e,Y.head,n),J||Xs(e,Y,w)}return r}function yo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("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 w=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));w.style.display="",w.style.left=r.other.left+"px",w.style.top=r.other.top+"px",w.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,w=document.createDocumentFragment(),F=to(e.display),Y=F.left,J=Math.max(r.sizerWidth,Oi(e)-r.sizer.offsetLeft)-F.right,q=n.direction=="ltr";function fe(tt,ut,xt,gt){ut<0&&(ut=0),ut=Math.round(ut),gt=Math.round(gt),w.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+tt+`px;
top: `+ut+"px; width: "+(xt==null?J-tt:xt)+`px;
height: `+(gt-ut)+"px"))}function pe(tt,ut,xt){var gt=pt(n,tt),At=gt.text.length,Xt,hr;function $t(rr,_r){return ga(e,Ve(tt,rr),"div",gt,_r)}function Or(rr,_r,mr){var or=po(e,gt,null,rr),ir=_r=="ltr"==(mr=="after")?"left":"right",Jt=mr=="after"?or.begin:or.end-(/\s/.test(gt.text.charAt(or.end-1))?2:1);return $t(Jt,ir)[ir]}var Ar=Qe(gt,n.direction);return qe(Ar,ut||0,xt==null?At:xt,function(rr,_r,mr,or){var ir=mr=="ltr",Jt=$t(rr,ir?"left":"right"),Lr=$t(_r-1,ir?"right":"left"),un=ut==null&&rr==0,Ai=xt==null&&_r==At,vr=or==0,ni=!Ar||or==Ar.length-1;if(Lr.top-Jt.top<=3){var dr=(q?un:Ai)&&vr,Xa=(q?Ai:un)&&ni,mi=dr?Y:(ir?Jt:Lr).left,ji=Xa?J:(ir?Lr:Jt).right;fe(mi,Jt.top,ji-mi,Jt.bottom)}else{var Wi,br,hn,Ya;ir?(Wi=q&&un&&vr?Y:Jt.left,br=q?J:Or(rr,mr,"before"),hn=q?Y:Or(_r,mr,"after"),Ya=q&&Ai&&ni?J:Lr.right):(Wi=q?Or(rr,mr,"before"):Y,br=!q&&un&&vr?J:Jt.right,hn=!q&&Ai&&ni?Y:Lr.left,Ya=q?Or(_r,mr,"after"):J),fe(Wi,Jt.top,br-Wi,Jt.bottom),Jt.bottom<Lr.top&&fe(Y,Jt.bottom,null,Lr.top),fe(hn,Lr.top,Ya-hn,Lr.bottom)}(!Xt||Kn(Jt,Xt)<0)&&(Xt=Jt),Kn(Lr,Xt)<0&&(Xt=Lr),(!hr||Kn(Jt,hr)<0)&&(hr=Jt),Kn(Lr,hr)<0&&(hr=Lr)}),{start:Xt,end:hr}}var ke=t.from(),_e=t.to();if(ke.line==_e.line)pe(ke.line,ke.ch,_e.ch);else{var Fe=pt(n,ke.line),Ge=pt(n,_e.line),Xe=Sr(Fe)==Sr(Ge),et=pe(ke.line,ke.ch,Xe?Fe.text.length+1:null).end,ot=pe(_e.line,Xe?0:null,_e.ch).start;Xe&&(et.top<ot.top-2?(fe(et.right,et.top,null,et.bottom),fe(Y,ot.top,ot.left,ot.bottom)):fe(et.right,et.top,ot.left-et.right,et.bottom)),et.bottom<ot.top&&fe(Y,et.bottom,null,ot.top)}i.appendChild(w)}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 bo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(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(),I&&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&&(Ue(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],w=e.options.lineWrapping,F=void 0,Y=0;if(n.hidden)continue;if(z&&j<8){var J=n.node.offsetTop+n.node.offsetHeight;F=J-i,i=J}else{var q=n.node.getBoundingClientRect();F=q.bottom-q.top,!w&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var fe=n.line.height-F;if((fe>.005||fe<-.005)&&(xr(n.line,F),Eo(n.line),n.rest))for(var pe=0;pe<n.rest.length;pe++)Eo(n.rest[pe]);if(Y>e.display.sizerWidth){var ke=Math.ceil(Y/$i(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function Eo(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 Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,w=Mr(t,r),F=Mr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,J=i.ensure.to.line;Y<w?(w=Y,F=Mr(t,Zr(pt(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=F&&(w=Mr(t,Zr(pt(t,J))-e.wrapper.clientHeight),F=J)}return{from:w,to:Math.max(F,w+1)}}function Ys(e,t){if(Ke(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 w=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+ri(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(w),w.scrollIntoView(n),e.display.lineSpace.removeChild(w)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var w=0;w<5;w++){var F=!1,Y=Jr(e,t),J=!i||i==t?Y:Jr(e,i);n={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var q=wa(e,n),fe=e.doc.scrollTop,pe=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(F=!0)),q.scrollLeft!=null&&(Ni(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-pe)>1&&(F=!0)),!F)break}return n}function Zs(e,t){var i=wa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ni(e,i.scrollLeft)}function wa(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,w=fa(e),F={};t.bottom-t.top>w&&(t.bottom=t.top+w);var Y=e.doc.height+ca(i),J=t.top<r,q=t.bottom>Y-r;if(t.top<n)F.scrollTop=J?0:t.top;else if(t.bottom>n+w){var fe=Math.min(t.top,(q?Y:t.bottom)-w);fe!=n&&(F.scrollTop=fe)}var pe=e.options.fixedGutter?0:i.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-pe,_e=Oi(e)-i.gutters.offsetWidth,Fe=t.right-t.left>_e;return Fe&&(t.right=t.left+_e),t.left<10?F.scrollLeft=0:t.left<ke?F.scrollLeft=Math.max(0,t.left+pe-(Fe?0:10)):t.right>_e+ke-3&&(F.scrollLeft=t.right+(Fe?0:10)-_e),F}function Aa(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Yn(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)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=co(e,t.from),r=co(e,t.to);So(e,i,r,t.margin)}}function So(e,t,i,r){var n=wa(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;D||La(e,{top:t}),To(e,t,!0),D&&La(e),Tn(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 Ni(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,Lo(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+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ri(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Bi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Pe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bi.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 w=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+w)+"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}},Bi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bi.prototype.zeroWidthHack=function(){var e=l&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Bi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),w=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);w!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bi.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 Qi(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),Co(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function Co(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 wo={native:Bi,null:Sn};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(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"?Ni(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Ui(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},Gr(e.curOp)}function Fi(e){var t=e.curOp;t&&Wn(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 w=0;w<t.length;w++)il(t[w]);for(var F=0;F<t.length;F++)nl(t[F])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(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 $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+ri(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Oi(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&&Ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&bo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&_o(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&&Ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var w=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(w)for(var Y=0;Y<w.length;++Y)w[Y].lines.length||Ue(w[Y],"hide");if(F)for(var J=0;J<F.length;++J)F[J].lines.length&&Ue(F[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rr(e,t){if(e.curOp)return t();Ui(e);try{return t()}finally{Fi(e)}}function lr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ui(e);try{return t.apply(e,arguments)}finally{Fi(e)}}}function yr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ui(this);try{return e.apply(this,arguments)}finally{Fi(this)}}}function ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ui(t);try{return e.apply(this,arguments)}finally{Fi(t)}}}function Tn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,R(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Ze(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(w){if(r.line>=e.display.viewFrom){var F=w.styles,Y=w.text.length>e.options.maxHighlightLength?Hr(t.mode,r.state):null,J=ve(e,w,r,!0);Y&&(r.state=Y),w.styles=J.styles;var q=w.styleClasses,fe=J.classes;fe?w.styleClasses=fe:q&&(w.styleClasses=null);for(var pe=!F||F.length!=w.styles.length||q!=fe&&(!q||!fe||q.bgClass!=fe.bgClass||q.textClass!=fe.textClass),ke=0;!pe&&ke<F.length;++ke)pe=F[ke]!=w.styles[ke];pe&&n.push(r.line),w.stateAfter=r.save(),r.nextLine()}else w.text.length<=e.options.maxHighlightLength&&lt(e,w.text,r),w.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Rr(e,function(){for(var w=0;w<n.length;w++)bi(e,n[w],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Oi(e),this.force=i,this.dims=xa(e),this.events=[]};$n.prototype.signal=function(e,t){ge(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ue.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=ri(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ri(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=N();if(!t||!E(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(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==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return xi(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&&go(e)==0)return!1;ko(e)&&(xi(e),t.dims=xa(e));var n=r.first+r.size,w=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<w&&w-i.viewFrom<20&&(w=Math.max(r.first,i.viewFrom)),i.viewTo>F&&i.viewTo-F<20&&(F=Math.min(n,i.viewTo)),Er&&(w=vi(e.doc,w),F=Fn(e.doc,F));var Y=w!=i.viewFrom||F!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,w,F),i.viewOffset=Zr(pt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=go(e);if(!Y&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=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(q),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Tn(e,400)),i.updateLineNumbers=null,!0}function _o(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Oi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ca(e.display)-fa(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!_a(e,t))break;Vn(e);var n=En(e);yn(e),Qi(e,n),Da(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 La(e,t){var i=new $n(e,t);if(_a(e,i)){Vn(e),_o(e,i);var r=En(e);yn(e),Qi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,w=r.lineDiv,F=w.firstChild;function Y(Fe){var Ge=Fe.nextSibling;return I&&l&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),Ge}for(var J=r.view,q=r.viewFrom,fe=0;fe<J.length;fe++){var pe=J[fe];if(!pe.hidden)if(!pe.node||pe.node.parentNode!=w){var ke=Ns(e,pe,q,i);w.insertBefore(ke,F)}else{for(;F!=pe.node;)F=Y(F);var _e=n&&t!=null&&t<=q&&pe.lineNumber;pe.changes&&(oe(pe.changes,"gutter")>-1&&(_e=!1),Za(e,pe,q,i)),_e&&(c(pe.lineNumber),pe.lineNumber.appendChild(document.createTextNode(ui(e.options,q)))),F=pe.node.nextSibling}q+=pe.size}for(;F;)F=Y(F)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+ri(e)+"px"}function Lo(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,w=r+"px",F=0;F<i.length;F++)if(!i[F].hidden){e.options.fixedGutter&&(i[F].gutter&&(i[F].gutter.style.left=w),i[F].gutterBackground&&(i[F].gutterBackground.style.left=w));var Y=i[F].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=w}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=ui(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),w=n.firstChild.offsetWidth,F=n.offsetWidth-w;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(w,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var w=e[n],F=null;if(typeof w!="string"&&(F=w.style,w=w.className),w=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:w,style:F})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Do(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],w=n.className,F=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+w));F&&(Y.style.cssText=F),w=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Cn(e){Do(e.display),Cr(e),Lo(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=x("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var w=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[w],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+ce+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),z&&j<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!I&&!(D&&o)&&(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=Ra(r.gutters,r.lineNumbers),Do(n),i.init(n)}var Zn=0,Fr=null;z?Fr=-.53:D?Fr=15:v?Fr=-.7:O&&(Fr=-1/3);function Ro(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=Ro(e);return t.x*=Fr,t.y*=Fr,t}function Oo(e,t){var i=Ro(t),r=i.x,n=i.y,w=e.display,F=w.scroller,Y=F.scrollWidth>F.clientWidth,J=F.scrollHeight>F.clientHeight;if(!(r&&Y||n&&J))return;if(n&&l&&I){e:for(var q=t.target,fe=w.view;q!=F;q=q.parentNode)for(var pe=0;pe<fe.length;pe++)if(fe[pe].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!D&&!A&&Fr!=null){n&&J&&xn(e,Math.max(0,F.scrollTop+n*Fr)),Ni(e,Math.max(0,F.scrollLeft+r*Fr)),(!n||n&&J)&&re(t),w.wheelStartX=null;return}if(n&&Fr!=null){var ke=n*Fr,_e=e.doc.scrollTop,Fe=_e+w.wrapper.clientHeight;ke<0?_e=Math.max(0,_e+ke-50):Fe=Math.min(e.doc.height,Fe+ke+50),La(e,{top:_e,bottom:Fe})}Zn<20&&(w.wheelStartX==null?(w.wheelStartX=F.scrollLeft,w.wheelStartY=F.scrollTop,w.wheelDX=r,w.wheelDY=n,setTimeout(function(){if(w.wheelStartX==null)return;var Ge=F.scrollLeft-w.wheelStartX,Xe=F.scrollTop-w.wheelStartY,et=Xe&&w.wheelDY&&Xe/w.wheelDY||Ge&&w.wheelDX&&Ge/w.wheelDX;if(w.wheelStartX=w.wheelStartY=null,!et)return;Fr=(Fr*Zn+et)/(Zn+1),++Zn},200)):(w.wheelDX+=r,w.wheelDY+=n))}var jr=function(e,t){this.ranges=e,this.primIndex=t};jr.prototype.primary=function(){return this.ranges[this.primIndex]},jr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!hi(i.anchor,r.anchor)||!hi(i.head,r.head))return!1}return!0},jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(_i(this.ranges[t].anchor),_i(this.ranges[t].head));return new jr(e,this.primIndex)},jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},jr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(Tt(t,r.from())>=0&&Tt(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Li(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 Qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(ke,_e){return Tt(ke.from(),_e.from())}),i=oe(t,n);for(var w=1;w<t.length;w++){var F=t[w],Y=t[w-1],J=Tt(Y.to(),F.from());if(r&&!F.empty()?J>0:J>=0){var q=Li(Y.from(),F.from()),fe=di(Y.to(),F.to()),pe=Y.empty()?F.from()==F.head:Y.from()==Y.head;w<=i&&--i,t.splice(--w,2,new jt(pe?fe:q,pe?q:fe))}}return new jr(t,i)}function Ei(e,t){return new jr([new jt(e,t||e)],0)}function Si(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Si(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+=Si(t).ch-t.to.ch),Ve(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Po(n.anchor,t),Po(n.head,t)))}return Qr(e.cm,i,e.sel.primIndex)}function Mo(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),w=n,F=0;F<t.length;F++){var Y=t[F],J=Mo(Y.from,n,w),q=Mo(Si(Y),n,w);if(n=Y.to,w=q,i=="around"){var fe=e.sel.ranges[F],pe=Tt(fe.head,fe.anchor)<0;r[F]=new jt(pe?q:J,pe?J:q)}else r[F]=new jt(J,J)}return new jr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Vr(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,Tn(e,100),e.state.modeGen++,e.curOp&&Cr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(ot){return i?i[ot]:null}function w(ot,tt,ut){$a(ot,tt,ut,r),pr(ot,"change",ot,t)}function F(ot,tt){for(var ut=[],xt=ot;xt<tt;++xt)ut.push(new Ri(q[xt],n(xt),r));return ut}var Y=t.from,J=t.to,q=t.text,fe=pt(e,Y.line),pe=pt(e,J.line),ke=te(q),_e=n(q.length-1),Fe=J.line-Y.line;if(t.full)e.insert(0,F(0,q.length)),e.remove(q.length,e.size-q.length);else if(Io(e,t)){var Ge=F(0,q.length-1);w(pe,pe.text,_e),Fe&&e.remove(Y.line,Fe),Ge.length&&e.insert(Y.line,Ge)}else if(fe==pe)if(q.length==1)w(fe,fe.text.slice(0,Y.ch)+ke+fe.text.slice(J.ch),_e);else{var Xe=F(1,q.length-1);Xe.push(new Ri(ke+fe.text.slice(J.ch),_e,r)),w(fe,fe.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,Xe)}else if(q.length==1)w(fe,fe.text.slice(0,Y.ch)+q[0]+pe.text.slice(J.ch),n(0)),e.remove(Y.line+1,Fe);else{w(fe,fe.text.slice(0,Y.ch)+q[0],n(0)),w(pe,ke+pe.text.slice(J.ch),_e);var et=F(1,q.length-1);Fe>1&&e.remove(Y.line+1,Fe-1),e.insert(Y.line+1,et)}pr(e,"change",e,t)}function Ti(e,t,i){function r(n,w,F){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var J=n.linked[Y];if(J.doc==w)continue;var q=F&&J.sharedHist;if(i&&!q)continue;t(J.doc,q),r(J.doc,n,q)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Sa(e),Pa(e),Bo(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Cr(e)}function Bo(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rr(e,function(){Bo(e),Cr(e)})}function Jn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var i={from:_i(t.from),to:Si(t),text:Pr(e,t.from,t.to)};return jo(e,i,t.from.line,t.to.line+1),Ti(e,function(r){return jo(r,i,t.from.line,t.to.line+1)},!0),i}function Uo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(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 Fo(e,t,i,r){var n=e.history;n.undone.length=0;var w=+new Date,F,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>w-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(n,n.lastOp==r)))Y=te(F.changes),Tt(t.from,t.to)==0&&Tt(t.from,Y.to)==0?Y.to=Si(t):F.changes.push(Ia(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Qn(e.sel,n.done),F={changes:[Ia(e,t)],generation:n.generation},n.done.push(F);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=w,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Ue(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,w=r&&r.origin;i==n.lastSelOp||w&&n.lastSelOrigin==w&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==w||ml(e,w,te(n.done),t))?n.done[n.done.length-1]=t:Qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=w,n.lastSelOp=i,r&&r.clearRedo!==!1&&Uo(n.undone)}function Qn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function jo(e,t,i,r){var n=t["spans_"+e.id],w=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((n||(n=t["spans_"+e.id]={}))[w]=F.markedSpans),++w})}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 Wo(e,t){var i=yl(e,t),r=$r(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var w=i[n],F=r[n];if(w&&F){e:for(var Y=0;Y<F.length;++Y){for(var J=F[Y],q=0;q<w.length;++q)if(w[q].marker==J.marker)continue e;w.push(J)}}else F&&(i[n]=F)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var w=e[n];if(w.ranges){r.push(i?jr.prototype.deepCopy.call(w):w);continue}var F=w.changes,Y=[];r.push({changes:Y});for(var J=0;J<F.length;++J){var q=F[J],fe=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var pe in q)(fe=pe.match(/^spans_(\d+)$/))&&(oe(t,Number(fe[1]))>-1&&(te(Y)[pe]=q[pe],delete q[pe]))}}return r}function Na(e,t,i,r){if(r){var n=e.anchor;if(i){var w=Tt(t,n)<0;w!=Tt(i,n)<0?(n=t,t=i):w!=Tt(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),gr(e,new jr([Na(e.sel.primary(),t,i,n)],0),r)}function Ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),w=0;w<e.sel.ranges.length;w++)r[w]=Na(e.sel.ranges[w],t[w],null,n);var F=Qr(e.cm,r,e.sel.primIndex);gr(e,F,i)}function Ba(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,gr(e,Qr(e.cm,n,e.sel.primIndex),r)}function zo(e,t,i,r){gr(e,Ei(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var w=0;w<n.length;w++)this.ranges[w]=new jt(s(e,n[w].anchor),s(e,n[w].head))},origin:i&&i.origin};return Ue(e,"beforeSelectionChange",e,r),e.cm&&Ue(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Qr(e.cm,r.ranges,r.ranges.length-1):t}function Go(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):gr(e,t,i)}function gr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(ge(e,"beforeSelectionChange")||e.cm&&ge(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),pr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,i,r){for(var n,w=0;w<t.ranges.length;w++){var F=t.ranges[w],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[w],J=ta(e,F.anchor,Y&&Y.anchor,i,r),q=ta(e,F.head,Y&&Y.head,i,r);(n||J!=F.anchor||q!=F.head)&&(n||(n=t.ranges.slice(0,w)),n[w]=new jt(J,q))}return n?Qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var w=pt(e,t.line);if(w.markedSpans)for(var F=0;F<w.markedSpans.length;++F){var Y=w.markedSpans[F],J=Y.marker,q="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,fe="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(fe?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Ue(J,"beforeCursorEnter"),J.explicitlyCleared))if(w.markedSpans){--F;continue}else break;if(!J.atomic)continue;if(i){var pe=J.find(r<0?1:-1),ke=void 0;if((r<0?fe:q)&&(pe=Yo(e,pe,-r,pe&&pe.line==t.line?w:null)),pe&&pe.line==t.line&&(ke=Tt(pe,i))&&(r<0?ke<0:ke>0))return en(e,pe,t,r,n)}var _e=J.find(r<0?-1:1);return(r<0?q:fe)&&(_e=Yo(e,_e,r,_e.line==t.line?w:null)),_e?en(e,_e,t,r,n):null}}return t}function ta(e,t,i,r,n){var w=r||1,F=en(e,t,i,w,n)||!n&&en(e,t,i,w,!0)||en(e,t,i,-w,n)||!n&&en(e,t,i,-w,!0);return F||(e.cantEdit=!0,Ve(e.first,0))}function Yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ve(t.line-1)):null:i>0&&t.ch==(r||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function $o(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Ee)}function Zo(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,w,F,Y){n&&(r.from=s(e,n)),w&&(r.to=s(e,w)),F&&(r.text=F),Y!==void 0&&(r.origin=Y)}),Ue(e,"beforeChange",e,r),e.cm&&Ue(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 tn(e,t,i){if(e.cm){if(!e.cm.curOp)return lr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Hi&&!i&&ki(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Jo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var i=Oa(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,$r(e,t));var r=[];Ti(e,function(n,w){!w&&oe(r,n.history)==-1&&(ts(n.history,t),r.push(n.history)),An(n,t,null,$r(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,w,F=e.sel,Y=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(w=Y[q],i?w.ranges&&!w.equals(e.sel):!w.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(w=Y.pop(),w.ranges){if(Qn(w,J),i&&!w.equals(e.sel)){gr(e,w,{clearRedo:!1});return}F=w}else if(r){Y.push(w);return}else break;var fe=[];Qn(F,J),J.push({changes:fe,generation:n.generation}),n.generation=w.generation||++n.maxGeneration;for(var pe=ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"),ke=function(Ge){var Xe=w.changes[Ge];if(Xe.origin=t,pe&&!Zo(e,Xe,!1))return Y.length=0,{};fe.push(Ia(e,Xe));var et=Ge?Oa(e,Xe):te(Y);An(e,Xe,et,Wo(e,Xe)),!Ge&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:Si(Xe)});var ot=[];Ti(e,function(tt,ut){!ut&&oe(ot,tt.history)==-1&&(ts(tt.history,Xe),ot.push(tt.history)),An(tt,Xe,null,Wo(tt,Xe))})},_e=w.changes.length-1;_e>=0;--_e){var Fe=ke(_e);if(Fe)return Fe.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new jr(he(e.sel.ranges,function(n){return new jt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Cr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)bi(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return lr(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:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var w=e.lastLine();t.to.line>w&&(t={from:t.from,to:Ve(w,pt(e,w).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),ea(e,i,Ee),e.cantEdit&&ta(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,w=t.from,F=t.to,Y=!1,J=w.line;e.options.lineWrapping||(J=Lt(Sr(pt(r,w.line))),r.iter(J,F.line+1,function(_e){if(_e==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),Ma(r,t,i,mo(e)),e.options.lineWrapping||(r.iter(J,w.line+t.text.length,function(_e){var Fe=Vi(_e);Fe>n.maxLineLength&&(n.maxLine=_e,n.maxLineLength=Fe,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),zr(r,w.line),Tn(e,400);var q=t.text.length-(F.line-w.line)-1;t.full?Cr(e):w.line==F.line&&t.text.length==1&&!Io(e.doc,t)?bi(e,w.line,"text"):Cr(e,w.line,F.line+1,q);var fe=ge(e,"changes"),pe=ge(e,"change");if(pe||fe){var ke={from:w,to:F,text:t.text,removed:t.removed,origin:t.origin};pe&&pr(e,"change",e,ke),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var w;r||(r=i),Tt(r,i)<0&&(w=[r,i],i=w[0],r=w[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,r){for(var n=0;n<e.length;++n){var w=e[n],F=!0;if(w.ranges){w.copied||(w=e[n]=w.deepCopy(),w.copied=!0);for(var Y=0;Y<w.ranges.length;Y++)qo(w.ranges[Y].anchor,t,i,r),qo(w.ranges[Y].head,t,i,r);continue}for(var J=0;J<w.changes.length;++J){var q=w.changes[J];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){F=!1;break}}F||(e.splice(0,n+1),n=0)}}function ts(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;es(e.done,i,r,n),es(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,w=t;return typeof t=="number"?w=pt(e,G(e,t)):n=Lt(t),n==null?null:(r(w,n)&&e.cm&&bi(e.cm,n,i),w)}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),pr(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 kn(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}kn.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 w=Math.min(t,n-e),F=r.height;if(r.removeInner(e,w),this.height-=F-r.height,n==w&&(this.children.splice(i--,1),r.parent=null),(t-=w)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Y=[];this.collapse(Y),this.children=[new Ln(Y)],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],w=n.chunkSize();if(e<=w){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var F=n.lines.length%25+25,Y=F;Y<n.lines.length;){var J=new Ln(n.lines.slice(Y,Y+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,F),this.maybeSpill()}break}e-=w}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new kn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new kn(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],w=n.chunkSize();if(e<w){var F=Math.min(t,w-e);if(n.iterN(e,F,i))return!0;if((t-=F)==0)break;e=0}else e-=w}}};var Dn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Dn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Lt(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 w=gn(this);xr(i,Math.max(0,i.height-w)),e&&(Rr(e,function(){rs(e,i,-w),bi(e,r,"widget")}),pr(e,"lineWidgetCleared",e,this,r))},Dn.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;Dr(this.doc,r)||xr(r,r.height+n),i&&Rr(i,function(){i.curOp.forceUpdate=!0,rs(i,r,n),pr(i,"lineWidgetChanged",i,e,Lt(r))})},be(Dn);function rs(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,i)}function El(e,t,i,r){var n=new Dn(e,i,r),w=e.cm;return w&&n.noHScroll&&(w.display.alignWidgets=!0),_n(e,t,"widget",function(F){var Y=F.widgets||(F.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=F,w&&!Dr(e,F)){var J=Zr(F)<e.scrollTop;xr(F,F.height+gn(n)),J&&Aa(w,n.height),w.curOp.forceUpdate=!0}return!0}),w&&pr(w,"lineWidgetAdded",w,n,typeof t=="number"?t:Lt(t)),n}var is=0,Ci=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Ci.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ui(e),ge(this,"clear")){var i=this.find();i&&pr(this,"clear",i.from,i.to)}for(var r=null,n=null,w=0;w<this.lines.length;++w){var F=this.lines[w],Y=Yr(F.markedSpans,this);e&&!this.collapsed?bi(e,Lt(F),"text"):e&&(Y.to!=null&&(n=Lt(F)),Y.from!=null&&(r=Lt(F))),F.markedSpans=ci(F.markedSpans,Y),Y.from==null&&this.collapsed&&!Dr(this.doc,F)&&e&&xr(F,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var q=Sr(this.lines[J]),fe=Vi(q);fe>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Cr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&pr(e,"markerCleared",e,this,r,n),t&&Fi(e),this.parent&&this.parent.clear()},Ci.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var w=this.lines[n],F=Yr(w.markedSpans,this);if(F.from!=null&&(i=Ve(t?w:Lt(w),F.from),e==-1))return i;if(F.to!=null&&(r=Ve(t?w:Lt(w),F.to),e==1))return r}return i&&{from:i,to:r}},Ci.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Rr(r,function(){var n=t.line,w=Lt(t.line),F=pa(r,w);if(F&&(oo(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Dr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var J=gn(i)-Y;J&&xr(n,n.height+J)}pr(r,"markerChanged",r,e)})},Ci.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ci.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Ci);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return lr(e.cm,nn)(e,t,i,r,n);var w=new Ci(e,n),F=Tt(t,i);if(r&&M(r,w,!1),F>0||F==0&&w.clearWhenEmpty!==!1)return w;if(w.replacedWith&&(w.collapsed=!0,w.widgetNode=x("span",[w.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||w.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(w.widgetNode.insertLeft=!0)),w.collapsed){if(Qt(e,t.line,t,i,w)||t.line!=i.line&&Qt(e,i.line,t,i,w))throw new Error("Inserting collapsed marker partially overlapping an existing one");kr()}w.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,q;if(e.iter(Y,i.line+1,function(pe){J&&w.collapsed&&!J.options.lineWrapping&&Sr(pe)==J.display.maxLine&&(q=!0),w.collapsed&&Y!=t.line&&xr(pe,0),ei(pe,new gi(w,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),w.collapsed&&e.iter(t.line,i.line+1,function(pe){Dr(e,pe)&&xr(pe,0)}),w.clearOnEnter&&Pe(w,"beforeCursorEnter",function(){return w.clear()}),w.readOnly&&(Br(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),w.collapsed&&(w.id=++is,w.atomic=!0),J){if(q&&(J.curOp.updateMaxLine=!0),w.collapsed)Cr(J,t.line,i.line+1);else if(w.className||w.startStyle||w.endStyle||w.css||w.attributes||w.title)for(var fe=t.line;fe<=i.line;fe++)bi(J,fe,"text");w.atomic&&Vo(J.doc),pr(J,"markerAdded",J,w)}return w}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();pr(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},be(Rn);function Sl(e,t,i,r,n){r=M(r),r.shared=!1;var w=[nn(e,t,i,r,n)],F=w[0],Y=r.widgetNode;return Ti(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),w.push(nn(J,s(J,t),s(J,i),r,n));for(var q=0;q<J.linked.length;++q)if(J.linked[q].isParent)return;F=te(w)}),new Rn(w,F)}function ns(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),w=e.clipPos(n.from),F=e.clipPos(n.to);if(Tt(w,F)){var Y=nn(e,w,F,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],w=[n.primary.doc];Ti(n.primary.doc,function(J){return w.push(J)});for(var F=0;F<n.markers.length;F++){var Y=n.markers[F];oe(w,Y.doc)==-1&&(Y.parent=null,n.markers.splice(F--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,wr=function(e,t,i,r,n){if(!(this instanceof wr))return new wr(e,t,i,r,n);i==null&&(i=0),kn.call(this,[new Ln([new Ri("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var w=Ve(i,0);this.sel=Ei(w),this.history=new Jn(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)),Ma(this,{from:w,to:w,text:e}),gr(this,Ei(w),Ee)};wr.prototype=Re(kn.prototype,{constructor:wr,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:ur(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,pt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),gr(this,Ei(t),Ee)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Pr(this,s(this,e),s(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(Xr(this,e))return pt(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),Sr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(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:ur(function(e,t,i){zo(this,s(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:ur(function(e,t,i){zo(this,s(this,e),s(this,t||e),i)}),extendSelection:ur(function(e,t,i){qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:ur(function(e,t){Ho(this,W(this,e),t)}),extendSelectionsBy:ur(function(e,t){var i=he(this.sel.ranges,e);Ho(this,W(this,i),t)}),setSelections:ur(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),gr(this,Qr(this.cm,r,t),i)}),addSelection:ur(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),gr(this,Qr(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=Pr(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=Pr(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:ur(function(e,t,i){for(var r=[],n=this.sel,w=0;w<n.ranges.length;w++){var F=n.ranges[w];r[w]={from:F.from(),to:F.to(),text:this.splitLines(e[w]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)tn(this,r[J]);Y?Go(this,Y):this.cm&&Ji(this.cm)}),undo:ur(function(){ra(this,"undo")}),redo:ur(function(){ra(this,"redo")}),undoSelection:ur(function(){ra(this,"undo",!0)}),redoSelection:ur(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,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 Jn(this.history.maxGeneration),Ti(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:ur(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ie(n)&&(r.gutterMarkers=null),!0})}),clearGutter:ur(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ie(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xr(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=Lt(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:ur(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(b(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:ur(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",w=r[n];if(w)if(i==null)r[n]=null;else{var F=w.match(b(i));if(!F)return!1;var Y=F.index+F[0].length;r[n]=w.slice(0,F.index)+(!F.index||Y==w.length?"":" ")+w.slice(Y)||null}else return!1;return!0})}),addLineWidget:ur(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(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=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=pt(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=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(w){var F=w.markedSpans;if(F)for(var Y=0;Y<F.length;Y++){var J=F[Y];!(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 w=n.text.length+r;if(w>e)return t=e,!0;e-=w,++i}),s(this,Ve(i,t))},indexFromPos:function(e){e=s(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 wr(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 wr(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}],Tl(r,ns(this)),r},unlinkDoc:function(e){if(e instanceof Yt&&(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),Cl(ns(this));break}if(e.history==this.history){var r=[e.id];Ti(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ti(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):St(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:ur(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)})}),wr.prototype.eachLine=wr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Ke(t,e)||fi(t.display,e))return;re(e),z&&(as=+new Date);var i=Mi(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,w=Array(n),F=0,Y=function(){++F==n&&lr(t,function(){i=s(t.doc,i);var _e={from:i,to:i,text:t.doc.splitLines(w.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,_e),Go(t.doc,Ei(s(t.doc,i),s(t.doc,Si(_e))))})()},J=function(_e,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,_e.type)==-1){Y();return}var Ge=new FileReader;Ge.onerror=function(){return Y()},Ge.onload=function(){var Xe=Ge.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){Y();return}w[Fe]=Xe,Y()},Ge.readAsText(_e)},q=0;q<r.length;q++)J(r[q],q);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 fe=e.dataTransfer.getData("Text");if(fe){var pe;if(t.state.draggingText&&!t.state.draggingText.copy&&(pe=t.listSelections()),ea(t.doc,Ei(i,i)),pe)for(var ke=0;ke<pe.length;++ke)rn(t.doc,"",pe[ke].anchor,pe[ke].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(_e){}}}function _l(e,t){if(z&&(!e.state.draggingText||+new Date-as<100)){de(t);return}if(Ke(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Mi(e,t);if(!i)return;var r=document.createDocumentFragment();yo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var w=0;w<i.length;w++)e(i[w])})}var ls=!1;function kl(){if(ls)return;Dl(),ls=!0}function Dl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Rl)},100))}),Pe(window,"blur",function(){return ss(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wi={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++)wi[On+48]=wi[On+96]=String(On);for(var ia=65;ia<=90;ia++)wi[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)wi[Pn+111]=wi[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=l?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,w,F=0;F<t.length-1;F++){var Y=t[F];if(/^(cmd|meta|m)$/i.test(Y))w=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),w&&(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=he(i.split(" "),Ol),w=0;w<n.length;w++){var F=void 0,Y=void 0;w==n.length-1?(Y=n.join(" "),F=r):(Y=n.slice(0,w+1).join(" "),F="...");var J=t[Y];if(!J)t[Y]=F;else if(J!=F)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var q in t)e[q]=t[q];return e}function an(e,t,i,r){t=na(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 an(e,t.fallthrough,i,r);for(var w=0;w<t.fallthrough.length;w++){var F=an(e,t.fallthrough[w],i,r);if(F)return F}}}function us(e){var t=typeof e=="string"?e:wi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function hs(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ds(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=wi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),hs(i,e,t))}function na(e){return typeof e=="string"?pi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var w=t(i[n]);r.length&&Tt(w.from,te(r).to)<=0;){var F=r.pop();if(Tt(F.from,w.from)<0){w.from=F.from;break}}r.push(w)}Rr(e,function(){for(var Y=r.length-1;Y>=0;Y--)rn(e.doc,"",r[Y].from,r[Y].to,"+delete");Ji(e)})}function Ua(e,t,i){var r=Ne(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function ja(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var w=Qe(i,t.doc.direction);if(w){var F=n<0?te(w):w[0],Y=n<0==(F.level==1),J=Y?"after":"before",q;if(F.level>0||t.doc.direction=="rtl"){var fe=Xi(t,i);q=n<0?i.text.length-1:0;var pe=ii(t,fe,q).top;q=rt(function(ke){return ii(t,fe,ke).top==pe},n<0==(F.level==1)?F.from:F.to-1,q),J=="before"&&(q=Ua(i,q,1))}else q=n<0?F.to:F.from;return new Ve(r,q,J)}}return new Ve(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Qe(t,e.doc.direction);if(!n)return Fa(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 w=$e(n,i.ch,i.sticky),F=n[w];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>i.ch:F.from<i.ch))return Fa(t,i,r);var Y=function(et,ot){return Ua(t,et instanceof Ve?et.ch:et,ot)},J,q=function(et){return e.options.lineWrapping?(J=J||Xi(e,t),po(e,t,J,et)):{begin:0,end:t.text.length}},fe=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||F.level==1){var pe=F.level==1==r<0,ke=Y(i,pe?1:-1);if(ke!=null&&(pe?ke<=F.to&&ke<=fe.end:ke>=F.from&&ke>=fe.begin)){var _e=pe?"before":"after";return new Ve(i.line,ke,_e)}}var Fe=function(et,ot,tt){for(var ut=function(Xt,hr){return hr?new Ve(i.line,Y(Xt,1),"before"):new Ve(i.line,Xt,"after")};et>=0&&et<n.length;et+=ot){var xt=n[et],gt=ot>0==(xt.level!=1),At=gt?tt.begin:Y(tt.end,-1);if(xt.from<=At&&At<xt.to)return ut(At,gt);if(At=gt?xt.from:Y(xt.to,-1),tt.begin<=At&&At<tt.end)return ut(At,gt)}},Ge=Fe(w+r,r,fe);if(Ge)return Ge;var Xe=r>0?fe.end:Y(fe.begin,-1);return Xe!=null&&!(r>0&&Xe==t.text.length)&&(Ge=Fe(r>0?0:n.length-1,r,q(Xe)),Ge)?Ge:null}var Mn={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=pt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:s(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(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 on(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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},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")},Te)},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/)?fs(e,t.head):r},Te)},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 w=i[n].from(),F=$(e.getLine(w.line),w.ch,r);t.push(le(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,w=pt(e.doc,n.line).text;if(w){if(n.ch==w.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(w.charAt(n.ch-1)+w.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var F=pt(e.doc,n.line-1).text;F&&(n=new Ve(n.line,1),e.replaceRange(w.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ve(n.line-1,F.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Rr(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);Ji(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var i=pt(e.doc,t),r=Sr(i);return r!=i&&(t=Lt(r)),ja(!0,e,r,t,1)}function Il(e,t){var i=pt(e.doc,t),r=Gi(i);return r!=i&&(t=Lt(r)),ja(!0,e,i,t,-1)}function fs(e,t){var i=cs(e,t.line),r=pt(e.doc,i.line),n=Qe(r,e.doc.direction);if(!n||n[0].level==0){var w=Math.max(i.ch,r.text.search(/\S/)),F=t.line==i.line&&t.ch<=w&&t.ch;return Ve(i.line,F?0:w,i.sticky)}return i}function aa(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)!=De}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=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new ee;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(us(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())}),ps(e,n+" "+t,i,r))return!0}return ps(e,t,i,r)}function ps(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&pr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function ms(e,t){var i=ds(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):In(e,i,t,function(r){return aa(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ke(t,e))return;z&&j<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=ms(t,e);A&&(Wa=r?i:null,!r&&i==88&&!Gt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!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)&&(m(t,"CodeMirror-crosshair"),at(document,"keyup",i),at(document,"mouseover",i))}Pe(document,"keyup",i),Pe(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==Wa){Wa=null,re(e);return}if(A&&(!e.which||e.which<10)&&ms(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,Ha=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ha.prototype.compare=function(e,t,i){return this.time+jl>e&&Tt(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 Ha(i,e,t),Nn=null,"double"):(Nn=new Ha(i,e,t),Bn=null,"single")}function bs(e){var t=this,i=t.display;if(Ke(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){I||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(za(t,e))return;var r=Mi(t,e),n=Se(e),w=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,w,e))return;n==1?r?Gl(t,r,w,e):Le(e)==i.scroller&&re(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,i,r,n){var w="Click";return r=="double"?w="Double"+w:r=="triple"&&(w="Triple"+w),w=(t==1?"Left":t==2?"Middle":"Right")+w,In(e,hs(w,n),n,function(F){if(typeof F=="string"&&(F=Mn[F]),!F)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=F(e,i)!=De}finally{e.state.suppressEdits=!1}return Y})}function zl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var w=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=w?"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=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){z?setTimeout(R(bo,e),0):e.curOp.focus=N();var n=zl(e,i,r),w=e.doc.sel,F;e.options.dragDrop&&We&&!e.isReadOnly()&&i=="single"&&(F=w.contains(t))>-1&&(Tt((F=w.ranges[F]).from(),t)<0||t.xRel>0)&&(Tt(F.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,w=!1,F=lr(e,function(q){I&&(n.scroller.draggable=!1),e.state.draggingText=!1,at(n.wrapper.ownerDocument,"mouseup",F),at(n.wrapper.ownerDocument,"mousemove",Y),at(n.scroller,"dragstart",J),at(n.scroller,"drop",F),w||(re(q),r.addNew||qn(e.doc,i,null,null,r.extend),I&&!O||z&&j==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){w=w||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},J=function(){return w=!0};I&&(n.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Pe(n.wrapper.ownerDocument,"mouseup",F),Pe(n.wrapper.ownerDocument,"mousemove",Y),Pe(n.scroller,"dragstart",J),Pe(n.scroller,"drop",F),xo(e),setTimeout(function(){return n.input.focus()},20)}function xs(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Ve(t.line,0),s(e.doc,Ve(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,w=e.doc;re(t);var F,Y,J=w.sel,q=J.ranges;if(r.addNew&&!r.extend?(Y=w.sel.contains(i),Y>-1?F=q[Y]:F=new jt(i,i)):(F=w.sel.primary(),Y=w.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new jt(i,i)),i=Mi(e,t,!0,!0),Y=-1;else{var fe=xs(e,i,r.unit);r.extend?F=Na(F,fe.anchor,fe.head,r.extend):F=fe}r.addNew?Y==-1?(Y=q.length,gr(w,Qr(e,q.concat([F]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(gr(w,Qr(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=w.sel):Ba(w,Y,F,Ce):(Y=0,gr(w,new jr([F],0),Ce),J=w.sel);var pe=i;function ke(tt){if(Tt(pe,tt)==0)return;if(pe=tt,r.unit=="rectangle"){for(var ut=[],xt=e.options.tabSize,gt=$(pt(w,i.line).text,i.ch,xt),At=$(pt(w,tt.line).text,tt.ch,xt),Xt=Math.min(gt,At),hr=Math.max(gt,At),$t=Math.min(i.line,tt.line),Or=Math.min(e.lastLine(),Math.max(i.line,tt.line));$t<=Or;$t++){var Ar=pt(w,$t).text,rr=we(Ar,Xt,xt);Xt==hr?ut.push(new jt(Ve($t,rr),Ve($t,rr))):Ar.length>rr&&ut.push(new jt(Ve($t,rr),Ve($t,we(Ar,hr,xt))))}ut.length||ut.push(new jt(i,i)),gr(w,Qr(e,J.ranges.slice(0,Y).concat(ut),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(tt)}else{var _r=F,mr=xs(e,tt,r.unit),or=_r.anchor,ir;Tt(mr.anchor,or)>0?(ir=mr.head,or=Li(_r.from(),mr.anchor)):(ir=mr.anchor,or=di(_r.to(),mr.head));var Jt=J.ranges.slice(0);Jt[Y]=Xl(e,new jt(s(w,or),ir)),gr(w,Qr(e,Jt,Y),Ce)}}var _e=n.wrapper.getBoundingClientRect(),Fe=0;function Ge(tt){var ut=++Fe,xt=Mi(e,tt,!0,r.unit=="rectangle");if(!xt)return;if(Tt(xt,pe)!=0){e.curOp.focus=N(),ke(xt);var gt=Xn(n,w);(xt.line>=gt.to||xt.line<gt.from)&&setTimeout(lr(e,function(){Fe==ut&&Ge(tt)}),150)}else{var At=tt.clientY<_e.top?-20:tt.clientY>_e.bottom?20:0;At&&setTimeout(lr(e,function(){if(Fe!=ut)return;n.scroller.scrollTop+=At,Ge(tt)}),50)}}function Xe(tt){e.state.selectingText=!1,Fe=Infinity,tt&&(re(tt),n.input.focus()),at(n.wrapper.ownerDocument,"mousemove",et),at(n.wrapper.ownerDocument,"mouseup",ot),w.history.lastSelOrigin=null}var et=lr(e,function(tt){tt.buttons===0||!Se(tt)?Xe(tt):Ge(tt)}),ot=lr(e,Xe);e.state.selectingText=ot,Pe(n.wrapper.ownerDocument,"mousemove",et),Pe(n.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var i=t.anchor,r=t.head,n=pt(e.doc,i.line);if(Tt(i,r)==0&&i.sticky==r.sticky)return t;var w=Qe(n);if(!w)return t;var F=$e(w,i.ch,i.sticky),Y=w[F];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var J=F+(Y.from==i.ch==(Y.level!=1)?0:1);if(J==0||J==w.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=$e(w,r.ch,r.sticky),pe=fe-F||(r.ch-i.ch)*(Y.level==1?-1:1);fe==J-1||fe==J?q=pe<0:q=pe>0}var ke=w[J+(q?-1:0)],_e=q==(ke.level==1),Fe=_e?ke.from:ke.to,Ge=_e?"after":"before";return i.ch==Fe&&i.sticky==Ge?t:new jt(new Ve(i.line,Fe,Ge),r)}function Es(e,t,i,r){var n,w;if(t.touches)n=t.touches[0].clientX,w=t.touches[0].clientY;else try{n=t.clientX,w=t.clientY}catch(ke){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var F=e.display,Y=F.lineDiv.getBoundingClientRect();if(w>Y.bottom||!ge(e,i))return se(t);w-=Y.top-F.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var q=F.gutters.childNodes[J];if(q&&q.getBoundingClientRect().right>=n){var fe=Mr(e.doc,w),pe=e.display.gutterSpecs[J];return Ue(e,i,e,fe,pe.className,t),se(t)}}}function za(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ge(e,"gutterContextMenu")?Es(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 sn={toString:function(){return"CodeMirror.Init"}},Cs={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,w,F){e.defaults[r]=n,w&&(t[r]=F?function(Y,J,q){q!=sn&&w(Y,J,q)}:w)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Pa(r)},!0),i("indentUnit",2,Pa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Cr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var w=[],F=r.doc.first;r.doc.iter(function(J){for(var q=0;;){var fe=J.text.indexOf(n,q);if(fe==-1)break;q=fe+n.length,w.push(Ve(F,fe))}F++});for(var Y=w.length-1;Y>=0;Y--)rn(r.doc,n,w[Y],Ve(w[Y].line,w[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,w){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),w!=sn&&r.refresh()}),i("specialCharPlaceholder",Bt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"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",!C),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Cn(r)},!0),i("keyMap","default",function(r,n,w){var F=na(n),Y=w!=sn&&na(w);Y&&Y.detach&&Y.detach(r,F),F.attach&&F.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),Cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){Ao(r),Qi(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=Ra(r.options.gutters,n),Cn(r)},!0),i("firstLineNumber",1,Cn,!0),i("lineNumberFormatter",function(r){return r},Cn,!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,Zl),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 Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,w=t?Pe:at;w(e.display.scroller,"dragstart",n.start),w(e.display.scroller,"dragenter",n.enter),w(e.display.scroller,"dragover",n.over),w(e.display.scroller,"dragleave",n.leave),w(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):(m(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Sa(e),Cr(e),vn(e),setTimeout(function(){return Qi(e)},100)}function Yt(e,t){var i=this;if(!(this instanceof Yt))return new Yt(e,t);this.options=t=t?M(t):{},M(Cs,t,!1);var r=t.value;typeof r=="string"?r=new wr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Yt.inputStyles[t.inputStyle](this),w=this.display=new hl(e,r,n,t);w.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&w.input.focus(),z&&j<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),Ui(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):Zi(this);for(var F in oa)oa.hasOwnProperty(F)&&oa[F](this,t[F],sn);ko(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);Fi(this),I&&t.lineWrapping&&getComputedStyle(w.lineDiv).textRendering=="optimizelegibility"&&(w.lineDiv.style.textRendering="auto")}Yt.defaults=Cs,Yt.optionHandlers=oa;function Ql(e){var t=e.display;Pe(t.scroller,"mousedown",lr(e,bs)),z&&j<11?Pe(t.scroller,"dblclick",lr(e,function(J){if(Ke(e,J))return;var q=Mi(e,J);if(!q||za(e,J)||fi(e.display,J))return;re(J);var fe=e.findWordAt(q);qn(e.doc,fe.anchor,fe.head)})):Pe(t.scroller,"dblclick",function(J){return Ke(e,J)||re(J)}),Pe(t.scroller,"contextmenu",function(J){return Ss(e,J)}),Pe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Ss(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 w(J){if(J.touches.length!=1)return!1;var q=J.touches[0];return q.radiusX<=1&&q.radiusY<=1}function F(J,q){if(q.left==null)return!0;var fe=q.left-J.left,pe=q.top-J.top;return fe*fe+pe*pe>20*20}Pe(t.scroller,"touchstart",function(J){if(!Ke(e,J)&&!w(J)&&!za(e,J)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(J){var q=t.activeTouch;if(q&&!fi(t,J)&&q.left!=null&&!q.moved&&new Date-q.start<300){var fe=e.coordsChar(t.activeTouch,"page"),pe;!q.prev||F(q,q.prev)?pe=new jt(fe,fe):!q.prev.prev||F(q,q.prev.prev)?pe=e.findWordAt(fe):pe=new jt(Ve(fe.line,0),s(e.doc,Ve(fe.line+1,0))),e.setSelection(pe.anchor,pe.head),e.focus(),re(J)}n()}),Pe(t.scroller,"touchcancel",n),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(J){return Oo(e,J)}),Pe(t.scroller,"DOMMouseScroll",function(J){return Oo(e,J)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ke(e,J)||de(J)},over:function(J){Ke(e,J)||(Ll(e,J),de(J))},start:function(J){return _l(e,J)},drop:lr(e,Al),leave:function(J){Ke(e,J)||os(e)}};var Y=t.input.getField();Pe(Y,"keyup",function(J){return vs.call(e,J)}),Pe(Y,"keydown",lr(e,gs)),Pe(Y,"keypress",lr(e,ys)),Pe(Y,"focus",function(J){return Ca(e,J)}),Pe(Y,"blur",function(J){return Zi(e,J)})}var Ga=[];Yt.defineInitHook=function(e){return Ga.push(e)};function Un(e,t,i,r){var n=e.doc,w;i==null&&(i="add"),i=="smart"&&(n.mode.indent?w=Ze(e,t).state:i="prev");var F=e.options.tabSize,Y=pt(n,t),J=$(Y.text,null,F);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(Y.text))fe=0,i="not";else if(i=="smart"&&(fe=n.mode.indent(w,Y.text.slice(q.length),Y.text),fe==De||fe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?fe=$(pt(n,t-1).text,null,F):fe=0:i=="add"?fe=J+e.options.indentUnit:i=="subtract"?fe=J-e.options.indentUnit:typeof i=="number"&&(fe=J+i),fe=Math.max(0,fe);var pe="",ke=0;if(e.options.indentWithTabs)for(var _e=Math.floor(fe/F);_e;--_e)ke+=F,pe+=" ";if(ke<fe&&(pe+=le(fe-ke)),pe!=q)return rn(n,pe,Ve(t,0),Ve(t,q.length),"+input"),Y.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var Ge=n.sel.ranges[Fe];if(Ge.head.line==t&&Ge.head.ch<q.length){var Xe=Ve(t,q.length);Ba(n,Fe,new jt(Xe,Xe));break}}}var qr=null;function sa(e){qr=e}function Ka(e,t,i,r,n){var w=e.doc;e.display.shift=!1,r||(r=w.sel);var F=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>F,J=St(t),q=null;if(Y&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){q=[];for(var fe=0;fe<qr.text.length;fe++)q.push(w.splitLines(qr.text[fe]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=he(J,function(et){return[et]}));for(var pe=e.curOp.updateInput,ke=r.ranges.length-1;ke>=0;ke--){var _e=r.ranges[ke],Fe=_e.from(),Ge=_e.to();_e.empty()&&(i&&i>0?Fe=Ve(Fe.line,Fe.ch-i):e.state.overwrite&&!Y?Ge=Ve(Ge.line,Math.min(pt(w,Ge.line).text.length,Ge.ch+te(J).length)):Y&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(Fe=Ge=Ve(Fe.line,0)));var Xe={from:Fe,to:Ge,text:q?q[ke%q.length]:J,origin:n||(Y?"paste":e.state.cutIncoming>F?"cut":"+input")};tn(e.doc,Xe),pr(e,"inputRead",e,Xe)}t&&!Y&&As(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=pe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rr(t,function(){return Ka(t,i,0,null,"paste")}),!0}function As(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 w=e.getModeAt(n.head),F=!1;if(w.electricChars){for(var Y=0;Y<w.electricChars.length;Y++)if(t.indexOf(w.electricChars.charAt(Y))>-1){F=Un(e,n.head.line,"smart");break}}else w.electricInput&&(w.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(F=Un(e,n.head.line,"smart")));F&&pr(e,"electricInput",e,n.head.line)}}function _s(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,w={anchor:Ve(n,0),head:Ve(n+1,0)};i.push(w),t.push(e.getRange(w.anchor,w.head))}return{text:t,ranges:i}}function Ls(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),Ls(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 w=this.options,F=w[r];if(w[r]==n&&r!="mode")return;w[r]=n,t.hasOwnProperty(r)&&lr(this,t[r])(this,n,F),Ue(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"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,w=0;w<n.length;++w)if(n[w]==r||n[w].name==r)return n.splice(w,1),!0},addOverlay:yr(function(r,n){var w=r.token?r:e.getMode(this.options,r);if(w.startState)throw new Error("Overlays may not be stateful.");ie(this.state.overlays,{mode:w,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(F){return F.priority}),this.state.modeGen++,Cr(this)}),removeOverlay:yr(function(r){for(var n=this.state.overlays,w=0;w<n.length;++w){var F=n[w].modeSpec;if(F==r||typeof r=="string"&&F.name==r){n.splice(w,1),this.state.modeGen++,Cr(this);return}}}),indentLine:yr(function(r,n,w){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Xr(this.doc,r)&&Un(this,r,n,w)}),indentSelection:yr(function(r){for(var n=this.doc.sel.ranges,w=-1,F=0;F<n.length;F++){var Y=n[F];if(Y.empty())Y.head.line>w&&(Un(this,Y.head.line,r,!0),w=Y.head.line,F==this.doc.sel.primIndex&&Ji(this));else{var J=Y.from(),q=Y.to(),fe=Math.max(w,J.line);w=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var pe=fe;pe<w;++pe)Un(this,pe,r);var ke=this.doc.sel.ranges;J.ch==0&&n.length==ke.length&&ke[F].from().ch>0&&Ba(this.doc,F,new jt(J,ke[F].to()),Ee)}}}),getTokenAt:function(r,n){return Vt(this,r,n)},getLineTokens:function(r,n){return Vt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=He(this,pt(this.doc,r.line)),w=0,F=(n.length-1)/2,Y=r.ch,J;if(Y==0)J=n[2];else for(;;){var q=w+F>>1;if((q?n[q*2-1]:0)>=Y)F=q;else if(n[q*2+1]<Y)w=q+1;else{J=n[q*2+2];break}}var fe=J?J.indexOf("overlay "):-1;return fe<0?J:fe==0?null:J.slice(0,fe-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 w=[];if(!i.hasOwnProperty(n))return w;var F=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")F[Y[n]]&&w.push(F[Y[n]]);else if(Y[n])for(var J=0;J<Y[n].length;J++){var q=F[Y[n][J]];q&&w.push(q)}else Y.helperType&&F[Y.helperType]?w.push(F[Y.helperType]):F[Y.name]&&w.push(F[Y.name]);for(var fe=0;fe<F._global.length;fe++){var pe=F._global[fe];pe.pred(Y,this)&&oe(w,pe.val)==-1&&w.push(pe.val)}return w},getStateAfter:function(r,n){var w=this.doc;return r=G(w,r==null?w.first+w.size-1:r),Ze(this,r+1,n).state},cursorCoords:function(r,n){var w,F=this.doc.sel.primary();return r==null?w=F.head:typeof r=="object"?w=s(this.doc,r):w=r?F.from():F.to(),Jr(this,w,n||"page")},charCoords:function(r,n){return ga(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=ho(this,r,n||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,n){return r=ho(this,{top:r,left:0},n||"page").top,Mr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,w){var F=!1,Y;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,F=!0),Y=pt(this.doc,r)}else Y=r;return zn(this,Y,{top:0,left:0},n||"page",w||F).top+(F?this.doc.height-Zr(Y):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,w,F,Y){var J=this.display;r=Jr(this,s(this.doc,r));var q=r.bottom,fe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),F=="over")q=r.top;else if(F=="above"||F=="near"){var pe=Math.max(J.wrapper.clientHeight,this.doc.height),ke=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(F=="above"||r.bottom+n.offsetHeight>pe)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=pe&&(q=r.bottom),fe+n.offsetWidth>ke&&(fe=ke-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(fe=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?fe=0:Y=="middle"&&(fe=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=fe+"px"),w&&Zs(this,{left:fe,top:q,right:fe+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:yr(gs),triggerOnKeyPress:yr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:yr(bs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:yr(function(r){As(this,r)}),findPosH:function(r,n,w,F){var Y=1;n<0&&(Y=-1,n=-n);for(var J=s(this.doc,r),q=0;q<n&&!(J=Va(this.doc,J,Y,w,F),J.hitSide);++q);return J},moveH:yr(function(r,n){var w=this;this.extendSelectionsBy(function(F){return w.display.shift||w.doc.extend||F.empty()?Va(w.doc,F.head,r,n,w.options.rtlMoveVisually):r<0?F.from():F.to()},Te)}),deleteH:yr(function(r,n){var w=this.doc.sel,F=this.doc;w.somethingSelected()?F.replaceSelection("",null,"+delete"):on(this,function(Y){var J=Va(F,Y.head,r,n,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,n,w,F){var Y=1,J=F;n<0&&(Y=-1,n=-n);for(var q=s(this.doc,r),fe=0;fe<n;++fe){var pe=Jr(this,q,"div");if(J==null?J=pe.left:pe.left=J,q=Ds(this,pe,Y,w),q.hitSide)break}return q},moveV:yr(function(r,n){var w=this,F=this.doc,Y=[],J=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(fe){if(J)return r<0?fe.from():fe.to();var pe=Jr(w,fe.head,"div");fe.goalColumn!=null&&(pe.left=fe.goalColumn),Y.push(pe.left);var ke=Ds(w,pe,r,n);return n=="page"&&fe==F.sel.primary()&&Aa(w,ga(w,ke,"div").top-pe.top),ke},Te),Y.length)for(var q=0;q<F.sel.ranges.length;q++)F.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var n=this.doc,w=pt(n,r.line).text,F=r.ch,Y=r.ch;if(w){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==w.length)&&F?--F:++Y;for(var q=w.charAt(F),fe=Me(q,J)?function(pe){return Me(pe,J)}:/\s/.test(q)?function(pe){return/\s/.test(pe)}:function(pe){return!/\s/.test(pe)&&!Me(pe)};F>0&&fe(w.charAt(F-1));)--F;for(;Y<w.length&&fe(w.charAt(Y));)++Y}return new jt(Ve(r.line,F),Ve(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:yr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ri(this)-this.display.barHeight,width:r.scrollWidth-ri(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Oi(this)}},scrollIntoView:yr(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:Ve(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):So(this,r.from,r.to,r.margin)}),setSize:yr(function(r,n){var w=this,F=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=F(r)),n!=null&&(this.display.wrapper.style.height=F(n)),this.options.lineWrapping&&so(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(J){if(J.widgets){for(var q=0;q<J.widgets.length;q++)if(J.widgets[q].noHScroll){bi(w,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Ue(this,"refresh",this)}),operation:function(r){return Rr(this,r)},startOperation:function(){return Ui(this)},endOperation:function(){return Fi(this)},refresh:yr(function(){var r=this.display.cachedTextHeight;Cr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Sa(this),Ue(this,"refresh",this)}),swapDoc:yr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pr(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}},be(e),e.registerHelper=function(r,n,w){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=w},e.registerGlobalHelper=function(r,n,w,F){e.registerHelper(r,n,F),i[r]._global.push({pred:w,val:F})}}function Va(e,t,i,r,n){var w=t,F=i,Y=pt(e,t.line),J=n&&e.direction=="rtl"?-i:i;function q(){var ot=t.line+J;return ot<e.first||ot>=e.first+e.size?!1:(t=new Ve(ot,t.ch,t.sticky),Y=pt(e,ot))}function fe(ot){var tt;if(r=="codepoint"){var ut=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ut)?tt=null:tt=new Ve(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(ut>=55296&&ut<56320?2:1))),-i)}else n?tt=Ml(e.cm,Y,t,i):tt=Fa(Y,t,i);if(tt==null)if(!ot&&q())t=ja(n,e.cm,Y,t.line,J);else return!1;else t=tt;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var pe=null,ke=r=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!fe(!Fe));Fe=!1){var Ge=Y.text.charAt(t.ch)||`
`,Xe=Me(Ge,_e)?"w":ke&&Ge==`
`?"n":!ke||/\s/.test(Ge)?null:"p";if(ke&&!Fe&&!Xe&&(Xe="s"),pe&&pe!=Xe){i<0&&(i=1,fe(),t.sticky="after");break}if(Xe&&(pe=Xe),i>0&&!fe(!Fe))break}var et=ta(e,t,w,F,!0);return hi(w,et)&&(et.hitSide=!0),et}function Ds(e,t,i,r){var n=e.doc,w=t.left,F;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*Yi(e.display),3);F=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(F=i>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,w,F),!q.outside);){if(i<0?F<=0:F>=n.height){q.hitSide=!0;break}F+=i*5}return q}var zt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};zt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ls(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function w(Y){for(var J=Y.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Pe(n,"paste",function(Y){if(!w(Y)||Ke(r,Y)||ws(Y,r))return;j<=11&&setTimeout(lr(r,function(){return t.updateFromDOM()}),20)}),Pe(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Pe(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Pe(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(n,"touchstart",function(){return i.forceCompositionEnd()}),Pe(n,"input",function(){t.composing||t.readFromDOMSoon()});function F(Y){if(!w(Y)||Ke(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=_s(r);sa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=qr.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var fe=ks(),pe=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),pe.value=qr.text.join(`
`);var ke=document.activeElement;V(pe),setTimeout(function(){r.display.lineSpace.removeChild(fe),ke.focus(),ke==n&&i.showPrimarySelection()},50)}Pe(n,"copy",F),Pe(n,"cut",F)},zt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},zt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},zt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},zt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},zt.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 w=la(t,e.anchorNode,e.anchorOffset),F=la(t,e.focusNode,e.focusOffset);if(w&&!w.bad&&F&&!F.bad&&Tt(Li(w,F),r)==0&&Tt(di(w,F),n)==0)return;var Y=t.display.view,J=r.line>=t.display.viewFrom&&Rs(t,r)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Rs(t,n);if(!q){var fe=Y[Y.length-1].measure,pe=fe.maps?fe.maps[fe.maps.length-1]:fe.map;q={node:pe[pe.length-1],offset:pe[pe.length-2]-pe[pe.length-3]}}if(!J||!q){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),_e;try{_e=y(J.node,J.offset,q.offset,q.node)}catch(Fe){}_e&&(!D&&t.state.focused?(e.collapse(J.node,J.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),ke&&e.anchorNode==null?e.addRange(ke):D&&this.startGracePeriod()),this.rememberSelection()},zt.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)},zt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},zt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},zt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},zt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},zt.prototype.blur=function(){this.div.blur()},zt.prototype.getField=function(){return this.div},zt.prototype.supportsTouch=function(){return!0},zt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Rr(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)},zt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},zt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&v&&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=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Rr(t,function(){gr(t.doc,Ei(i,r),Ee),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},zt.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=Ve(r.line-1,pt(e.doc,r.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var w,F,Y;r.line==t.viewFrom||(w=Ii(e,r.line))==0?(F=Lt(t.view[0].line),Y=t.view[0].node):(F=Lt(t.view[w].line),Y=t.view[w-1].node.nextSibling);var J=Ii(e,n.line),q,fe;if(J==t.view.length-1?(q=t.viewTo-1,fe=t.lineDiv.lastChild):(q=Lt(t.view[J+1].line)-1,fe=t.view[J+1].node.previousSibling),!Y)return!1;for(var pe=e.doc.splitLines(tu(e,Y,fe,F,q)),ke=Pr(e.doc,Ve(F,0),Ve(q,pt(e.doc,q).text.length));pe.length>1&&ke.length>1;)if(te(pe)==te(ke))pe.pop(),ke.pop(),q--;else if(pe[0]==ke[0])pe.shift(),ke.shift(),F++;else break;for(var _e=0,Fe=0,Ge=pe[0],Xe=ke[0],et=Math.min(Ge.length,Xe.length);_e<et&&Ge.charCodeAt(_e)==Xe.charCodeAt(_e);)++_e;for(var ot=te(pe),tt=te(ke),ut=Math.min(ot.length-(pe.length==1?_e:0),tt.length-(ke.length==1?_e:0));Fe<ut&&ot.charCodeAt(ot.length-Fe-1)==tt.charCodeAt(tt.length-Fe-1);)++Fe;if(pe.length==1&&ke.length==1&&F==r.line)for(;_e&&_e>r.ch&&ot.charCodeAt(ot.length-Fe-1)==tt.charCodeAt(tt.length-Fe-1);)_e--,Fe++;pe[pe.length-1]=ot.slice(0,ot.length-Fe).replace(/^\u200b+/,""),pe[0]=pe[0].slice(_e).replace(/\u200b+$/,"");var xt=Ve(F,_e),gt=Ve(q,ke.length?te(ke).length-Fe:0);if(pe.length>1||pe[0]||Tt(xt,gt))return rn(e.doc,pe,xt,gt,"+input"),!0},zt.prototype.ensurePolled=function(){this.forceCompositionEnd()},zt.prototype.reset=function(){this.forceCompositionEnd()},zt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},zt.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)},zt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Rr(this.cm,function(){return Cr(e.cm)})},zt.prototype.setUneditable=function(e){e.contentEditable="false"},zt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||lr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},zt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},zt.prototype.onContextMenu=function(){},zt.prototype.resetPosition=function(){},zt.prototype.needsContentAttribute=!0;function Rs(e,t){var i=pa(e,t.line);if(!i||i.hidden)return null;var r=pt(e.doc,t.line),n=ro(i,r,t.line),w=Qe(r,e.doc.direction),F="left";if(w){var Y=$e(w,t.ch);F=Y%2?"right":"left"}var J=ao(n.map,t.ch,F);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 ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var w="",F=!1,Y=e.doc.lineSeparator(),J=!1;function q(_e){return function(Fe){return Fe.id==_e}}function fe(){F&&(w+=Y,J&&(w+=Y),F=J=!1)}function pe(_e){_e&&(fe(),w+=_e)}function ke(_e){if(_e.nodeType==1){var Fe=_e.getAttribute("cm-text");if(Fe){pe(Fe);return}var Ge=_e.getAttribute("cm-marker"),Xe;if(Ge){var et=e.findMarks(Ve(r,0),Ve(n+1,0),q(+Ge));et.length&&(Xe=et[0].find(0))&&pe(Pr(e.doc,Xe.from,Xe.to).join(Y));return}if(_e.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;ot&&fe();for(var tt=0;tt<_e.childNodes.length;tt++)ke(_e.childNodes[tt]);/^(pre|p)$/i.test(_e.nodeName)&&(J=!0),ot&&(F=!0)}else _e.nodeType==3&&pe(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==i);)t=t.nextSibling,J=!1;return w}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(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 w=e.display.view[n];if(w.node==r)return ru(w,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!E(r,t))return ln(Ve(Lt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var w=e.rest?te(e.rest):e.line;return ln(Ve(Lt(w),w.text.length),n)}var F=t.nodeType==3?t:null,Y=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,i&&(i=F.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var J=e.measure,q=J.maps;function fe(Xe,et,ot){for(var tt=-1;tt<(q?q.length:0);tt++)for(var ut=tt<0?J.map:q[tt],xt=0;xt<ut.length;xt+=3){var gt=ut[xt+2];if(gt==Xe||gt==et){var At=Lt(tt<0?e.line:e.rest[tt]),Xt=ut[xt]+ot;return(ot<0||gt!=Xe)&&(Xt=ut[xt+(ot?1:0)]),Ve(At,Xt)}}}var pe=fe(F,Y,i);if(pe)return ln(pe,n);for(var ke=Y.nextSibling,_e=F?F.nodeValue.length-i:0;ke;ke=ke.nextSibling){if(pe=fe(ke,ke.firstChild,0),pe)return ln(Ve(pe.line,pe.ch-_e),n);_e+=ke.textContent.length}for(var Fe=Y.previousSibling,Ge=i;Fe;Fe=Fe.previousSibling){if(pe=fe(Fe,Fe.firstChild,-1),pe)return ln(Ve(pe.line,pe.ch+Ge),n);Ge+=Fe.textContent.length}}var qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};qt.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),T&&(n.style.width="0px"),Pe(n,"input",function(){z&&j>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Pe(n,"paste",function(F){if(Ke(r,F)||ws(F,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function w(F){if(Ke(r,F))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=_s(r);sa({lineWise:!0,text:Y.text}),F.type=="cut"?r.setSelections(Y.ranges,null,Ee):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}Pe(n,"cut",w),Pe(n,"copy",w),Pe(e.scroller,"paste",function(F){if(fi(e,F)||Ke(r,F))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=F.clipboardData,n.dispatchEvent(Y)}),Pe(e.lineSpace,"selectstart",function(F){fi(e,F)||re(F)}),Pe(n,"compositionstart",function(){var F=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Pe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},qt.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),w=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+F.top-w.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+F.left-w.left))}return r},qt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qt.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&&V(this.textarea),z&&j>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",z&&j>=9&&(this.hasSelection=null))},qt.prototype.getField=function(){return this.textarea},qt.prototype.supportsTouch=function(){return!1},qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},qt.prototype.blur=function(){this.textarea.blur()},qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qt.prototype.receivedFocus=function(){this.slowPoll()},qt.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()})},qt.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)},qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||dt(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(z&&j>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var w=n.charCodeAt(0);if(w==8203&&!r&&(r="\u200B"),w==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,Y=Math.min(r.length,n.length);F<Y&&r.charCodeAt(F)==n.charCodeAt(F);)++F;return Rr(t,function(){Ka(t,n.slice(F),r.length-F,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},qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qt.prototype.onKeyPress=function(){z&&j>=9&&(this.hasSelection=null),this.fastPoll()},qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var w=Mi(i,e),F=r.scroller.scrollTop;if(!w||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(w)==-1&&lr(i,gr)(i.doc,Ei(w),Ee);var J=n.style.cssText,q=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.left-5)+`px;
z-index: 1000; background: `+(z?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var pe;I&&(pe=window.scrollY),r.input.focus(),I&&window.scrollTo(null,pe),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=_e,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function ke(){if(n.selectionStart!=null){var Ge=i.somethingSelected(),Xe="\u200B"+(Ge?n.value:"");n.value="\u21DA",n.value=Xe,t.prevInput=Ge?"":"\u200B",n.selectionStart=1,n.selectionEnd=Xe.length,r.selForContextMenu=i.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=J,z&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),n.selectionStart!=null){(!z||z&&j<9)&&ke();var Ge=0,Xe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?lr(i,$o)(i):Ge++<10?r.detectingSelectAll=setTimeout(Xe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Xe,200)}}if(z&&j>=9&&ke(),L){de(e);var Fe=function(){at(window,"mouseup",Fe),setTimeout(_e,20)};Pe(window,"mouseup",Fe)}else setTimeout(_e,50)},qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qt.prototype.setUneditable=function(){},qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?M(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=N();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var w=e.form;n=w.submit;try{var F=w.submit=function(){r(),w.submit=n,w.submit(),w.submit=F}}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&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Yt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function nu(e){e.off=at,e.on=Pe,e.wheelEventPixels=dl,e.Doc=wr,e.splitLines=St,e.countColumn=$,e.findColumn=we,e.isWordChar=Oe,e.Pass=De,e.signal=Ue,e.Line=Ri,e.changeEnd=Si,e.scrollbarModel=wo,e.Pos=Ve,e.cmpPos=Tt,e.modes=Wt,e.mimeModes=_t,e.resolveMode=vt,e.getMode=Vr,e.modeExtensions=nr,e.extendMode=cr,e.copyState=Hr,e.startState=si,e.innerMode=oi,e.commands=Mn,e.keyMap=pi,e.keyName=ds,e.isModifierKey=us,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=Rn,e.TextMarker=Ci,e.LineWidget=Dn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=de,e.addClass=U,e.contains=E,e.rmClass=m,e.keyNames=wi}$l(Yt),ql(Yt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in wr.prototype)wr.prototype.hasOwnProperty(ua)&&oe(au,ua)<0&&(Yt.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(wr.prototype[ua]));return be(wr),Yt.inputStyles={textarea:qt,contenteditable:zt},Yt.defineMode=function(e){!Yt.defaults.mode&&e!="null"&&(Yt.defaults.mode=e),Wr.apply(this,arguments)},Yt.defineMIME=ai,Yt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yt.defineMIME("text/plain","null"),Yt.defineExtension=function(e,t){Yt.prototype[e]=t},Yt.defineDocExtension=function(e,t){wr.prototype[e]=t},Yt.fromTextArea=iu,nu(Yt),Yt.version="5.58.2",Yt})},Y1PL:function(bt,Je,ae){"use strict";ae.r(Je),ae.d(Je,"ResizableTextArea",function(){return oe});var ue=ae("wx14"),Q=ae("1OyB"),D=ae("vuIU"),Z=ae("Ji7U"),B=ae("LK+K"),P=ae("q1tI"),z=ae("VTBJ"),j=ae("rePB"),I=ae("Zm9Q"),k=ae("Kwbf"),v=ae("c+Xe"),A=ae("m+aA"),O=ae("bdgK"),_=new Map;function S(Ee){Ee.forEach(function(Ce){var Te,we=Ce.target;(Te=_.get(we))===null||Te===void 0||Te.forEach(function(me){return me(we)})})}var T=new O.default(S),h=null,o=null;function l(Ee,Ce){_.has(Ee)||(_.set(Ee,new Set),T.observe(Ee)),_.get(Ee).add(Ce)}function d(Ee,Ce){_.has(Ee)&&(_.get(Ee).delete(Ce),_.get(Ee).size||(T.unobserve(Ee),_.delete(Ee)))}var C=function(Ee){Object(Z.a)(Te,Ee);var Ce=Object(B.a)(Te);function Te(){return Object(Q.a)(this,Te),Ce.apply(this,arguments)}return Object(D.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(P.Component),p=P.createContext(null);function f(Ee){var Ce=Ee.children,Te=Ee.onBatchResize,we=P.useRef(0),me=P.useRef([]),le=P.useContext(p),te=P.useCallback(function(he,ie,Ae){we.current+=1;var Re=we.current;me.current.push({size:he,element:ie,data:Ae}),Promise.resolve().then(function(){Re===we.current&&(Te==null||Te(me.current),me.current=[])}),le==null||le(he,ie,Ae)},[Te,le]);return P.createElement(p.Provider,{value:te},Ce)}function L(Ee){var Ce=Ee.children,Te=Ee.disabled,we=P.useRef(null),me=P.useRef(null),le=P.useContext(p),te=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=P.isValidElement(Ce)&&Object(v.c)(Ce),ie=he?Ce.ref:null,Ae=P.useMemo(function(){return Object(v.a)(ie,we)},[ie,we]),Re=P.useRef(Ee);Re.current=Ee;var ye=P.useCallback(function(Oe){var Me=Re.current,Ie=Me.onResize,je=Me.data,Be=Oe.getBoundingClientRect(),Ne=Be.width,rt=Be.height,qe=Oe.offsetWidth,Ye=Oe.offsetHeight,$e=Math.floor(Ne),ht=Math.floor(rt);if(te.current.width!==$e||te.current.height!==ht||te.current.offsetWidth!==qe||te.current.offsetHeight!==Ye){var Qe={width:$e,height:ht,offsetWidth:qe,offsetHeight:Ye};te.current=Qe;var nt=qe===Math.round(Ne)?Ne:qe,Pe=Ye===Math.round(rt)?rt:Ye,ct=Object(z.a)(Object(z.a)({},Qe),{},{offsetWidth:nt,offsetHeight:Pe});le==null||le(ct,Oe,je),Ie&&Promise.resolve().then(function(){Ie(ct,Oe)})}},[]);return P.useEffect(function(){var Oe=Object(A.a)(we.current)||Object(A.a)(me.current);return Oe&&!Te&&l(Oe,ye),function(){return d(Oe,ye)}},[we.current,Te]),P.createElement(C,{ref:me},he?P.cloneElement(Ce,{ref:Ae}):Ce)}var b="rc-observer-key";function m(Ee){var Ce=Ee.children,Te=Object(I.a)(Ce);return Te.map(function(we,me){var le=(we==null?void 0:we.key)||"".concat(b,"-").concat(me);return P.createElement(L,Object(ue.a)({},Ee,{key:le}),we)})}m.Collection=f;var c=m,u=ae("bT9E"),a=ae("TSYQ"),x=ae.n(a),y=`
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
`,E=["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"],N={},U;function K(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(Ce&&N[Te])return N[Te];var we=window.getComputedStyle(Ee),me=we.getPropertyValue("box-sizing")||we.getPropertyValue("-moz-box-sizing")||we.getPropertyValue("-webkit-box-sizing"),le=parseFloat(we.getPropertyValue("padding-bottom"))+parseFloat(we.getPropertyValue("padding-top")),te=parseFloat(we.getPropertyValue("border-bottom-width"))+parseFloat(we.getPropertyValue("border-top-width")),he=E.map(function(Ae){return"".concat(Ae,":").concat(we.getPropertyValue(Ae))}).join(";"),ie={sizingStyle:he,paddingSize:le,borderSize:te,boxSizing:me};return Ce&&Te&&(N[Te]=ie),ie}function V(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,we=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)),Ee.getAttribute("wrap")?U.setAttribute("wrap",Ee.getAttribute("wrap")):U.removeAttribute("wrap");var me=K(Ee,Ce),le=me.paddingSize,te=me.borderSize,he=me.boxSizing,ie=me.sizingStyle;U.setAttribute("style","".concat(ie,";").concat(y)),U.value=Ee.value||Ee.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,Oe;if(he==="border-box"?ye+=te:he==="content-box"&&(ye-=le),Te!==null||we!==null){U.value=" ";var Me=U.scrollHeight-le;Te!==null&&(Ae=Me*Te,he==="border-box"&&(Ae=Ae+le+te),ye=Math.max(Ae,ye)),we!==null&&(Re=Me*we,he==="border-box"&&(Re=Re+le+te),Oe=ye>Re?"":"hidden",ye=Math.min(Re,ye))}return{height:ye,minHeight:Ae,maxHeight:Re,overflowY:Oe,resize:"none"}}var R=ae("Gytx"),M=ae.n(R),$;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})($||($={}));var ee=function(Ee){Object(Z.a)(Te,Ee);var Ce=Object(B.a)(Te);function Te(we){var me;return Object(Q.a)(this,Te),me=Ce.call(this,we),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(le){me.textArea=le},me.handleResize=function(le){var te=me.state.resizeStatus,he=me.props,ie=he.autoSize,Ae=he.onResize;if(te!==$.NONE)return;typeof Ae=="function"&&Ae(le),ie&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var le=me.props.autoSize;if(!le||!me.textArea)return;var te=le.minRows,he=le.maxRows,ie=V(me.textArea,!1,te,he);me.setState({textareaStyles:ie,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var le=me.props,te=le.prefixCls,he=te===void 0?"rc-textarea":te,ie=le.autoSize,Ae=le.onResize,Re=le.className,ye=le.disabled,Oe=me.state,Me=Oe.textareaStyles,Ie=Oe.resizeStatus,je=Object(u.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=x()(he,Re,Object(j.a)({},"".concat(he,"-disabled"),ye));"value"in je&&(je.value=je.value||"");var Ne=Object(z.a)(Object(z.a)(Object(z.a)({},me.props.style),Me),Ie===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:me.handleResize,disabled:!(ie||Ae)},P.createElement("textarea",Object(ue.a)({},je,{className:Be,style:Ne,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(D.a)(Te,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!M()(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,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,le)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(P.Component),oe=ee,ce=function(Ee){Object(Z.a)(Te,Ee);var Ce=Object(B.a)(Te);function Te(we){var me;Object(Q.a)(this,Te),me=Ce.call(this,we),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(te){me.resizableTextArea=te},me.handleChange=function(te){var he=me.props.onChange;me.setValue(te.target.value,function(){me.resizableTextArea.resizeTextarea()}),he&&he(te)},me.handleKeyDown=function(te){var he=me.props,ie=he.onPressEnter,Ae=he.onKeyDown;te.keyCode===13&&ie&&ie(te),Ae&&Ae(te)};var le=typeof we.value=="undefined"||we.value===null?we.defaultValue:we.value;return me.state={value:le},me}return Object(D.a)(Te,[{key:"setValue",value:function(me,le){"value"in this.props||this.setState({value:me},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(oe,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Te}(P.Component),De=Je.default=ce},ZW9T:function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return C});var ue=ae("k1fw"),Q=ae("miYZ"),D=ae("tsqr"),Z=ae("rAM+"),B=ae("tJVT"),P=ae("PpiC"),z=ae("q1tI"),j=ae.n(z),I=ae("bdgK");function k(p,f,L,b,m){var c=f.getWordUntilPosition(L),u={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=b.map(function(x){return{label:x,kind:p.languages.CompletionItemKind.Keyword,insertText:x,insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return m.map(function(x){a.push(Object(ue.a)(Object(ue.a)({},x),{},{range:u}))}),a}var v=function(p){var f={label:"ifelse",kind:p.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];p.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,a){var x=k(p,u,a,L,[f]);return{suggestions:x}}});var b=["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"];p.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,a){var x=[{label:"print",kind:p.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=k(p,u,a,b,x);return{suggestions:y}}});var m=["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"];p.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,a){var x=[f,{label:"main",kind:p.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:p.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=k(p,u,a,m,x);return{suggestions:y}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=ae("LvDl");function _(p){return/^\d+$/.test(p)?"".concat(p,"px"):p}function S(){}var T=!1,h={"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 o(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],f=p;if(Array.isArray(p)){for(var L=0;L<p.length;L++){var b=h[p[L]];if(b)return b}return f[0]}return h[f]||f}var l=null,d=Je.b=function(p){var f=p.width,L=f===void 0?"100%":f,b=p.height,m=b===void 0?"100%":b,c=p.value,u=p.language,a=u===void 0?"javascript":u,x=p.style,y=x===void 0?{}:x,E=p.options,N=E===void 0?{}:E,U=p.overrideServices,K=U===void 0?{}:U,V=p.theme,R=V===void 0?"vs-dark":V,M=p.onEditBlur,$=p.onSave,ee=p.autoHeight,oe=ee===void 0?!1:ee,ce=p.forbidCopy,De=ce===void 0?!1:ce,Ee=p.onChange,Ce=Ee===void 0?S:Ee,Te=p.editorDidMount,we=Te===void 0?S:Te,me=p.onFocus,le=me===void 0?S:me,te=p.filename,he=te===void 0?"educoder.txt":te,ie=Object(P.a)(p,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ae=Object(z.useRef)(),Re=Object(z.useRef)({}),ye=Object(z.useRef)(),Oe=Object(z.useRef)(!1),Me=Object(z.useRef)(),Ie=Object(z.useState)(!1),je=Object(B.a)(Ie,2),Be=je[0],Ne=je[1];function rt(){var se;return Ae.current&&(se=new I.default(function(de){var Le=Object(Z.a)(de),Se;try{for(Le.s();!(Se=Le.n()).done;){var We=Se.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(it){Le.e(it)}finally{Le.f()}}),se.observe(Ae.current)),se}function qe(){D.b.warn(decodeURIComponent(A))}var Ye=function(){var de=Re.current.instance;if(c!=null&&de&&Be){var Le=de.getModel();Le&&c!==Le.getValue()&&(T=!0,Le.setValue(c),de.layout(),T=!1)}};Object(z.useEffect)(function(){ye.current&&clearTimeout(ye.current),ye.current=setTimeout(function(){Ye()},500)},[c,Be,Re.current]);function $e(){var se=Re.current.instance;if(se){var de=se.getSelection(),Le=Re.current.pastePos||{},Se=new l.Range(Le.startLineNumber||de.endLineNumber,Le.startColumn||de.endColumn,Le.endLineNumber||de.endLineNumber,Le.endColumn||de.endColumn);setTimeout(function(){se.executeEdits("",[{range:Se,text:""}])},300)}}function ht(se){(window.navigator.platform.match("Mac")?se.metaKey:se.ctrlKey)&&se.keyCode==83&&(se.preventDefault(),$())}var Qe=function(){if(oe&&Re.current.instance){var de=Re.current.instance.getContentHeight();re(de<m?m:de)}else re(m)};function nt(se){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),se.dispatchEvent(de)}function Pe(se,de){var Le=window.URL||window.webkitURL||window,Se=new Blob([de]),We=document.createElementNS("http://www.w3.org/1999/xhtml","a");We.href=Le.createObjectURL(Se),We.download=se,nt(We)}Object(z.useEffect)(function(){Qe()},[Qe]),Object(z.useEffect)(function(){Ae.current&&!Be&&ae.e(27).then(ae.t.bind(null,"M/lh",7)).then(function(se){try{l=se,Re.current.instance=l.editor.create(Ae.current,{value:c,language:o(a),theme:R,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},K);var de=Re.current.instance;if(we(de,l),setTimeout(function(){Qe(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Pe(he||"educoder.txt",de.getValue())}})},500),Re.current.subscription=de.onDidChangeModelContent(function(Se){Oe.current?clearTimeout(Me.current):(Qe(),Ce(de.getValue(),Se)),Me.current=setTimeout(function(){Oe.current=!1},500)}),window.Monaco||v(l),De&&(de.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return qe(),null}),de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return qe(),null})),window.Monaco=l,M&&de.onDidBlurEditorWidget(function(){M(de.getValue())}),le&&de.onDidFocusEditorText(function(){le(de.getValue())}),De){de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return qe(),null}),de.onDidPaste(function(Se){Re.current.pastePos=Se});try{window.addEventListener("paste",$e)}catch(Se){}}var Le=rt();return Ne(!0),function(){var Se=Re.current.instance;Se.dispose();var We=Se.getModel();We&&We.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),De&&window.removeEventListener("paste",$e),Le.unobserve(Ae.current)}}catch(Se){}})},[]),Object(z.useEffect)(function(){var se=Re.current.instance;if(se&&Be)return document.addEventListener("keydown",ht,!1),function(){document.removeEventListener("keydown",ht)}},[$,Be]),Object(z.useEffect)(function(){var se=Re.current.instance;if(se&&Be){var de=o(a);l.editor.setModelLanguage(se.getModel(),de),console.log("language:",a,se.getModel(),de)}},[a,Be]),Object(z.useEffect)(function(){var se=Re.current.instance;se&&Be&&l.editor.setTheme(R)},[R,Be]),Object(z.useEffect)(function(){var se=Re.current.instance;se&&Be&&(se.updateOptions(Object(ue.a)({},N)),setTimeout(function(){se.getModel().updateOptions(Object(ue.a)({},N))},200))},[JSON.stringify(N),Be]),Object(z.useEffect)(function(){var se=Re.current.instance;se&&Be&&se.layout()},[L,m,Be]);var ct=Object(z.useState)(_(L)),at=Object(B.a)(ct,2),Ue=at[0],Ke=at[1],xe=Object(z.useState)(_(m)),ge=Object(B.a)(xe,2),be=ge[0],re=ge[1],ne=Object(ue.a)(Object(ue.a)({},y),{},{width:Ue,height:be});return j.a.createElement("div",{className:"my-monaco-editor",ref:Ae,style:ne})};function C(p){var f=p.width,L=f===void 0?"100%":f,b=p.height,m=b===void 0?"100%":b,c=p.original,u=p.modified,a=p.language,x=p.options,y=x===void 0?{}:x,E=Object(z.useRef)(),N=Object(z.useState)(null),U=Object(B.a)(N,2),K=U[0],V=U[1];function R(oe){var ce;return E.current&&(ce=new I.default(function(De){var Ee=Object(Z.a)(De),Ce;try{for(Ee.s();!(Ce=Ee.n()).done;){var Te=Ce.value;(Te.target.offsetHeight>0||Te.target.offsetWidth>0)&&oe.layout()}}catch(we){Ee.e(we)}finally{Ee.f()}}),ce.observe(E.current)),ce}Object(z.useEffect)(function(){E.current&&ae.e(27).then(ae.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var ce=l.editor.createDiffEditor(E.current,Object(ue.a)(Object(ue.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},y),{},{wordWrap:!0}));V(ce);var De=R(ce);return function(){ce.dispose();var Ee=ce.getModel();Ee&&Ee.dispose(),De.unobserve(E.current)}})},[]),Object(z.useEffect)(function(){K&&K.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(u,a)})},[c,u,a,K]);var M=_(L),$=_(m),ee={width:M,height:$};return j.a.createElement("div",{className:"my-diff-editor",ref:E,style:ee})}},ZpRC:function(bt,Je,ae){"use strict";function ue(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function Q(v,A){return(!A||v!=="hidden")&&v!=="visible"&&v!=="clip"}function D(v,A){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var O=getComputedStyle(v,null);return Q(O.overflowY,A)||Q(O.overflowX,A)||function(_){var S=function(T){if(!T.ownerDocument||!T.ownerDocument.defaultView)return null;try{return T.ownerDocument.defaultView.frameElement}catch(h){return null}}(_);return!!S&&(S.clientHeight<_.scrollHeight||S.clientWidth<_.scrollWidth)}(v)}return!1}function Z(v,A,O,_,S,T,h,o){return T<v&&h>A||T>v&&h<A?0:T<=v&&o<=O||h>=A&&o>=O?T-v-_:h>A&&o<O||T<v&&o>O?h-A+S:0}var B=function(v,A){var O=window,_=A.scrollMode,S=A.block,T=A.inline,h=A.boundary,o=A.skipOverflowHiddenElements,l=typeof h=="function"?h:function(Me){return Me!==h};if(!ue(v))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,C=[],p=v;ue(p)&&l(p);){if((p=p.parentElement)===d){C.push(p);break}p!=null&&p===document.body&&D(p)&&!D(document.documentElement)||p!=null&&D(p,o)&&C.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,L=O.visualViewport?O.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,c=v.getBoundingClientRect(),u=c.height,a=c.width,x=c.top,y=c.right,E=c.bottom,N=c.left,U=S==="start"||S==="nearest"?x:S==="end"?E:x+u/2,K=T==="center"?N+a/2:T==="end"?y:N,V=[],R=0;R<C.length;R++){var M=C[R],$=M.getBoundingClientRect(),ee=$.height,oe=$.width,ce=$.top,De=$.right,Ee=$.bottom,Ce=$.left;if(_==="if-needed"&&x>=0&&N>=0&&E<=L&&y<=f&&x>=ce&&E<=Ee&&N>=Ce&&y<=De)return V;var Te=getComputedStyle(M),we=parseInt(Te.borderLeftWidth,10),me=parseInt(Te.borderTopWidth,10),le=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),he=0,ie=0,Ae="offsetWidth"in M?M.offsetWidth-M.clientWidth-we-le:0,Re="offsetHeight"in M?M.offsetHeight-M.clientHeight-me-te:0;if(d===M)he=S==="start"?U:S==="end"?U-L:S==="nearest"?Z(m,m+L,L,me,te,m+U,m+U+u,u):U-L/2,ie=T==="start"?K:T==="center"?K-f/2:T==="end"?K-f:Z(b,b+f,f,we,le,b+K,b+K+a,a),he=Math.max(0,he+m),ie=Math.max(0,ie+b);else{he=S==="start"?U-ce-me:S==="end"?U-Ee+te+Re:S==="nearest"?Z(ce,Ee,ee,me,te+Re,U,U+u,u):U-(ce+ee/2)+Re/2,ie=T==="start"?K-Ce-we:T==="center"?K-(Ce+oe/2)+Ae/2:T==="end"?K-De+le+Ae:Z(Ce,De,oe,we,le+Ae,K,K+a,a);var ye=M.scrollLeft,Oe=M.scrollTop;U+=Oe-(he=Math.max(0,Math.min(Oe+he,M.scrollHeight-ee+Re))),K+=ye-(ie=Math.max(0,Math.min(ye+ie,M.scrollWidth-oe+Ae)))}V.push({el:M,top:he,left:ie})}return V};function P(v){return v===Object(v)&&Object.keys(v).length!==0}function z(v,A){A===void 0&&(A="auto");var O="scrollBehavior"in document.body.style;v.forEach(function(_){var S=_.el,T=_.top,h=_.left;S.scroll&&O?S.scroll({top:T,left:h,behavior:A}):(S.scrollTop=T,S.scrollLeft=h)})}function j(v){return v===!1?{block:"end",inline:"nearest"}:P(v)?v:{block:"start",inline:"nearest"}}function I(v,A){var O=!v.ownerDocument.documentElement.contains(v);if(P(A)&&typeof A.behavior=="function")return A.behavior(O?[]:B(v,A));if(O)return;var _=j(A);return z(B(v,_),_.behavior)}var k=Je.a=I},Zss7:function(bt,Je,ae){var ue;(function(Q){var D=/^\s+/,Z=/\s+$/,B=0,P=Q.round,z=Q.min,j=Q.max,I=Q.random;function k(te,he){if(te=te||"",he=he||{},te instanceof k)return te;if(!(this instanceof k))return new k(te,he);var ie=v(te);this._originalInput=te,this._r=ie.r,this._g=ie.g,this._b=ie.b,this._a=ie.a,this._roundA=P(100*this._a)/100,this._format=he.format||ie.format,this._gradientType=he.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ie.ok,this._tc_id=B++}k.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(),he,ie,Ae,Re,ye,Oe;return he=te.r/255,ie=te.g/255,Ae=te.b/255,he<=.03928?Re=he/12.92:Re=Q.pow((he+.055)/1.055,2.4),ie<=.03928?ye=ie/12.92:ye=Q.pow((ie+.055)/1.055,2.4),Ae<=.03928?Oe=Ae/12.92:Oe=Q.pow((Ae+.055)/1.055,2.4),.2126*Re+.7152*ye+.0722*Oe},setAlpha:function(te){return this._a=V(te),this._roundA=P(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),he=P(te.h*360),ie=P(te.s*100),Ae=P(te.v*100);return this._a==1?"hsv("+he+", "+ie+"%, "+Ae+"%)":"hsva("+he+", "+ie+"%, "+Ae+"%, "+this._roundA+")"},toHsl:function(){var te=O(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=O(this._r,this._g,this._b),he=P(te.h*360),ie=P(te.s*100),Ae=P(te.l*100);return this._a==1?"hsl("+he+", "+ie+"%, "+Ae+"%)":"hsla("+he+", "+ie+"%, "+Ae+"%, "+this._roundA+")"},toHex:function(te){return h(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(R(this._r,255)*100)+"%",g:P(R(this._g,255)*100)+"%",b:P(R(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(R(this._r,255)*100)+"%, "+P(R(this._g,255)*100)+"%, "+P(R(this._b,255)*100)+"%)":"rgba("+P(R(this._r,255)*100)+"%, "+P(R(this._g,255)*100)+"%, "+P(R(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var he="#"+l(this._r,this._g,this._b,this._a),ie=he,Ae=this._gradientType?"GradientType = 1, ":"";if(te){var Re=k(te);ie="#"+l(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ae+"startColorstr="+he+",endColorstr="+ie+")"},toString:function(te){var he=!!te;te=te||this._format;var ie=!1,Ae=this._a<1&&this._a>=0,Re=!he&&Ae&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ie=this.toRgbString()),te==="prgb"&&(ie=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ie=this.toHexString()),te==="hex3"&&(ie=this.toHexString(!0)),te==="hex4"&&(ie=this.toHex8String(!0)),te==="hex8"&&(ie=this.toHex8String()),te==="name"&&(ie=this.toName()),te==="hsl"&&(ie=this.toHslString()),te==="hsv"&&(ie=this.toHsvString()),ie||this.toHexString())},clone:function(){return k(this.toString())},_applyModification:function(te,he){var ie=te.apply(null,[this].concat([].slice.call(he)));return this._r=ie._r,this._g=ie._g,this._b=ie._b,this.setAlpha(ie._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(te,he){return te.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},k.fromRatio=function(te,he){if(typeof te=="object"){var ie={};for(var Ae in te)te.hasOwnProperty(Ae)&&(Ae==="a"?ie[Ae]=te[Ae]:ie[Ae]=De(te[Ae]));te=ie}return k(te,he)};function v(te){var he={r:0,g:0,b:0},ie=1,Ae=null,Re=null,ye=null,Oe=!1,Me=!1;return typeof te=="string"&&(te=me(te)),typeof te=="object"&&(we(te.r)&&we(te.g)&&we(te.b)?(he=A(te.r,te.g,te.b),Oe=!0,Me=String(te.r).substr(-1)==="%"?"prgb":"rgb"):we(te.h)&&we(te.s)&&we(te.v)?(Ae=De(te.s),Re=De(te.v),he=T(te.h,Ae,Re),Oe=!0,Me="hsv"):we(te.h)&&we(te.s)&&we(te.l)&&(Ae=De(te.s),ye=De(te.l),he=_(te.h,Ae,ye),Oe=!0,Me="hsl"),te.hasOwnProperty("a")&&(ie=te.a)),ie=V(ie),{ok:Oe,format:te.format||Me,r:z(255,j(he.r,0)),g:z(255,j(he.g,0)),b:z(255,j(he.b,0)),a:ie}}function A(te,he,ie){return{r:R(te,255)*255,g:R(he,255)*255,b:R(ie,255)*255}}function O(te,he,ie){te=R(te,255),he=R(he,255),ie=R(ie,255);var Ae=j(te,he,ie),Re=z(te,he,ie),ye,Oe,Me=(Ae+Re)/2;if(Ae==Re)ye=Oe=0;else{var Ie=Ae-Re;Oe=Me>.5?Ie/(2-Ae-Re):Ie/(Ae+Re);switch(Ae){case te:ye=(he-ie)/Ie+(he<ie?6:0);break;case he:ye=(ie-te)/Ie+2;break;case ie:ye=(te-he)/Ie+4;break}ye/=6}return{h:ye,s:Oe,l:Me}}function _(te,he,ie){var Ae,Re,ye;te=R(te,360),he=R(he,100),ie=R(ie,100);function Oe(je,Be,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?je+(Be-je)*6*Ne:Ne<1/2?Be:Ne<2/3?je+(Be-je)*(2/3-Ne)*6:je}if(he===0)Ae=Re=ye=ie;else{var Me=ie<.5?ie*(1+he):ie+he-ie*he,Ie=2*ie-Me;Ae=Oe(Ie,Me,te+1/3),Re=Oe(Ie,Me,te),ye=Oe(Ie,Me,te-1/3)}return{r:Ae*255,g:Re*255,b:ye*255}}function S(te,he,ie){te=R(te,255),he=R(he,255),ie=R(ie,255);var Ae=j(te,he,ie),Re=z(te,he,ie),ye,Oe,Me=Ae,Ie=Ae-Re;if(Oe=Ae===0?0:Ie/Ae,Ae==Re)ye=0;else{switch(Ae){case te:ye=(he-ie)/Ie+(he<ie?6:0);break;case he:ye=(ie-te)/Ie+2;break;case ie:ye=(te-he)/Ie+4;break}ye/=6}return{h:ye,s:Oe,v:Me}}function T(te,he,ie){te=R(te,360)*6,he=R(he,100),ie=R(ie,100);var Ae=Q.floor(te),Re=te-Ae,ye=ie*(1-he),Oe=ie*(1-Re*he),Me=ie*(1-(1-Re)*he),Ie=Ae%6,je=[ie,Oe,ye,ye,Me,ie][Ie],Be=[Me,ie,ie,Oe,ye,ye][Ie],Ne=[ye,ye,Me,ie,ie,Oe][Ie];return{r:je*255,g:Be*255,b:Ne*255}}function h(te,he,ie,Ae){var Re=[ce(P(te).toString(16)),ce(P(he).toString(16)),ce(P(ie).toString(16))];return Ae&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function o(te,he,ie,Ae,Re){var ye=[ce(P(te).toString(16)),ce(P(he).toString(16)),ce(P(ie).toString(16)),ce(Ee(Ae))];return Re&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l(te,he,ie,Ae){var Re=[ce(Ee(Ae)),ce(P(te).toString(16)),ce(P(he).toString(16)),ce(P(ie).toString(16))];return Re.join("")}k.equals=function(te,he){return!te||!he?!1:k(te).toRgbString()==k(he).toRgbString()},k.random=function(){return k.fromRatio({r:I(),g:I(),b:I()})};function d(te,he){he=he===0?0:he||10;var ie=k(te).toHsl();return ie.s-=he/100,ie.s=M(ie.s),k(ie)}function C(te,he){he=he===0?0:he||10;var ie=k(te).toHsl();return ie.s+=he/100,ie.s=M(ie.s),k(ie)}function p(te){return k(te).desaturate(100)}function f(te,he){he=he===0?0:he||10;var ie=k(te).toHsl();return ie.l+=he/100,ie.l=M(ie.l),k(ie)}function L(te,he){he=he===0?0:he||10;var ie=k(te).toRgb();return ie.r=j(0,z(255,ie.r-P(255*-(he/100)))),ie.g=j(0,z(255,ie.g-P(255*-(he/100)))),ie.b=j(0,z(255,ie.b-P(255*-(he/100)))),k(ie)}function b(te,he){he=he===0?0:he||10;var ie=k(te).toHsl();return ie.l-=he/100,ie.l=M(ie.l),k(ie)}function m(te,he){var ie=k(te).toHsl(),Ae=(ie.h+he)%360;return ie.h=Ae<0?360+Ae:Ae,k(ie)}function c(te){var he=k(te).toHsl();return he.h=(he.h+180)%360,k(he)}function u(te){var he=k(te).toHsl(),ie=he.h;return[k(te),k({h:(ie+120)%360,s:he.s,l:he.l}),k({h:(ie+240)%360,s:he.s,l:he.l})]}function a(te){var he=k(te).toHsl(),ie=he.h;return[k(te),k({h:(ie+90)%360,s:he.s,l:he.l}),k({h:(ie+180)%360,s:he.s,l:he.l}),k({h:(ie+270)%360,s:he.s,l:he.l})]}function x(te){var he=k(te).toHsl(),ie=he.h;return[k(te),k({h:(ie+72)%360,s:he.s,l:he.l}),k({h:(ie+216)%360,s:he.s,l:he.l})]}function y(te,he,ie){he=he||6,ie=ie||30;var Ae=k(te).toHsl(),Re=360/ie,ye=[k(te)];for(Ae.h=(Ae.h-(Re*he>>1)+720)%360;--he;)Ae.h=(Ae.h+Re)%360,ye.push(k(Ae));return ye}function E(te,he){he=he||6;for(var ie=k(te).toHsv(),Ae=ie.h,Re=ie.s,ye=ie.v,Oe=[],Me=1/he;he--;)Oe.push(k({h:Ae,s:Re,v:ye})),ye=(ye+Me)%1;return Oe}k.mix=function(te,he,ie){ie=ie===0?0:ie||50;var Ae=k(te).toRgb(),Re=k(he).toRgb(),ye=ie/100,Oe={r:(Re.r-Ae.r)*ye+Ae.r,g:(Re.g-Ae.g)*ye+Ae.g,b:(Re.b-Ae.b)*ye+Ae.b,a:(Re.a-Ae.a)*ye+Ae.a};return k(Oe)},k.readability=function(te,he){var ie=k(te),Ae=k(he);return(Q.max(ie.getLuminance(),Ae.getLuminance())+.05)/(Q.min(ie.getLuminance(),Ae.getLuminance())+.05)},k.isReadable=function(te,he,ie){var Ae=k.readability(te,he),Re,ye;ye=!1,Re=le(ie);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":ye=Ae>=4.5;break;case"AAlarge":ye=Ae>=3;break;case"AAAsmall":ye=Ae>=7;break}return ye},k.mostReadable=function(te,he,ie){var Ae=null,Re=0,ye,Oe,Me,Ie;ie=ie||{},Oe=ie.includeFallbackColors,Me=ie.level,Ie=ie.size;for(var je=0;je<he.length;je++)ye=k.readability(te,he[je]),ye>Re&&(Re=ye,Ae=k(he[je]));return k.isReadable(te,Ae,{level:Me,size:Ie})||!Oe?Ae:(ie.includeFallbackColors=!1,k.mostReadable(te,["#fff","#000"],ie))};var N=k.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=k.hexNames=K(N);function K(te){var he={};for(var ie in te)te.hasOwnProperty(ie)&&(he[te[ie]]=ie);return he}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function R(te,he){ee(te)&&(te="100%");var ie=oe(te);return te=z(he,j(0,parseFloat(te))),ie&&(te=parseInt(te*he,10)/100),Q.abs(te-he)<1e-6?1:te%he/parseFloat(he)}function M(te){return z(1,j(0,te))}function $(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function ce(te){return te.length==1?"0"+te:""+te}function De(te){return te<=1&&(te=te*100+"%"),te}function Ee(te){return Q.round(parseFloat(te)*255).toString(16)}function Ce(te){return $(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ie="(?:"+he+")|(?:"+te+")",Ae="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?",Re="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?";return{CSS_UNIT:new RegExp(ie),rgb:new RegExp("rgb"+Ae),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+Ae),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+Ae),hsva:new RegExp("hsva"+Re),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 we(te){return!!Te.CSS_UNIT.exec(te)}function me(te){te=te.replace(D,"").replace(Z,"").toLowerCase();var he=!1;if(N[te])te=N[te],he=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ie;return(ie=Te.rgb.exec(te))?{r:ie[1],g:ie[2],b:ie[3]}:(ie=Te.rgba.exec(te))?{r:ie[1],g:ie[2],b:ie[3],a:ie[4]}:(ie=Te.hsl.exec(te))?{h:ie[1],s:ie[2],l:ie[3]}:(ie=Te.hsla.exec(te))?{h:ie[1],s:ie[2],l:ie[3],a:ie[4]}:(ie=Te.hsv.exec(te))?{h:ie[1],s:ie[2],v:ie[3]}:(ie=Te.hsva.exec(te))?{h:ie[1],s:ie[2],v:ie[3],a:ie[4]}:(ie=Te.hex8.exec(te))?{r:$(ie[1]),g:$(ie[2]),b:$(ie[3]),a:Ce(ie[4]),format:he?"name":"hex8"}:(ie=Te.hex6.exec(te))?{r:$(ie[1]),g:$(ie[2]),b:$(ie[3]),format:he?"name":"hex"}:(ie=Te.hex4.exec(te))?{r:$(ie[1]+""+ie[1]),g:$(ie[2]+""+ie[2]),b:$(ie[3]+""+ie[3]),a:Ce(ie[4]+""+ie[4]),format:he?"name":"hex8"}:(ie=Te.hex3.exec(te))?{r:$(ie[1]+""+ie[1]),g:$(ie[2]+""+ie[2]),b:$(ie[3]+""+ie[3]),format:he?"name":"hex"}:!1}function le(te){var he,ie;return te=te||{level:"AA",size:"small"},he=(te.level||"AA").toUpperCase(),ie=(te.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ie!=="small"&&ie!=="large"&&(ie="small"),{level:he,size:ie}}bt.exports?bt.exports=k:!(ue=function(){return k}.call(Je,ae,Je,bt),ue!==void 0&&(bt.exports=ue))})(Math)},bT9E:function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return Q});var ue=ae("VTBJ");function Q(D,Z){var B=Object(ue.a)({},D);return Array.isArray(Z)&&Z.forEach(function(P){delete B[P]}),B}},c5Ni:function(bt,Je,ae){},dejd:function(bt,Je,ae){},dmUQ:function(bt,Je,ae){"use strict";var ue=ae("Ff2n"),Q=ae("rePB"),D=ae("1OyB"),Z=ae("vuIU"),B=ae("Ji7U"),P=ae("md7G"),z=ae("foSv"),j=ae("q1tI"),I=ae.n(j),k=ae("TSYQ"),v=ae.n(k),A=ae("4IlW");function O(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);a&&(y=y.filter(function(E){return Object.getOwnPropertyDescriptor(u,E).enumerable})),x.push.apply(x,y)}return x}function _(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?O(Object(x),!0).forEach(function(y){Object(Q.a)(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):O(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function S(u){var a=T();return function(){var y=Object(z.a)(u),E;if(a){var N=Object(z.a)(this).constructor;E=Reflect.construct(y,arguments,N)}else E=y.apply(this,arguments);return Object(P.a)(this,E)}}function T(){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(u){return!1}}function h(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,C=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},L=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},b=function(u){Object(B.a)(x,u);var a=S(x);function x(y){var E;Object(D.a)(this,x),E=a.call(this,y),E.onKeyDown=function(K){var V=E.props,R=V.onKeyDown,M=V.onPressEnter;if(K.keyCode===A.a.UP){var $=E.getRatio(K);E.up(K,$,null),E.stop()}else if(K.keyCode===A.a.DOWN){var ee=E.getRatio(K);E.down(K,ee,null),E.stop()}else K.keyCode===A.a.ENTER&&M&&M(K);if(E.recordCursorPosition(),E.lastKeyCode=K.keyCode,R){for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];R.apply(void 0,[K].concat(ce))}},E.onKeyUp=function(K){var V=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),V){for(var R=arguments.length,M=new Array(R>1?R-1:0),$=1;$<R;$++)M[$-1]=arguments[$];V.apply(void 0,[K].concat(M))}},E.onChange=function(K){var V=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(K)),E.setState({inputValue:E.rawInput}),V(E.toNumber(E.rawInput))},E.onMouseUp=function(){var K=E.props.onMouseUp;E.recordCursorPosition(),K&&K.apply(void 0,arguments)},E.onFocus=function(){var K;E.setState({focused:!0}),(K=E.props).onFocus.apply(K,arguments)},E.onBlur=function(){var K=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var V=E.getCurrentValidValue(E.state.inputValue),R=E.setValue(V,h);if(K){var M=E.input.value,$=E.getInputDisplayValue({focus:!1,value:R});E.input.value=$&&Number($),K.apply(void 0,arguments),E.input.value=M}},E.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},E.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},E.getPrecision=function(K){if(f(E.props.precision))return E.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var R=0;return V.indexOf(".")>=0&&(R=V.length-V.indexOf(".")-1),R},E.getInputDisplayValue=function(K){var V=K||E.state,R=V.focused,M=V.inputValue,$=V.value,ee;R?ee=M:ee=E.toPrecisionAsStep($),ee==null&&(ee="");var oe=E.formatWrapper(ee);return f(E.props.decimalSeparator)&&(oe=oe.toString().replace(".",E.props.decimalSeparator)),oe},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(K){}},E.restoreByAfter=function(K){if(K===void 0)return!1;var V=E.input.value,R=V.lastIndexOf(K);if(R===-1)return!1;var M=E.cursorBefore.length;return E.lastKeyCode===A.a.DELETE&&E.cursorBefore.charAt(M-1)===K[0]?(E.fixCaret(M,M),!0):R+K.length===V.length?(E.fixCaret(R,R),!0):!1},E.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,R){var M=K.substring(R);return E.restoreByAfter(M)})},E.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(K,V,R){E.pressingUpOrDown=!0,E.step("down",K,V,R)},E.up=function(K,V,R){E.pressingUpOrDown=!0,E.step("up",K,V,R)},E.saveInput=function(K){E.input=K};var N=y.value;N===void 0&&(N=y.defaultValue),E.state={focused:y.autoFocus};var U=E.getValidValue(E.toNumber(N));return E.state=_(_({},E.state),{},{inputValue:E.toPrecisionAsStep(U),value:U}),E}return Object(Z.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,U=N.value,K=N.onChange,V=N.max,R=N.min,M=this.state.focused;if(E){if(!L(E.value,U)||!L(E.max,V)||!L(E.min,R)){var $=M?U:this.getValidValue(U),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var oe="value"in this.props?U:this.state.value;"max"in this.props&&E.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&E.min!==R&&typeof oe=="number"&&oe<R&&K&&K(R)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ce=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ce=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ce=this.cursorStart):ce=this.input.value.length,this.fixCaret(ce,ce)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(De){}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(E){var N=E;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(E){var N=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(E){var N=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,K=parseFloat(E);return isNaN(K)?E:(K<N&&(K=N),K>U&&(K=U),K)}},{key:"setValue",value:function(E,N){var U=this.props.precision,K=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),V=this.state.value,R=V===void 0?null:V,M=this.state.inputValue,$=M===void 0?null:M,ee=typeof K=="number"?K.toFixed(U):"".concat(K),oe=K!==R||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},N)):this.setState({value:K,inputValue:this.toPrecisionAsStep(E)},N),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,K=U.precision,V=U.step;if(f(K))return K;var R=this.getPrecision(N),M=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,R+M):R+M}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(E,N);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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var N=Math.abs(this.getMaxPrecision(E));return isNaN(N)?E.toString():Number(E).toFixed(N)}},{key:"toNumber",value:function(E){var N=this.props.precision,U=this.state.focused,K=E&&E.length>16&&U;return this.isNotCompleteNumber(E)||K?E:f(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),R=((K*E+K*U*N)/K).toFixed(V);return this.toNumber(R)}},{key:"downStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),R=((K*E-K*U*N)/K).toFixed(V);return this.toNumber(R)}},{key:"step",value:function(E,N){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var R=this.props;if(R.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var $=this["".concat(E,"Step")](M,K),ee=$>R.max||$<R.min;if($>R.max?$=R.max:$<R.min&&($=R.min),this.setValue($,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){U[E](N,K,!0)},V?d:C)}},{key:"fixCaret",value:function(E,N){if(E===void 0||N===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,K=this.input.selectionEnd;(E!==U||N!==K)&&this.input.setSelectionRange(E,N)}catch(V){}}},{key:"render",value:function(){var E,N=this.props,U=N.prefixCls,K=N.disabled,V=N.readOnly,R=N.useTouch,M=N.autoComplete,$=N.upHandler,ee=N.downHandler,oe=N.className,ce=N.max,De=N.min,Ee=N.style,Ce=N.title,Te=N.onMouseEnter,we=N.onMouseLeave,me=N.onMouseOver,le=N.onMouseOut,te=N.required,he=N.onClick,ie=N.tabIndex,Ae=N.type,Re=N.placeholder,ye=N.id,Oe=N.inputMode,Me=N.pattern,Ie=N.step,je=N.maxLength,Be=N.autoFocus,Ne=N.name,rt=N.onPaste,qe=N.onInput,Ye=Object(ue.a)(N,["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"]),$e=this.state,ht=$e.value,Qe=$e.focused,nt=v()(U,(E={},Object(Q.a)(E,oe,!!oe),Object(Q.a)(E,"".concat(U,"-disabled"),K),Object(Q.a)(E,"".concat(U,"-focused"),Qe),E)),Pe={};Object.keys(Ye).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(Pe[de]=Ye[de])});var ct=!V&&!K,at=this.getInputDisplayValue(null),Ue=(ht||ht===0)&&(isNaN(ht)||Number(ht)>=ce),Ke=(ht||ht===0)&&(isNaN(ht)||Number(ht)<=De),xe=Ue||K||V,ge=Ke||K||V,be=v()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(Q.a)({},"".concat(U,"-handler-up-disabled"),xe)),re=v()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(Q.a)({},"".concat(U,"-handler-down-disabled"),ge)),ne=R?{onTouchStart:xe?h:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},se=R?{onTouchStart:ge?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ge?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:nt,style:Ee,title:Ce,onMouseEnter:Te,onMouseLeave:we,onMouseOver:me,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(U,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:be}),$||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),I.a.createElement("span",Object.assign({unselectable:"on"},se,{role:"button","aria-label":"Decrease Value","aria-disabled":ge,className:re}),ee||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),I.a.createElement("div",{className:"".concat(U,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":De,"aria-valuemax":ce,"aria-valuenow":ht,required:te,type:Ae,placeholder:Re,onPaste:rt,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ie,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ct?this.onKeyDown:h,onKeyUp:ct?this.onKeyUp:h,autoFocus:Be,maxLength:je,readOnly:V,disabled:K,max:ce,min:De,step:Ie,name:Ne,title:Ce,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Me,inputMode:Oe,onInput:qe},Pe))))}}]),x}(I.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var m=b,c=Je.a=m},gnOq:function(bt,Je,ae){"use strict";ae.r(Je);var ue=ae("+L6B"),Q=ae("2/Rp"),D=ae("5NDa"),Z=ae("5rEg"),B=ae("sPJy"),P=ae("bE4q"),z=ae("k1fw"),j=ae("9og8"),I=ae("y8nQ"),k=ae("Vl3Y"),v=ae("tJVT"),A=ae("WmNS"),O=ae.n(A),_=ae("q1tI"),S=ae.n(_),T=ae("9kvl"),h=ae("55Ip"),o=ae("Ot1p"),l=ae("XYT7"),d=ae("we55"),C=ae.n(d),p=ae("500L"),f=ae("1vsH"),L=function(m){var c,u=m.shixunHomeworks,a=m.newCourse,x=m.globalSetting,y=m.loading,E=m.dispatch,N=m.match,U=k.a.useForm(),K=Object(v.a)(U,1),V=K[0],R=Object(_.useState)({}),M=Object(v.a)(R,2),$=M[0],ee=M[1],oe=Object(_.useState)(),ce=Object(v.a)(oe,2),De=ce[0],Ee=ce[1],Ce=Object(_.useRef)(),Te=u.commonHomeWorkAddDefaultData;Object(_.useEffect)(function(){var le;setTimeout(function(){document.body.scrollIntoView()},300);var te=N.params,he=te.coursesId,ie=te.categoryId;Ce.current=(le=N.params)===null||le===void 0?void 0:le.courseId,Ee(!!Ce.current),Ce.current&&we(),E({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:ie,coursesId:he,type:1}})},[]);var we=function(){var le=Object(j.a)(O.a.mark(function te(){var he;return O.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,E({type:"newCourse/getEditCourseData",payload:{id:Ce.current}});case 2:he=Ae.sent,he&&(V.setFieldsValue({name:he.name}),V.setFieldsValue({intro:he.description}),V.setFieldsValue({notice:he.learning_notes}),ee({name:he.name,intro:he.description,notice:he.learning_notes}));case 4:case"end":return Ae.stop()}},te)}));return function(){return le.apply(this,arguments)}}(),me=function(){var le=Object(j.a)(O.a.mark(function te(he){var ie,Ae,Re,ye,Oe,Me,Ie;return O.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:return ie=Object(z.a)({},$),ie.attachment_ids&&(ie.attachment_ids=ie==null||((Ae=ie.attachment_ids)===null||Ae===void 0)?void 0:Ae.map(function(Ne){return Ne.response.id})),ie.reference_attachment_ids&&(ie.reference_attachment_ids=ie==null||((Re=ie.reference_attachment_ids)===null||Re===void 0)?void 0:Re.map(function(Ne){return Ne.response.id})),ye=N.params,Oe=ye.coursesId,Me=ye.categoryId,Be.next=6,Object(l.a)(Object(z.a)(Object(z.a)({coursesId:Oe,category:Me},ie),{},{base_on_project:!0,type:1}));case 6:Ie=Be.sent,(Ie==null?void 0:Ie.status)===0&&(Object(f.ab)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),T.d.push("/classrooms/".concat(N.params.coursesId,"/common_homework/").concat(Ie.homework_id,"/detail")));case 8:case"end":return Be.stop()}},te)}));return function(he){return le.apply(this,arguments)}}();return S.a.createElement("section",{className:C.a.bg},Te.course_name&&S.a.createElement("section",{className:"animated fadeIn"},S.a.createElement("aside",{className:"mt10"},Te.category&&S.a.createElement(P.a,{separator:">"},S.a.createElement(P.a.Item,null,S.a.createElement(h.a,{to:"/classrooms/".concat(Te.course_id,"/common_homework")},Te.course_name)),S.a.createElement(P.a.Item,null,S.a.createElement(h.a,{to:"/classrooms/".concat(Te.course_id,"/common_homework")},Te.category.category_name)),S.a.createElement(P.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),S.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),S.a.createElement(k.a,{form:V,className:C.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",V.getFieldsValue()),ee(Object(z.a)({},V.getFieldsValue()))},onFinish:me},S.a.createElement("div",{className:C.a.fieldWrap},S.a.createElement(k.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},S.a.createElement(Z.a,{maxLength:60,suffix:"".concat(((c=$.name)===null||c===void 0?void 0:c.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),S.a.createElement("div",{className:C.a.mdWrap},S.a.createElement(k.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},S.a.createElement(o.a,{watch:!0,defaultValue:$.intro})),S.a.createElement("div",null,S.a.createElement(k.a.Item,{name:"attachment_ids"},S.a.createElement(p.b,null)))),S.a.createElement("div",{className:C.a.mdWrap},S.a.createElement(k.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},S.a.createElement(o.a,{watch:!0,defaultValue:$.notice})),S.a.createElement("div",null,S.a.createElement(k.a.Item,{name:"reference_attachment_ids"},S.a.createElement(p.b,null)))),S.a.createElement("div",{className:C.a.backgroundFa},S.a.createElement("div",{className:"pt40 mb30"},S.a.createElement(k.a.Item,null,S.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(C.a.button," mr20"),htmlType:"submit",loading:y["newCourse/editCourse"]||y["newCourse/submitCourse"]},"\u63D0\u4EA4"),S.a.createElement(Q.a,{size:"large",type:"primary",ghost:!0,className:C.a.button,onClick:function(){return T.d.push("/classrooms/".concat(N.params.coursesId,"/common_homework"))}},"\u53D6\u6D88"))))))};Je.default=Object(T.a)(function(b){var m=b.shixunHomeworks,c=b.newCourse,u=b.loading,a=b.globalSetting;return{shixunHomeworks:m,newCourse:c,globalSetting:a,loading:u.effects}})(L)},h78n:function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return E});var ue=ae("q1tI"),Q=ae.n(ue),D=ae("TSYQ"),Z=ae.n(D),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(K){var V=K.map(function(){return Object(ue.useRef)()}),R=Object(ue.useRef)();return Object(ue.useEffect)(function(){var M=Date.now(),$=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;$=!0;var ce=oe.style;ce.transitionDuration=".3s, .3s, .3s, .06s",R.current&&M-R.current<100&&(ce.transitionDuration="0s, 0s")}),$&&(R.current=Date.now())}),[V]};function z(){return z=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var R in V)Object.prototype.hasOwnProperty.call(V,R)&&(U[R]=V[R])}return U},z.apply(this,arguments)}function j(U,K){return O(U)||A(U,K)||k(U,K)||I()}function I(){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 k(U,K){if(!U)return;if(typeof U=="string")return v(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(U,K)}function v(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,R=new Array(K);V<K;V++)R[V]=U[V];return R}function A(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],R=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(R=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);R=!0);}catch(ce){M=!0,$=ce}finally{try{!R&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function O(U){if(Array.isArray(U))return U}function _(U,K){if(U==null)return{};var V=S(U,K),R,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(R=$[M],K.indexOf(R)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,R))continue;V[R]=U[R]}}return V}function S(U,K){if(U==null)return{};var V={},R=Object.keys(U),M,$;for($=0;$<R.length;$++){if(M=R[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var T=function(K){var V=K.className,R=K.percent,M=K.prefixCls,$=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,ce=K.style,De=K.trailColor,Ee=K.trailWidth,Ce=K.transition,Te=_(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var we=Array.isArray(R)?R:[R],me=Array.isArray($)?$:[$],le=P(we),te=j(le,1),he=te[0],ie=oe/2,Ae=100-oe/2,Re="M ".concat(ee==="round"?ie:0,",").concat(ie,`
L `).concat(ee==="round"?Ae:100,",").concat(ie),ye="0 0 100 ".concat(oe),Oe=0;return Q.a.createElement("svg",z({className:Z()("".concat(M,"-line"),V),viewBox:ye,preserveAspectRatio:"none",style:ce},Te),Q.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Re,strokeLinecap:ee,stroke:De,strokeWidth:Ee||oe,fillOpacity:"0"}),we.map(function(Me,Ie){var je={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(Oe,"px"),transition:Ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=me[Ie]||me[me.length-1];return Oe+=Me,Q.a.createElement("path",{key:Ie,className:"".concat(M,"-line-path"),d:Re,strokeLinecap:ee,stroke:Be,strokeWidth:oe,fillOpacity:"0",ref:he[Ie],style:je})}))};T.defaultProps=B;var h=T;function o(){return o=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var R in V)Object.prototype.hasOwnProperty.call(V,R)&&(U[R]=V[R])}return U},o.apply(this,arguments)}function l(U,K){return L(U)||f(U,K)||C(U,K)||d()}function d(){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 C(U,K){if(!U)return;if(typeof U=="string")return p(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return p(U,K)}function p(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,R=new Array(K);V<K;V++)R[V]=U[V];return R}function f(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],R=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(R=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);R=!0);}catch(ce){M=!0,$=ce}finally{try{!R&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function L(U){if(Array.isArray(U))return U}function b(U,K){if(U==null)return{};var V=m(U,K),R,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(R=$[M],K.indexOf(R)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,R))continue;V[R]=U[R]}}return V}function m(U,K){if(U==null)return{};var V={},R=Object.keys(U),M,$;for($=0;$<R.length;$++){if(M=R[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var c=0;function u(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function x(U,K,V,R){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ee=50-R/2,oe=0,ce=-ee,De=0,Ee=-2*ee;switch($){case"left":oe=-ee,ce=0,De=2*ee,Ee=0;break;case"right":oe=ee,ce=0,De=-2*ee,Ee=0;break;case"bottom":ce=ee,Ee=2*ee;break;default:}var Ce="M 50,50 m ".concat(oe,",").concat(ce,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(De,",").concat(-Ee,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-De,",").concat(Ee),Te=Math.PI*2*ee,we={stroke:V,strokeDasharray:"".concat(K/100*(Te-M),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(M/2+U/100*(Te-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ce,pathStyle:we}}var y=function(K){var V=K.prefixCls,R=K.strokeWidth,M=K.trailWidth,$=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,ce=K.strokeLinecap,De=K.style,Ee=K.className,Ce=K.strokeColor,Te=K.percent,we=b(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(ue.useMemo)(function(){return c+=1,c},[]),le=x(0,100,oe,R,$,ee),te=le.pathString,he=le.pathStyle,ie=a(Te),Ae=a(Ce),Re=Ae.find(function(je){return Object.prototype.toString.call(je)==="[object Object]"}),ye=P(ie),Oe=l(ye,1),Me=Oe[0],Ie=function(){var Be=0;return ie.map(function(Ne,rt){var qe=Ae[rt]||Ae[Ae.length-1],Ye=Object.prototype.toString.call(qe)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",$e=x(Be,Ne,qe,R,$,ee);return Be+=Ne,Q.a.createElement("path",{key:rt,className:"".concat(V,"-circle-path"),d:$e.pathString,stroke:Ye,strokeLinecap:ce,strokeWidth:R,opacity:Ne===0?0:1,fillOpacity:"0",style:$e.pathStyle,ref:Me[rt]})})};return Q.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),Ee),viewBox:"0 0 100 100",style:De},we),Re&&Q.a.createElement("defs",null,Q.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(je,Be){return u(je)-u(Be)}).map(function(je,Be){return Q.a.createElement("stop",{key:Be,offset:je,stopColor:Re[je]})}))),Q.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:ce,strokeWidth:M||R,fillOpacity:"0",style:he}),Ie().reverse())};y.defaultProps=B;var E=y,N={Line:h,Circle:E}},kSUc:function(bt,Je,ae){},lZu9:function(bt,Je,ae){(function(ue){ue(ae("VrN/"),ae("1eCo"),ae("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(Q,D){var Z=ue.getMode(Q,"text/html"),B=Z.name=="null";function P(R){if(ue.findModeByName){var M=ue.findModeByName(R);M&&(R=M.mime||M.mimes[0])}var $=ue.getMode(Q,R);return $.name=="null"?null:$}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var z={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 j in z)z.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(z[j]=D.tokenTypeOverrides[j]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,T=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,o=" ";function l(R,M,$){return M.f=M.inline=$,$(R,M)}function d(R,M,$){return M.f=M.block=$,$(R,M)}function C(R){return!R||!/\S/.test(R.string)}function p(R){if(R.linkTitle=!1,R.linkHref=!1,R.linkText=!1,R.em=!1,R.strong=!1,R.strikethrough=!1,R.quote=0,R.indentedCode=!1,R.f==L){var M=B;if(!M){var $=ue.innerMode(Z,R.htmlState);M=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}M&&(R.f=u,R.block=f,R.htmlState=null)}return R.trailingSpace=0,R.trailingSpaceNewLine=!1,R.prevLine=R.thisLine,R.thisLine={stream:null},null}function f(R,M){var $=R.column()===M.indentation,ee=C(M.prevLine.stream),oe=M.indentedCode,ce=M.prevLine.hr,De=M.list!==!1,Ee=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var Ce=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,De)){for(M.list=null;Ce<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=Ce-M.listStack[M.listStack.length-1])}var Te=!ee&&!ce&&!M.prevLine.header&&(!De||!oe)&&!M.prevLine.fencedCodeEnd,we=(M.list===!1||ce||ee)&&M.indentation<=Ee&&R.match(I),me=null;if(M.indentationDiff>=4&&(oe||M.prevLine.fencedCodeEnd||M.prevLine.header||ee))return R.skipToEnd(),M.indentedCode=!0,z.code;if(R.eatSpace())return null;if($&&M.indentation<=Ee&&(me=R.match(A))&&me[1].length<=6)return M.quote=0,M.header=me[1].length,M.thisLine.header=!0,D.highlightFormatting&&(M.formatting="header"),M.f=M.inline,m(M);if(M.indentation<=Ee&&R.eat(">"))return M.quote=$?1:M.quote+1,D.highlightFormatting&&(M.formatting="quote"),R.eatSpace(),m(M);if(!we&&!M.setext&&$&&M.indentation<=Ee&&(me=R.match(k))){var le=me[1]?"ol":"ul";return M.indentation=Ce+R.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,D.taskLists&&R.match(v,!1)&&(M.taskList=!0),M.f=M.inline,D.highlightFormatting&&(M.formatting=["list","list-"+le]),m(M)}else{if($&&M.indentation<=Ee&&(me=R.match(S,!0)))return M.quote=0,M.fencedEndRE=new RegExp(me[1]+"+ *$"),M.localMode=D.fencedCodeBlockHighlighting&&P(me[2]||D.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=ue.startState(M.localMode)),M.f=M.block=b,D.highlightFormatting&&(M.formatting="code-block"),M.code=-1,m(M);if(M.setext||(!Te||!De)&&!M.quote&&M.list===!1&&!M.code&&!we&&!T.test(R.string)&&(me=R.lookAhead(1))&&(me=me.match(O)))return M.setext?(M.header=M.setext,M.setext=0,R.skipToEnd(),D.highlightFormatting&&(M.formatting="header")):(M.header=me[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,m(M);if(we)return R.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,z.hr;if(R.peek()==="[")return l(R,M,N)}return l(R,M,M.inline)}function L(R,M){var $=Z.token(R,M.htmlState);if(!B){var ee=ue.innerMode(Z,M.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||M.md_inside&&R.current().indexOf(">")>-1)&&(M.f=u,M.block=f,M.htmlState=null)}return $}function b(R,M){var $=M.listStack[M.listStack.length-1]||0,ee=M.indentation<$,oe=$+3;if(M.fencedEndRE&&M.indentation<=oe&&(ee||R.match(M.fencedEndRE))){D.highlightFormatting&&(M.formatting="code-block");var ce;return ee||(ce=m(M)),M.localMode=M.localState=null,M.block=f,M.f=u,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,ee?d(R,M,M.block):ce}else return M.localMode?M.localMode.token(R,M.localState):(R.skipToEnd(),z.code)}function m(R){var M=[];if(R.formatting){M.push(z.formatting),typeof R.formatting=="string"&&(R.formatting=[R.formatting]);for(var $=0;$<R.formatting.length;$++)M.push(z.formatting+"-"+R.formatting[$]),R.formatting[$]==="header"&&M.push(z.formatting+"-"+R.formatting[$]+"-"+R.header),R.formatting[$]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=R.quote?M.push(z.formatting+"-"+R.formatting[$]+"-"+R.quote):M.push("error"))}if(R.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(R.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(R.linkHref?M.push(z.linkHref,"url"):(R.strong&&M.push(z.strong),R.em&&M.push(z.em),R.strikethrough&&M.push(z.strikethrough),R.emoji&&M.push(z.emoji),R.linkText&&M.push(z.linkText),R.code&&M.push(z.code),R.image&&M.push(z.image),R.imageAltText&&M.push(z.imageAltText,"link"),R.imageMarker&&M.push(z.imageMarker)),R.header&&M.push(z.header,z.header+"-"+R.header),R.quote&&(M.push(z.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=R.quote?M.push(z.quote+"-"+R.quote):M.push(z.quote+"-"+D.maxBlockquoteDepth)),R.list!==!1){var ee=(R.listStack.length-1)%3;ee?ee===1?M.push(z.list2):M.push(z.list3):M.push(z.list1)}return R.trailingSpaceNewLine?M.push("trailing-space-new-line"):R.trailingSpace&&M.push("trailing-space-"+(R.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(R,M){return R.match(_,!0)?m(M):void 0}function u(R,M){var $=M.text(R,M);if(typeof $!="undefined")return $;if(M.list)return M.list=null,m(M);if(M.taskList){var ee=R.match(v,!0)[1]===" ";return ee?M.taskOpen=!0:M.taskClosed=!0,D.highlightFormatting&&(M.formatting="task"),M.taskList=!1,m(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&R.match(/^#+$/,!0))return D.highlightFormatting&&(M.formatting="header"),m(M);var oe=R.next();if(M.linkTitle){M.linkTitle=!1;var ce=oe;oe==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var De="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(R.match(new RegExp(De),!0))return z.linkHref}if(oe==="`"){var Ee=M.formatting;D.highlightFormatting&&(M.formatting="code"),R.eatWhile("`");var Ce=R.current().length;if(M.code==0&&(!M.quote||Ce==1))return M.code=Ce,m(M);if(Ce==M.code){var Te=m(M);return M.code=0,Te}else return M.formatting=Ee,m(M)}else if(M.code)return m(M);if(oe==="\\"&&(R.next(),D.highlightFormatting)){var we=m(M),me=z.formatting+"-escape";return we?we+" "+me:me}if(oe==="!"&&R.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="["&&M.imageMarker&&R.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="]"&&M.imageAltText){D.highlightFormatting&&(M.formatting="image");var we=m(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=x,we}if(oe==="["&&!M.image)return M.linkText&&R.match(/^.*?\]/)||(M.linkText=!0,D.highlightFormatting&&(M.formatting="link")),m(M);if(oe==="]"&&M.linkText){D.highlightFormatting&&(M.formatting="link");var we=m(M);return M.linkText=!1,M.inline=M.f=R.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,we}if(oe==="<"&&R.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var we=m(M);return we?we+=" ":we="",we+z.linkInline}if(oe==="<"&&R.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var we=m(M);return we?we+=" ":we="",we+z.linkEmail}if(D.xml&&oe==="<"&&R.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=R.string.indexOf(">",R.pos);if(le!=-1){var te=R.string.substring(R.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(M.md_inside=!0)}return R.backUp(1),M.htmlState=ue.startState(Z),d(R,M,L)}if(D.xml&&oe==="<"&&R.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var he=1,ie=R.pos==1?" ":R.string.charAt(R.pos-2);he<3&&R.eat(oe);)he++;var Ae=R.peek()||" ",Re=!/\s/.test(Ae)&&(!h.test(Ae)||/\s/.test(ie)||h.test(ie)),ye=!/\s/.test(ie)&&(!h.test(ie)||/\s/.test(Ae)||h.test(Ae)),Oe=null,Me=null;if(he%2&&(!M.em&&Re&&(oe==="*"||!ye||h.test(ie))?Oe=!0:M.em==oe&&ye&&(oe==="*"||!Re||h.test(Ae))&&(Oe=!1)),he>1&&(!M.strong&&Re&&(oe==="*"||!ye||h.test(ie))?Me=!0:M.strong==oe&&ye&&(oe==="*"||!Re||h.test(Ae))&&(Me=!1)),Me!=null||Oe!=null){D.highlightFormatting&&(M.formatting=Oe==null?"strong":Me==null?"em":"strong em"),Oe===!0&&(M.em=oe),Me===!0&&(M.strong=oe);var Te=m(M);return Oe===!1&&(M.em=!1),Me===!1&&(M.strong=!1),Te}}else if(oe===" "&&(R.eat("*")||R.eat("_"))){if(R.peek()===" ")return m(M);R.backUp(1)}if(D.strikethrough){if(oe==="~"&&R.eatWhile(oe)){if(M.strikethrough){D.highlightFormatting&&(M.formatting="strikethrough");var Te=m(M);return M.strikethrough=!1,Te}else if(R.match(/^[^\s]/,!1))return M.strikethrough=!0,D.highlightFormatting&&(M.formatting="strikethrough"),m(M)}else if(oe===" "&&R.match(/^~~/,!0)){if(R.peek()===" ")return m(M);R.backUp(2)}}if(D.emoji&&oe===":"&&R.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,D.highlightFormatting&&(M.formatting="emoji");var Ie=m(M);return M.emoji=!1,Ie}return oe===" "&&(R.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),m(M)}function a(R,M){var $=R.next();if($===">"){M.f=M.inline=u,D.highlightFormatting&&(M.formatting="link");var ee=m(M);return ee?ee+=" ":ee="",ee+z.linkInline}return R.match(/^[^>]+/,!0),z.linkInline}function x(R,M){if(R.eatSpace())return null;var $=R.next();return $==="("||$==="["?(M.f=M.inline=E($==="("?")":"]"),D.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,m(M)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(R){return function(M,$){var ee=M.next();if(ee===R){$.f=$.inline=u,D.highlightFormatting&&($.formatting="link-string");var oe=m($);return $.linkHref=!1,oe}return M.match(y[R]),$.linkHref=!0,m($)}}function N(R,M){return R.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=U,R.next(),D.highlightFormatting&&(M.formatting="link"),M.linkText=!0,m(M)):l(R,M,u)}function U(R,M){if(R.match(/^\]:/,!0)){M.f=M.inline=K,D.highlightFormatting&&(M.formatting="link");var $=m(M);return M.linkText=!1,$}return R.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function K(R,M){return R.eatSpace()?null:(R.match(/^[^\s]+/,!0),R.peek()===void 0?M.linkTitle=!0:R.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=u,z.linkHref+" url")}var V={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:u,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(R){return{f:R.f,prevLine:R.prevLine,thisLine:R.thisLine,block:R.block,htmlState:R.htmlState&&ue.copyState(Z,R.htmlState),indentation:R.indentation,localMode:R.localMode,localState:R.localMode?ue.copyState(R.localMode,R.localState):null,inline:R.inline,text:R.text,formatting:!1,linkText:R.linkText,linkTitle:R.linkTitle,linkHref:R.linkHref,code:R.code,em:R.em,strong:R.strong,strikethrough:R.strikethrough,emoji:R.emoji,header:R.header,setext:R.setext,hr:R.hr,taskList:R.taskList,list:R.list,listStack:R.listStack.slice(0),quote:R.quote,indentedCode:R.indentedCode,trailingSpace:R.trailingSpace,trailingSpaceNewLine:R.trailingSpaceNewLine,md_inside:R.md_inside,fencedEndRE:R.fencedEndRE}},token:function(R,M){if(M.formatting=!1,R!=M.thisLine.stream){if(M.header=0,M.hr=!1,R.match(/^\s*$/,!0))return p(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:R},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=L)){var $=R.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=$,M.indentationDiff=null,$>0)return null}}return M.f(R,M)},innerMode:function(R){return R.block==L?{state:R.htmlState,mode:Z}:R.localState?{state:R.localState,mode:R.localMode}:{state:R,mode:V}},indent:function(R,M,$){return R.block==L&&Z.indent?Z.indent(R.htmlState,M,$):R.localState&&R.localMode.indent?R.localMode.indent(R.localState,M,$):ue.Pass},blankLine:p,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},osHv:function(bt,Je,ae){(function(ue){ue(ae("VrN/"))})(function(ue){"use strict";var Q=ue.Pos;function D(h,o){return h.line-o.line||h.ch-o.ch}var Z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",B=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Z+"]["+B+"]*)","g");function z(h,o,l,d){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function j(h,o){var l=h.cm.getTokenTypeAt(Q(h.line,o));return l&&/\btag\b/.test(l)}function I(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function k(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function v(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(I(h))continue;return}if(!j(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function A(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(k(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}P.lastIndex=o,h.ch=o;var l=P.exec(h.text);if(l&&l.index==o)return l}}function O(h){for(;;){P.lastIndex=h.ch;var o=P.exec(h.text);if(!o){if(I(h))continue;return}if(!j(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function _(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(k(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function S(h,o){for(var l=[];;){var d=O(h),C,p=h.line,f=h.ch-(d?d[0].length:0);if(!d||!(C=v(h)))return;if(C=="selfClose")continue;if(d[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==d[2]){l.length=L;break}if(L<0&&(!o||o==d[2]))return{tag:d[2],from:Q(p,f),to:Q(h.line,h.ch)}}else l.push(d[2])}}function T(h,o){for(var l=[];;){var d=_(h);if(!d)return;if(d=="selfClose"){A(h);continue}var C=h.line,p=h.ch,f=A(h);if(!f)return;if(f[1])l.push(f[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==f[2]){l.length=L;break}if(L<0&&(!o||o==f[2]))return{tag:f[2],from:Q(h.line,h.ch),to:Q(C,p)}}}}ue.registerHelper("fold","xml",function(h,o){for(var l=new z(h,o.line,0);;){var d=O(l);if(!d||l.line!=o.line)return;var C=v(l);if(!C)return;if(!d[1]&&C!="selfClose"){var p=Q(l.line,l.ch),f=S(l,d[2]);return f&&D(f.from,p)>0?{from:p,to:f.from}:null}}}),ue.findMatchingTag=function(h,o,l){var d=new z(h,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var C=v(d),p=C&&Q(d.line,d.ch),f=C&&A(d);if(!C||!f||D(d,o)>0)return;var L={from:Q(d.line,d.ch),to:p,tag:f[2]};return C=="selfClose"?{open:L,close:null,at:"open"}:f[1]?{open:T(d,f[2]),close:L,at:"close"}:(d=new z(h,p.line,p.ch,l),{open:L,close:S(d,f[2]),at:"open"})},ue.findEnclosingTag=function(h,o,l,d){for(var C=new z(h,o.line,o.ch,l);;){var p=T(C,d);if(!p)break;var f=new z(h,o.line,o.ch,l),L=S(f,p.tag);if(L)return{open:p,close:L}}},ue.scanForClosingTag=function(h,o,l,d){var C=new z(h,o.line,o.ch,d?{from:0,to:d}:null);return S(C,l)}})},p5ED:function(bt,Je,ae){"use strict";var ue=ae("+L6B"),Q=ae("2/Rp"),D=ae("5Dmo"),Z=ae("3S7+"),B=ae("k1fw"),P=ae("9og8"),z=ae("tJVT"),j=ae("WmNS"),I=ae.n(j),k=ae("q1tI"),v=ae.n(k),A=ae("vHTk"),O=ae.n(A),_=ae("yEEn"),S=ae("ZW9T"),T=ae("1vsH"),h=ae("V0Rq"),o=ae("m3rI"),l=function(C){var p=C.name,f=C.data,L=C.theme,b=C.type,m=C.filename,c=C.monacoEditor,u=C.className,a=C.style,x=C.close,y=C.onClose,E=C.hasMask,N=C.otherData,U=N===void 0?{}:N,K=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(z.a)(K,2),R=V[0],M=V[1],$=Object(k.useState)(""),ee=Object(z.a)($,2),oe=ee[0],ce=ee[1],De=Object(k.useState)(),Ee=Object(z.a)(De,2),Ce=Ee[0],Te=Ee[1],we=window.ENV==="build"?"/react/build/office.html":"/office.html",me,le=1024*1024,te=10*le,he=Object(k.useRef)();b==="office"&&(me=Object(T.R)(f).filesize,me>te&&(b="other")),m&&(c.filename=m),Object(k.useEffect)(function(){var ye,Oe,Me=(ye=document.cookie)===null||ye===void 0||((Oe=ye.replace(/\s/g,""))===null||Oe===void 0)?void 0:Oe.split(";");Me==null||Me.map(function(Ie){var je=Ie.split("=");je[0]==="_educoder_session"&&ce(je[1])})},[]),Object(k.useEffect)(function(){b==="office"&&ie()},[b]);var ie=function(){var ye=Object(P.a)(I.a.mark(function Oe(){var Me,Ie,je;return I.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return console.log("data:",f),Me=f,f.startsWith("http")||(Me=location.origin+Me),Ie=new URL(Me).pathname.split("/").pop(),Ne.next=6,Object(h.U)({attachment_id:Ie});case 6:je=Ne.sent,Te(je);case 8:case"end":return Ne.stop()}},Oe)}));return function(){return ye.apply(this,arguments)}}(),Ae=function(){if(f.startsWith("http")||f.startsWith("/api")||f.startsWith("blob:")){Re();return}Object(T.x)(m||"educoder",f,m||"educoder")},Re=function(){Object(T.v)(m||"educoder",decodeURIComponent(f))};return v.a.createElement("div",{style:Object(B.a)({},a||{}),className:"".concat(E&&O.a.bgBlack," ").concat(b?O.a.wrp:"hide")},x&&v.a.createElement("div",{className:O.a.close,ref:he},v.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return he.current}},v.a.createElement("span",{onClick:Re},v.a.createElement("i",{className:"icon-quxiaozhiding"}))),v.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return he.current}},v.a.createElement("span",{className:"",onClick:function(){y(),Te(null)}},v.a.createElement("i",{className:"icon-guanbi1"})))),v.a.createElement("div",{className:"".concat(O.a[u]," ").concat(u," ").concat(O.a.monaco," ").concat(b==="txt"?"show":"hide")},b==="txt"&&v.a.createElement(S.b,c)),b==="audio"&&v.a.createElement("audio",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(f),autoPlay:!0}),b==="video"&&v.a.createElement(v.a.Fragment,null,(f==null?void 0:f.indexOf("/api"))>-1?v.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):v.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),b==="office"&&Ce&&v.a.createElement("iframe",{src:"".concat(we,"?key=").concat(Ce.key,"&url=").concat(o.a.API_SERVER+Ce.url,"&callbackUrl=").concat(o.a.API_SERVER+Ce.callbackUrl,"&fileType=").concat(Ce.fileType,"&title=").concat(Ce.title,"&model=view")}),(b==="xlsx"||b==="doc"||b==="pptx"||b==="docx")&&v.a.createElement("iframe",{src:"".concat(we,"?key=").concat(U.key,"&url=").concat(o.a.API_SERVER+U.url,"&callbackUrl=").concat(o.a.API_SERVER+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(U.model)}),b==="html"&&v.a.createElement("iframe",{src:f+"&disposition=inline"}),b==="pdf"&&v.a.createElement("embed",{className:O.a.embed,src:f,type:"application/pdf"}),b==="image"&&v.a.createElement("img",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(f)}),b==="other"&&v.a.createElement("div",null,v.a.createElement(Q.a,{type:"primary",size:"large",onClick:Ae},v.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),b==="download"&&v.a.createElement(Q.a,{type:"primary",size:"large",onClick:Ae},v.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};Je.a=l},"p77/":function(bt,Je,ae){},"rAM+":function(bt,Je,ae){"use strict";ae.d(Je,"a",function(){return Q});var ue=ae("Qw5x");function Q(D,Z){var B;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(B=Object(ue.a)(D))||Z&&D&&typeof D.length=="number"){B&&(D=B);var P=0,z=function(){};return{s:z,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(A){throw A},f:z}}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 j=!0,I=!1,k;return{s:function(){B=D[Symbol.iterator]()},n:function(){var A=B.next();return j=A.done,A},e:function(A){I=!0,k=A},f:function(){try{!j&&B.return!=null&&B.return()}finally{if(I)throw k}}}}},rUJ1:function(bt,Je){const ae=/[&<>"']/,ue=/[&<>"']/g,Q=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=b=>Z[b];function P(b,m){if(m){if(ae.test(b))return b.replace(ue,B)}else if(Q.test(b))return b.replace(D,B);return b}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(b){return b.replace(z,(m,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 I=/(^|[^\[])\^/g;function k(b,m){b=b.source||b,m=m||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(I,"$1"),b=b.replace(u,a),c),getRegex:()=>new RegExp(b,m)};return c}const v=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(b,m,c){if(b){let u;try{u=decodeURIComponent(j(c)).replace(v,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}m&&!A.test(c)&&(c=o(m,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const _={},S=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,m){_[" "+b]||(S.test(b)?_[" "+b]=b+"/":_[" "+b]=p(b,"/",!0)),b=_[" "+b];const c=b.indexOf(":")===-1;return m.substring(0,2)==="//"?c?m:b.replace(T,"$1")+m:m.charAt(0)==="/"?c?m:b.replace(h,"$1")+m:b+m}const l={exec:function(){}};function d(b){let m=1,c,u;for(;m<arguments.length;m++){c=arguments[m];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(b[u]=c[u])}return b}function C(b,m){const c=b.replace(/\|/g,(x,y,E)=>{let N=!1,U=y;for(;--U>=0&&E[U]==="\\";)N=!N;return N?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>m)u.splice(m);else for(;u.length<m;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function p(b,m,c){const u=b.length;if(u===0)return"";let a=0;for(;a<u;){const x=b.charAt(u-a-1);if(x===m&&!c)a++;else if(x!==m&&c)a++;else break}return b.substr(0,u-a)}function f(b,m){if(b.indexOf(m[1])===-1)return-1;const c=b.length;let u=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===m[0])u++;else if(b[a]===m[1]&&(u--,u<0))return a;return-1}function L(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}bt.exports={escape:P,unescape:j,edit:k,cleanUrl:O,resolveUrl:o,noopTest:l,merge:d,splitCells:C,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:L}},ulZh:function(bt,Je,ae){typeof window!="undefined"&&function(Q,D){bt.exports=D()}(this,function(){return function(ue){var Q={};function D(Z){if(Q[Z])return Q[Z].exports;var B=Q[Z]={i:Z,l:!1,exports:{}};return ue[Z].call(B.exports,B,B.exports,D),B.l=!0,B.exports}return D.m=ue,D.c=Q,D.d=function(Z,B,P){D.o(Z,B)||Object.defineProperty(Z,B,{enumerable:!0,get:P})},D.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},D.t=function(Z,B){if(B&1&&(Z=D(Z)),B&8)return Z;if(B&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Z}),B&2&&typeof Z!="string")for(var z in Z)D.d(P,z,function(j){return Z[j]}.bind(null,z));return P},D.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return D.d(B,"a",B),B},D.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,Q,D){"use strict";var Z=Object.prototype.hasOwnProperty,B="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(B=!1));function z(v,A,O){this.fn=v,this.context=A,this.once=O||!1}function j(v,A,O,_,S){if(typeof O!="function")throw new TypeError("The listener must be a function");var T=new z(O,_||v,S),h=B?B+A:A;return v._events[h]?v._events[h].fn?v._events[h]=[v._events[h],T]:v._events[h].push(T):(v._events[h]=T,v._eventsCount++),v}function I(v,A){--v._eventsCount===0?v._events=new P:delete v._events[A]}function k(){this._events=new P,this._eventsCount=0}k.prototype.eventNames=function(){var A=[],O,_;if(this._eventsCount===0)return A;for(_ in O=this._events)Z.call(O,_)&&A.push(B?_.slice(1):_);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(O)):A},k.prototype.listeners=function(A){var O=B?B+A:A,_=this._events[O];if(!_)return[];if(_.fn)return[_.fn];for(var S=0,T=_.length,h=new Array(T);S<T;S++)h[S]=_[S].fn;return h},k.prototype.listenerCount=function(A){var O=B?B+A:A,_=this._events[O];return _?_.fn?1:_.length:0},k.prototype.emit=function(A,O,_,S,T,h){var o=B?B+A:A;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,C,p;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,O),!0;case 3:return l.fn.call(l.context,O,_),!0;case 4:return l.fn.call(l.context,O,_,S),!0;case 5:return l.fn.call(l.context,O,_,S,T),!0;case 6:return l.fn.call(l.context,O,_,S,T,h),!0}for(p=1,C=new Array(d-1);p<d;p++)C[p-1]=arguments[p];l.fn.apply(l.context,C)}else{var f=l.length,L;for(p=0;p<f;p++){l[p].once&&this.removeListener(A,l[p].fn,void 0,!0);switch(d){case 1:l[p].fn.call(l[p].context);break;case 2:l[p].fn.call(l[p].context,O);break;case 3:l[p].fn.call(l[p].context,O,_);break;case 4:l[p].fn.call(l[p].context,O,_,S);break;default:if(!C)for(L=1,C=new Array(d-1);L<d;L++)C[L-1]=arguments[L];l[p].fn.apply(l[p].context,C)}}}return!0},k.prototype.on=function(A,O,_){return j(this,A,O,_,!1)},k.prototype.once=function(A,O,_){return j(this,A,O,_,!0)},k.prototype.removeListener=function(A,O,_,S){var T=B?B+A:A;if(!this._events[T])return this;if(!O)return I(this,T),this;var h=this._events[T];if(h.fn)h.fn===O&&(!S||h.once)&&(!_||h.context===_)&&I(this,T);else{for(var o=0,l=[],d=h.length;o<d;o++)(h[o].fn!==O||S&&!h[o].once||_&&h[o].context!==_)&&l.push(h[o]);l.length?this._events[T]=l.length===1?l[0]:l:I(this,T)}return this},k.prototype.removeAllListeners=function(A){var O;return A?(O=B?B+A:A,this._events[O]&&I(this,O)):(this._events=new P,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=B,k.EventEmitter=k,ue.exports=k},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,Q,D){(function(Z){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(k,v,A){if(A=A||{},k=k.trim(),v=v.trim(),!v){if(!A.alwaysNormalize)return k;var O=I.parseURL(k);if(!O)throw new Error("Error trying to parse base URL.");return O.path=I.normalizePath(O.path),I.buildURLFromParts(O)}var _=I.parseURL(v);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return A.alwaysNormalize?(_.path=I.normalizePath(_.path),I.buildURLFromParts(_)):v;var S=I.parseURL(k);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var T=P.exec(S.path);S.netLoc=T[1],S.path=T[2]}S.netLoc&&!S.path&&(S.path="/");var h={scheme:S.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(h.netLoc=S.netLoc,_.path[0]!=="/"))if(!_.path)h.path=S.path,_.params||(h.params=S.params,_.query||(h.query=S.query));else{var o=S.path,l=o.substring(0,o.lastIndexOf("/")+1)+_.path;h.path=I.normalizePath(l)}return h.path===null&&(h.path=A.alwaysNormalize?I.normalizePath(_.path):_.path),I.buildURLFromParts(h)},parseURL:function(k){var v=B.exec(k);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(k){for(k=k.split("").reverse().join("").replace(z,"");k.length!==(k=k.replace(j,"")).length;);return k.split("").reverse().join("")},buildURLFromParts:function(k){return k.scheme+k.netLoc+k.path+k.params+k.query+k.fragment}};ue.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,Q,D){function Z(A){var O={};function _(T){if(O[T])return O[T].exports;var h=O[T]={i:T,l:!1,exports:{}};return A[T].call(h.exports,h,h.exports,_),h.l=!0,h.exports}_.m=A,_.c=O,_.i=function(T){return T},_.d=function(T,h,o){_.o(T,h)||Object.defineProperty(T,h,{configurable:!1,enumerable:!0,get:o})},_.r=function(T){Object.defineProperty(T,"__esModule",{value:!0})},_.n=function(T){var h=T&&T.__esModule?function(){return T.default}:function(){return T};return _.d(h,"a",h),h},_.o=function(T,h){return Object.prototype.hasOwnProperty.call(T,h)},_.p="/",_.oe=function(T){throw console.error(T),T};var S=_(_.s=ENTRY_MODULE);return S.default||S}var B="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function z(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(A){return!isNaN(1*A)}function I(A,O,_){var S={};S[_]=[];var T=O.toString(),h=T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return S;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+z(o)+P,"g"),d;d=l.exec(T);){if(d[3]==="dll-reference")continue;S[_].push(d[3])}for(l=new RegExp("\\("+z(o)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+P,"g");d=l.exec(T);)A[d[2]]||(S[_].push(d[1]),A[d[2]]=D(d[1]).m),S[d[2]]=S[d[2]]||[],S[d[2]].push(d[4]);for(var C=Object.keys(S),p=0;p<C.length;p++)for(var f=0;f<S[C[p]].length;f++)j(S[C[p]][f])&&(S[C[p]][f]=1*S[C[p]][f]);return S}function k(A){var O=Object.keys(A);return O.reduce(function(_,S){return _||A[S].length>0},!1)}function v(A,O){for(var _={main:[O]},S={main:[]},T={main:{}};k(_);)for(var h=Object.keys(_),o=0;o<h.length;o++){var l=h[o],d=_[l],C=d.pop();if(T[l]=T[l]||{},T[l][C]||!A[l][C])continue;T[l][C]=!0,S[l]=S[l]||[],S[l].push(C);for(var p=I(A,A[l][C],l),f=Object.keys(p),L=0;L<f.length;L++)_[f[L]]=_[f[L]]||[],_[f[L]]=_[f[L]].concat(p[f[L]])}return S}ue.exports=function(A,O){O=O||{};var _={main:D.m},S=O.all?{main:Object.keys(_.main)}:v(_,A),T="";Object.keys(S).filter(function(C){return C!=="main"}).forEach(function(C){for(var p=0;S[C][p];)p++;S[C].push(p),_[C][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",T=T+"var "+C+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+S[C].map(function(f){return""+JSON.stringify(f)+": "+_[C][f].toString()}).join(",")+`});
`}),T=T+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+S.main.map(function(C){return""+JSON.stringify(C)+": "+_.main[C].toString()}).join(",")+"}))(self);";var h=new window.Blob([T],{type:"text/javascript"});if(O.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"hlsDefaultConfig",function(){return L}),D.d(Q,"mergeConfig",function(){return m}),D.d(Q,"enableStreamingMode",function(){return c});var Z=D("./src/controller/abr-controller.ts"),B=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),z=D("./src/controller/subtitle-stream-controller.ts"),j=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),k=D("./src/controller/timeline-controller.ts"),v=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),O=D("./src/controller/eme-controller.ts"),_=D("./src/controller/cmcd-controller.ts"),S=D("./src/utils/xhr-loader.ts"),T=D("./src/utils/fetch-loader.ts"),h=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(u[y]=x[y])}return u},d.apply(this,arguments)}function C(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);a&&(y=y.filter(function(E){return Object.getOwnPropertyDescriptor(u,E).enumerable})),x.push.apply(x,y)}return x}function p(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?C(Object(x),!0).forEach(function(y){f(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function f(u,a,x){return a in u?Object.defineProperty(u,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[a]=x,u}var L=p(p({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:Z.default,bufferController:I.default,capLevelController:v.default,fpsController:A.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:z.SubtitleStreamController,subtitleTrackController:j.default,timelineController:k.TimelineController,audioStreamController:B.default,audioTrackController:P.default,emeController:O.default,cmcdController:_.default});function b(){return{cueHandler:h.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 m(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},u,a)}function c(u){var a=u.loader;if(a!==T.default&&a!==S.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(T.fetchSupported)();x&&(u.loader=T.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),z=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),I=D("./src/types/loader.ts"),k=D("./src/utils/logger.ts");function v(_,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function A(_,S,T){return S&&v(_.prototype,S),T&&v(_,T),_}var O=function(){function _(T){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=T;var h=T.config;this.bwEstimator=new B.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var S=_.prototype;return S.registerListeners=function(){var h=this.hls;h.on(P.Events.FRAG_LOADING,this.onFragLoading,this),h.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(P.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(P.Events.FRAG_LOADING,this.onFragLoading,this),h.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(P.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(h,o){var l=o.frag;if(l.type===I.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,C=l.config,p=l.media;if(!h||!p)return;var f=o?o.stats:h.stats,L=o?o.duration:h.duration;if(f.aborted){k.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-f.loading.start,m=Math.abs(p.playbackRate);if(b<=500*L/m)return;var c=l.levels,u=l.minAutoLevel,a=c[h.level],x=f.total||Math.max(f.loaded,Math.round(L*a.maxBitrate/8)),y=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),E=(x-f.loaded)/y,N=p.currentTime,U=(z.BufferHelper.bufferInfo(p,N,C.maxBufferHole).end-N)/m;if(U>=2*L/m||E<=U)return;var K=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>u;V--){var R=c[V].maxBitrate;if(K=L*R/(8*.8*y),K<U)break}if(K>=E)return;var M=this.bwEstimator.getEstimate();k.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:f})},S.onFragLoaded=function(h,o){var l=o.frag,d=o.part;if(l.type===I.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var C=d?d.stats:l.stats,p=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],L=(f.loaded?f.loaded.bytes:0)+C.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:L,duration:b},f.realBitrate=Math.round(8*L/b)}if(l.bitrateTest){var m={stats:C,frag:l,part:d,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},S.onFragBuffered=function(h,o){var l=o.frag,d=o.part,C=d?d.stats:l.stats;if(C.aborted)return;if(l.type!==I.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var p=C.parsing.end-C.loading.start;this.bwEstimator.sample(p,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},S.onError=function(h,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,C=l.config,p=l.minAutoLevel,f=l.media,L=o?o.duration:h?h.duration:0,b=f?f.currentTime:0,m=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,u=(z.BufferHelper.bufferInfo(f,b,C.maxBufferHole).end-b)/m,a=this.findBestLevel(c,p,d,u,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;k.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,E=C.abrBandWidthUpFactor;if(!u){var N=this.bitrateTestDelay;if(N){var U=L?Math.min(L,C.maxLoadingDelay):C.maxLoadingDelay;x=U-N,k.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=E=1}}return a=this.findBestLevel(c,p,d,u+x,y,E),Math.max(a,0)},S.findBestLevel=function(h,o,l,d,C,p){for(var f,L=this.fragCurrent,b=this.partCurrent,m=this.lastLoadedFragLevel,c=this.hls.levels,u=c[m],a=!!(u!=null&&(f=u.details)!==null&&f!==void 0&&f.live),x=u==null?void 0:u.codecSet,y=b?b.duration:L?L.duration:0,E=l;E>=o;E--){var N=c[E];if(!N||x&&N.codecSet!==x)continue;var U=N.details,K=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,V=void 0;E<=m?V=C*h:V=p*h;var R=c[E].maxBitrate,M=R*K/V;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(V)+"/"+R+"/"+K+"/"+d+"/"+M),V>R&&(!M||a&&!this.bitrateTestDelay||M<d))return E}return-1},A(_,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),_}();Q.default=O},"./src/controller/audio-stream-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),z=D("./src/utils/buffer-helper.ts"),j=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),k=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),O=D("./src/demux/transmuxer-interface.ts"),_=D("./src/types/transmuxer.ts"),S=D("./src/controller/fragment-finders.ts"),T=D("./src/utils/discontinuities.ts"),h=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var m=arguments[b];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},l.apply(this,arguments)}function d(L,b){L.prototype=Object.create(b.prototype),L.prototype.constructor=L,C(L,b)}function C(L,b){return C=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},C(L,b)}var p=100,f=function(L){d(b,L);function b(c,u){var a;return a=L.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var m=b.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var u=this.hls;u.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(P.Events.ERROR,this.onError,this),u.on(P.Events.BUFFER_RESET,this.onBufferReset,this),u.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var u=this.hls;u.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(P.Events.ERROR,this.onError,this),u.off(P.Events.BUFFER_RESET,this.onBufferReset,this),u.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(u,a){var x=a.frag,y=a.id,E=a.initPTS;if(y==="main"){var N=x.cc;this.initPTS[x.cc]=E,this.log("InitPTS for cc: "+N+" found from main: "+E),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=B.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},m.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var u,a=this.levels,x=this.trackId,y=a==null||((u=a[x])===null||u===void 0)?void 0:u.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),U=this.retryDate;(!U||N>=U||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,R=K.part,M=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var ee=M.flush(),oe={frag:V,part:R,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),$&&L.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ce=this.getLoadPosition(),De=z.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),Ee=Object(S.fragmentWithinToleranceTest)(De.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+De.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},m.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},m.doTickIdle=function(){var u,a,x=this.hls,y=this.levels,E=this.media,N=this.trackId,U=x.config;if(!y||!y[N])return;if(!E&&(this.startFragRequested||!U.startFragPrefetch))return;var K=y[N],V=K.details;if(!V||V.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,k.PlaylistLevelType.AUDIO));var R=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(R===null)return;var M=R.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(M>=$&&!ee)return;if(!ee&&this._streamEnded(R,V)){x.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var oe=V.fragments,ce=oe[0].start,De=R.end;if(ee){var Ee=this.getLoadPosition();De=Ee,V.PTSKnown&&Ee<ce&&((R.end>ce||R.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=ce+.05))}var Ce=this.getNextFragment(De,V);if(!Ce){this.bufferFlushed=!0;return}((u=Ce.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Ce.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ce,V):this.loadFragment(Ce,V,De)},m.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},m.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(u,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new I.Level(y)})},m.onAudioTrackSwitching=function(u,a){var x=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(p):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(u,a){this.mainDetails=a.details},m.onAudioTrackLoaded=function(u,a){var x,y=this.levels,E=a.details,N=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var U=y[N],K=0;if(E.live||(x=U.details)!==null&&x!==void 0&&x.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!U.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(T.alignMediaPlaylistByPDT)(E,V),K=E.fragments[0].start):K=this.alignPlaylists(E,U.details)}U.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(U.details,K),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=B.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(u){var a,x=u.frag,y=u.part,E=u.payload,N=this.config,U=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var V=K[U];console.assert(V,"Audio track is defined on fragment load progress");var R=V.details;console.assert(R,"Audio track details are defined on fragment load progress");var M=N.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new O.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[x.cc],oe=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var ce=!1,De=y?y.index:-1,Ee=De!==-1,Ce=new _.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,E.byteLength,De,Ee);$.push(E,oe,M,"",x,y,R.totalduration,ce,Ce,ee)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+R.startSN+" ,"+R.endSN+"],track "+U);var Te=this.waitingData=this.waitingData||{frag:x,part:y,cache:new A.default,complete:!1},we=Te.cache;we.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(u,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},m.onFragBuffered=function(u,a){var x=a.frag,y=a.part;if(x.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},m.onError=function(u,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=a.fatal?B.State.ERROR:B.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(u,a){var x=a.type;x===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(u){var a,x="audio",y=this.hls,E=u.remuxResult,N=u.chunkMeta,U=this.getCurrentContext(N);if(!U){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var K=U.frag,V=U.part,R=E.audio,M=E.text,$=E.id3,ee=E.initSegment;if(this.fragContextChanged(K))return;if(this.state=B.State.PARSING,this.audioSwitch&&R&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,N),y.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:x,tracks:ee.tracks})),R){var oe=R.startPTS,ce=R.endPTS,De=R.startDTS,Ee=R.endDTS;V&&(V.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:ce,startDTS:De,endDTS:Ee}),K.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,oe,ce,De,Ee),this.bufferFragmentData(R,K,V,N)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Ce=l({frag:K,id:x},$);y.trigger(P.Events.FRAG_PARSING_METADATA,Ce)}if(M){var Te=l({frag:K,id:x},M);y.trigger(P.Events.FRAG_PARSING_USERDATA,Te)}},m._bufferInitSegment=function(u,a,x){if(this.state!==B.State.PARSING)return;u.video&&delete u.video;var y=u.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,u);var E=y.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},m.loadFragment=function(u,a,x){var y=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||y===j.FragmentState.NOT_LOADED||y===j.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,a,x)))},m.completeAudioSwitch=function(){var u=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:x})},b}(B.default);Q.default=f},"./src/controller/audio-track-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),z=D("./src/types/loader.ts");function j(O,_){for(var S=0;S<_.length;S++){var T=_[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(O,T.key,T)}}function I(O,_,S){return _&&j(O.prototype,_),S&&j(O,S),O}function k(O,_){O.prototype=Object.create(_.prototype),O.prototype.constructor=O,v(O,_)}function v(O,_){return v=Object.setPrototypeOf||function(T,h){return T.__proto__=h,T},v(O,_)}var A=function(O){k(_,O);function _(T){var h;return h=O.call(this,T,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var S=_.prototype;return S.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.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(h,o){this.tracks=o.audioTracks||[]},S.onAudioTrackLoaded=function(h,o){var l=o.id,d=o.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var p=C.details;C.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,p))},S.onLevelLoading=function(h,o){this.switchLevel(o.level)},S.onLevelSwitching=function(h,o){this.switchLevel(o.level)},S.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(p){return!l||p.groupId===l});this.selectDefaultTrack&&!d.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var C={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},S.onError=function(h,o){if(O.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===z.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},S.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var d=o[h],C=d.id,p=d.groupId,f=p===void 0?"":p,L=d.name,b=d.type,m=d.url;if(this.trackId=h,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:f,name:L,type:b,url:m}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(c)},S.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},S.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,C=o.url;if(h)try{C=h.addDirectives(C)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:d,deliveryDirectives:h||null})}},I(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),_}(P.default);Q.default=A},"./src/controller/base-playlist-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/polyfills/number.ts"),B=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),z=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),I=function(){function k(A,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=z.logger.log.bind(z.logger,O+":"),this.warn=z.logger.warn.bind(z.logger,O+":"),this.hls=A}var v=k.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(O,_){_.fatal&&_.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(O,_){var S=_==null?void 0:_.renditionReports;if(S)for(var T=0;T<S.length;T++){var h=S[T],o=""+h.URI;if(o===O.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var C=Math.min(_.age-_.partTarget,_.targetduration);d!==void 0&&C>_.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Z.isFiniteNumber)(d)?d:void 0,B.HlsSkip.No)}}},v.loadPlaylist=function(O){},v.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},v.playlistLoaded=function(O,_,S){var T=this,h=_.details,o=_.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||S!=null&&S.live){if(h.reloaded(S),S&&this.log("live playlist "+O+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),S&&h.fragments.length>0&&Object(P.mergeDetails)(S,h),!this.canLoad||!h.live)return;var d,C=void 0,p=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var f=this.hls.config.lowLatencyMode,L=h.lastPartSn,b=h.endSN,m=h.lastPartIndex,c=m!==-1,u=L===b,a=f?0:m;c?(C=u?b+1:L,p=u?a:m+1):C=b+1;var x=h.age,y=x+h.ageHeader,E=Math.min(y-h.partTarget,h.targetduration*1.5);if(E>0){if(S&&E>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+E+" with playlist age: "+h.age),E=0;else{var N=Math.floor(E/h.targetduration);if(C+=N,p!==void 0){var U=Math.round(E%h.targetduration/h.partTarget);p+=U}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+p)}h.tuneInGoal=E}if(d=this.getDeliveryDirectives(h,_.deliveryDirectives,C,p),f||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,_.deliveryDirectives,C,p);var K=Object(P.computeReloadInterval)(h,o);C!==void 0&&h.canBlockReload&&(K-=h.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return T.loadPlaylist(d)},K)}else this.clearTimer()},v.getDeliveryDirectives=function(O,_,S,T){var h=Object(B.getSkipValue)(O,S);return _!=null&&_.skip&&O.deltaUpdateFailed&&(S=_.msn,T=_.part,h=B.HlsSkip.No),new B.HlsUrlParameters(S,T,h)},v.retryLoadingOrFail=function(O){var _=this,S=this.hls.config,T=this.retryCount<S.levelLoadingMaxRetry;if(T){var h;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(h=O.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return T},k}()},"./src/controller/base-stream-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"State",function(){return b}),D.d(Q,"default",function(){return m});var Z=D("./src/polyfills/number.ts"),B=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),z=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),I=D("./src/events.ts"),k=D("./src/errors.ts"),v=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/discontinuities.ts"),_=D("./src/controller/fragment-finders.ts"),S=D("./src/controller/level-helper.ts"),T=D("./src/loader/fragment-loader.ts"),h=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function d(c,u){for(var a=0;a<u.length;a++){var x=u[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function C(c,u,a){return u&&d(c.prototype,u),a&&d(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,L(c,u)}function L(c,u){return L=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},L(c,u)}var b={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"},m=function(c){f(u,c);function u(x,y,E){var N;return N=c.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=b.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=E,N.log=j.logger.log.bind(j.logger,E+":"),N.warn=j.logger.warn.bind(j.logger,E+":"),N.hls=x,N.fragmentLoader=new T.default(x.config),N.fragmentTracker=y,N.config=x.config,N.decrypter=new h.default(x,x.config),x.on(I.Events.KEY_LOADED,N.onKeyLoaded,p(N)),N}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(y,E){var N=this.fragCurrent,U=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!y.nextStart){var K=U.getState(N);return K===P.FragmentState.PARTIAL||K===P.FragmentState.OK}return!1},a.onMediaAttached=function(y,E){var N=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var y=this.config,E=this.fragCurrent,N=this.media,U=this.mediaBuffer,K=this.state,V=N?N.currentTime:0,R=z.BufferHelper.bufferInfo(U||N,V,y.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===b.ENDED)this.resetLoadingState();else if(E&&!R.len){var M=y.maxFragLookUpTolerance,$=E.start-M,ee=E.start+E.duration+M,oe=V>ee;(V<$||oe)&&(oe&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=V),!this.loadedmetadata&&!R.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,E){if(this.state!==b.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var N=this.levels[E.frag.level].details;N&&this.loadFragment(E.frag,N,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(I.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(y,E){this.log("Loading key for "+y.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(I.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,E,N){this._loadFragForPlayback(y,E,N)},a._loadFragForPlayback=function(y,E,N){var U=this,K=function(R){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(R.part?" p: "+R.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(R)};this._doFragLoad(y,E,N,K).then(function(V){if(!V)return;U.fragLoadError=0;var R=U.state;if(U.fragContextChanged(y)){(R===b.FRAG_LOADING||R===b.BACKTRACKING||!U.fragCurrent&&R===b.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=b.IDLE);return}if("payload"in V&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(I.Events.FRAG_LOADED,V),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(y,V),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(V)}).catch(function(V){U.warn(V),U.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,E,N){if(N===void 0&&(N=null),!(y-E))return;var U={startOffset:y,endOffset:E,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(y){var E=this;this._doFragLoad(y).then(function(N){if(!N||E.fragContextChanged(y)||!E.levels)throw new Error("init load aborted");return N}).then(function(N){var U=E.hls,K=N.payload,V=y.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var R=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(M){var $=self.performance.now();return U.trigger(I.Events.FRAG_DECRYPTED,{frag:y,payload:M,stats:{tstart:R,tdecrypt:$}}),N.payload=M,N})}return N}).then(function(N){var U=E.fragCurrent,K=E.hls,V=E.levels;if(!V)throw new Error("init load aborted, missing levels");var R=V[y.level].details;console.assert(R,"Level details are defined when init segment is loaded");var M=y.stats;E.state=b.IDLE,E.fragLoadError=0,y.data=new Uint8Array(N.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),N.frag===U&&K.trigger(I.Events.FRAG_BUFFERED,{stats:M,frag:U,part:null,id:y.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var E=this.fragCurrent;return!y||!E||y.level!==E.level||y.sn!==E.sn||y.urlId!==E.urlId},a.fragBufferedComplete=function(y,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(z.BufferHelper.getBuffered(N))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var E=this.transmuxer;if(!E)return;var N=y.frag,U=y.part,K=y.partsLoaded,V=!K||K.length===0||K.some(function(M){return!M}),R=new v.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,U?U.index:-1,!V);E.flush(R)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,E,N,U){var K=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(y.start,N||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&U){N>y.end&&E.fragmentHint&&(y=E.fragmentHint);var R=this.getNextPart(V,y,N);if(R>-1){var M=V[R];return this.log("Loading part sn: "+y.sn+" p: "+M.index+" cc: "+y.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+R+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,part:V[R],targetBufferTime:N}),this.doFragPartsLoad(y,V,R,U).catch(function($){return K.handleFragLoadError($)})}else if(!y.url||this.loadedEndOfParts(V,N))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),Object(Z.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,targetBufferTime:N}),this.fragmentLoader.load(y,U).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(y,E,N,U){var K=this;return new Promise(function(V,R){var M=[],$=function ee(oe){var ce=E[oe];K.fragmentLoader.loadPart(y,ce,U).then(function(De){M[ce.index]=De;var Ee=De.part;K.hls.trigger(I.Events.FRAG_LOADED,De);var Ce=E[oe+1];if(Ce&&Ce.fragment===y)ee(oe+1);else return V({frag:y,part:Ee,partsLoaded:M})}).catch(R)};$(N)})},a.handleFragLoadError=function(y){var E=y.data;return E&&E.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(I.Events.ERROR,E),null},a._handleTransmuxerFlush=function(y){var E=this.getCurrentContext(y);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var N=E.frag,U=E.part,K=E.level,V=self.performance.now();N.stats.parsing.end=V,U&&(U.stats.parsing.end=V),this.updateLevelTiming(N,U,K,y.partial)},a.getCurrentContext=function(y){var E=this.levels,N=y.level,U=y.sn,K=y.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+N+". The current chunk will not be buffered."),null;var V=E[N],R=K>-1?Object(S.getPartWith)(V,U,K):null,M=R?R.fragment:Object(S.getFragmentWithSN)(V,U,this.fragCurrent);return M?{frag:M,part:R,level:V}:null},a.bufferFragmentData=function(y,E,N,U){if(!y||this.state!==b.PARSING)return;var K=y.data1,V=y.data2,R=K;if(K&&V&&(R=Object(A.appendUint8Array)(K,V)),!R||!R.length)return;var M={type:y.type,frag:E,part:N,chunkMeta:U,parent:E.type,data:R};this.hls.trigger(I.Events.BUFFER_APPENDING,M),y.dropped&&y.independent&&!N&&this.flushBufferGap(E)},a.flushBufferGap=function(y){var E=this.media;if(!E)return;if(!z.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,y.start);return}var N=E.currentTime,U=z.BufferHelper.bufferInfo(E,N,0),K=y.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),R=Math.max(Math.min(y.start-V,U.end-V),N+V);y.start-R>V&&this.flushMainBuffer(R,y.start)},a.getFwdBufferInfo=function(y,E){var N=this.config,U=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(U))return null;var K=z.BufferHelper.bufferInfo(y,U,N.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(U,E);if(V&&K.nextStart<V.end)return z.BufferHelper.bufferInfo(y,U,Math.max(K.nextStart,N.maxBufferHole))}return K},a.getMaxBufferLength=function(y){var E=this.config,N;return y?N=Math.max(8*E.maxBufferSize/y,E.maxBufferLength):N=E.maxBufferLength,Math.min(N,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var E=this.config,N=y||E.maxBufferLength;return E.maxMaxBufferLength>=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,E){var N,U,K=E.fragments,V=K.length;if(!V)return null;var R=this.config,M=K[0].start,$;if(E.live){var ee=R.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(E,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:y)}else y<=M&&($=K[0]);if(!$){var oe=R.lowLatencyMode?E.partEnd:E.fragmentEnd;$=this.getFragmentAtPosition(y,oe,E)}return(N=$)!==null&&N!==void 0&&N.initSegment&&!((U=$)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(y,E,N){for(var U=-1,K=!1,V=!0,R=0,M=y.length;R<M;R++){var $=y[R];if(V=V&&!$.independent,U>-1&&N<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===E&&(U=R),K=ee}return U},a.loadedEndOfParts=function(y,E){var N=y[y.length-1];return N&&E>N.start&&N.loaded},a.getInitialLiveFragment=function(y,E){var N=this.fragPrevious,U=null;if(N){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),U=Object(_.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var K=N.sn+1;if(K>=y.startSN&&K<=y.endSN){var V=E[K-y.startSN];N.cc===V.cc&&(U=V,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(_.findFragWithCC)(E,N.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var R=this.hls.liveSyncPosition;R!==null&&(U=this.getFragmentAtPosition(R,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},a.getFragmentAtPosition=function(y,E,N){var U=this.config,K=this.fragPrevious,V=N.fragments,R=N.endSN,M=N.fragmentHint,$=U.maxFragLookUpTolerance,ee=!!(U.lowLatencyMode&&N.partList&&M);ee&&M&&!this.bitrateTest&&(V=V.concat(M),R=M.sn);var oe;if(y<E){var ce=y>E-$?0:$;oe=Object(_.findFragmentByPTS)(K,V,y,ce)}else oe=V[V.length-1];if(oe){var De=oe.sn-N.startSN,Ee=K&&oe.level===K.level,Ce=V[De+1],Te=this.fragmentTracker.getState(oe);if(Te===P.FragmentState.BACKTRACKED){oe=null;for(var we=De;V[we]&&this.fragmentTracker.getState(V[we])===P.FragmentState.BACKTRACKED;)K?oe=V[we--]:oe=V[--we];oe||(oe=Ce)}else K&&oe.sn===K.sn&&!ee&&(Ee&&(oe.sn<R&&this.fragmentTracker.getState(Ce)!==P.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Ce.sn),oe=Ce):oe=null))}return oe},a.synchronizeToLiveEdge=function(y){var E=this.config,N=this.media;if(!N)return;var U=this.hls.liveSyncPosition,K=N.currentTime,V=y.fragments[0].start,R=y.edge,M=K>=V-E.maxFragLookUpTolerance&&K<=R;if(U!==null&&N.duration>U&&(K<U||!M)){var $=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*y.targetduration;(!M&&N.readyState<4||K<R-$)&&(this.loadedmetadata||(this.nextLoadPosition=U),N.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+R+", reset currentTime to : "+U.toFixed(3)),N.currentTime=U))}},a.alignPlaylists=function(y,E){var N=this.levels,U=this.levelLastLoaded,K=this.fragPrevious,V=U!==null?N[U]:null,R=y.fragments.length;if(!R)return this.warn("No fragments in live playlist"),0;var M=y.fragments[0].start,$=!E,ee=y.alignedSliding&&Object(Z.isFiniteNumber)(M);if($||!ee&&!M){Object(O.alignStream)(K,V,y);var oe=y.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+y.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+R),oe}return M},a.waitForCdnTuneIn=function(y){var E=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*E)},a.setStartPosition=function(y,E){var N=this.startPosition;if(N<E&&(N=-1),N===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(Z.isFiniteNumber)(U)?(N=E+U,U<0&&(N+=y.totalduration),N=Math.min(Math.max(E,N),E+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+N),this.startPosition=N):y.live?N=this.hls.liveSyncPosition||E:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},a.getLoadPosition=function(){var y=this.media,E=0;return this.loadedmetadata&&y?E=y.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(y,E){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(E?" part"+E.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(y,E){if(E.fatal)return;var N=E.frag;if(!N||N.type!==y)return;var U=this.fragCurrent;console.assert(U&&N.sn===U.sn&&N.level===U.level&&N.urlId===U.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+y+" "+N.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(j.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(y,E,N){if(!y)return;var U=z.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(E,U,N),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[y].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,E,N,U){var K=this,V=N.details;console.assert(!!V,"level.details must be defined");var R=Object.keys(y.elementaryStreams).reduce(function(M,$){var ee=y.elementaryStreams[$];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+y.sn+" "+$+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),M||!1;var ce=U?0:Object(S.updateFragPTSDTS)(V,y,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:V,level:N,drift:ce,type:$,frag:y,start:ee.startPTS,end:ee.endPTS}),!0}return M},!1);R?(this.state=b.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:y,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(u,[{key:"state",get:function(){return this._state},set:function(y){var E=this._state;E!==y&&(this._state=y,this.log(E+"->"+y))}}]),u}(B.default)},"./src/controller/buffer-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),z=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),k=D("./src/loader/fragment.ts"),v=D("./src/controller/buffer-operation-queue.ts"),A=Object(I.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function S(h){var o=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 l=o.hls,d=o.media,C=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:d})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var T=S.prototype;return T.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},T.destroy=function(){this.unregisterListeners(),this.details=null},T.registerListeners=function(){var o=this.hls;o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(B.Events.BUFFER_RESET,this.onBufferReset,this),o.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(B.Events.BUFFER_EOS,this.onBufferEos,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(B.Events.FRAG_PARSED,this.onFragParsed,this),o.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},T.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(B.Events.BUFFER_RESET,this.onBufferReset,this),o.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(B.Events.BUFFER_EOS,this.onBufferEos,this),o.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(B.Events.FRAG_PARSED,this.onFragParsed,this),o.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},T._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},T.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},T.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&A){var C=this.mediaSource=new A;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(C),this._objectUrl=d.src}},T.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){P.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(B.Events.MEDIA_DETACHED,void 0)},T.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(C){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},T.onBufferCodecs=function(o,l){var d=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(p){if(C){var f=d.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var L=l[p],b=L.codec,m=L.levelCodec,c=L.container,u=(f.levelCodec||f.codec).replace(O,"$1"),a=(m||b).replace(O,"$1");if(u!==a){var x=c+";codecs="+(m||b);d.appendChangeType(p,x)}}}else d.pendingTracks[p]=l[p]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},T.appendChangeType=function(o,l){var d=this,C=this.operationQueue,p={execute:function(){var L=d.sourceBuffer[o];L&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};C.append(p,o)},T.onBufferAppending=function(o,l){var d=this,C=this.hls,p=this.operationQueue,f=this.tracks,L=l.data,b=l.type,m=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[b],x=self.performance.now();a.start=x;var y=m.stats.buffering,E=c?c.stats.buffering:null;y.start===0&&(y.start=x),E&&E.start===0&&(E.start=x);var N=f.audio,U=b==="audio"&&u.id===1&&(N==null?void 0:N.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),U){var R=d.sourceBuffer[b];if(R){var M=m.start-R.timestampOffset;Math.abs(M)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+M+") sn: "+m.sn+")"),R.timestampOffset=m.start)}}d.appendExecutor(L,b)},onStart:function(){},onComplete:function(){var R=self.performance.now();a.executeEnd=a.end=R,y.first===0&&(y.first=R),E&&E.first===0&&(E.first=R);var M=d.sourceBuffer,$={};for(var ee in M)$[ee]=j.BufferHelper.getBuffered(M[ee]);d.appendError=0,d.hls.trigger(B.Events.BUFFER_APPENDED,{type:b,frag:m,part:c,chunkMeta:u,parent:m.type,timeRanges:$})},onError:function(R){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",R);var M={type:z.ErrorTypes.MEDIA_ERROR,parent:m.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:R,fatal:!1};R.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=z.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,M.details=z.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>C.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),C.trigger(B.Events.ERROR,M)}};p.append(K,b)},T.onBufferFlushing=function(o,l){var d=this,C=this.operationQueue,p=function(L){return{execute:d.removeExecutor.bind(d,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(B.Events.BUFFER_FLUSHED,{type:L})},onError:function(m){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",m)}}};l.type?C.append(p(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){C.append(p(f),f)})},T.onFragParsed=function(o,l){var d=this,C=l.frag,p=l.part,f=[],L=p?p.elementaryStreams:C.elementaryStreams;L[k.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(L[k.ElementaryStreamTypes.AUDIO]&&f.push("audio"),L[k.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();C.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var u=p?p.stats:C.stats;d.hls.trigger(B.Events.FRAG_BUFFERED,{frag:C,part:p,stats:u,id:C.type})};f.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(b,f)},T.onFragChanged=function(o,l){this.flushBackBuffer()},T.onBufferEos=function(o,l){var d=this,C=this.getSourceBufferTypes().reduce(function(p,f){var L=d.sourceBuffer[f];return(!l.type||l.type===f)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!L||L.ended)},!0);C&&this.blockBuffers(function(){var p=d.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},T.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},T.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,C=this.sourceBuffer;if(!d||l===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(f)||f<0)return;var L=d.currentTime,b=l.levelTargetDuration,m=Math.max(f,b),c=Math.floor(L/b)*b-m;p.forEach(function(u){var a=C[u];if(a){var x=j.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},T.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,C=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=d.duration,L=Object(Z.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(p>L&&p>f||!Object(Z.isFiniteNumber)(f))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),C.duration=p)},T.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,C=d.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var p=Math.max(0,d[0].start),f=Math.max(p,p+o.totalduration);l.setLiveSeekableRange(p,f)}},T.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,C=Object.keys(d).length;if(C&&!o||C===2){this.createSourceBuffers(d),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(B.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){l.executeNext(f)})}},T.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var p in o)if(!l[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var L=f.levelCodec||f.codec,b=f.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var m=l[p]=d.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:m,codec:L,container:f.container,levelCodec:f.levelCodec,id:f.id},C++}catch(u){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(B.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:b})}}C&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},T._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},T._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},T._onSBUpdateError=function(o,l){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},T.removeExecutor=function(o,l,d){var C=this.media,p=this.mediaSource,f=this.operationQueue,L=this.sourceBuffer,b=L[o];if(!C||!p||!b){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var m=Object(Z.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(Z.isFiniteNumber)(p.duration)?p.duration:Infinity,u=Math.max(0,l),a=Math.min(d,m,c);a>u?(P.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(u,a)):f.shiftAndExecuteNext(o)},T.appendExecutor=function(o,l){var d=this.operationQueue,C=this.sourceBuffer,p=C[l];if(!p){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}p.ended=!1,console.assert(!p.updating,l+" sourceBuffer must not be updating"),p.appendBuffer(o)},T.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,p=l.map(function(f){return C.appendBlocker(f)});Promise.all(p).then(function(){o(),l.forEach(function(f){var L=d.sourceBuffer[f];(!L||!L.updating)&&C.shiftAndExecuteNext(f)})})},T.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},T.addBufferListener=function(o,l,d){var C=this.sourceBuffer[o];if(!C)return;var p=d.bind(this,o);this.listeners[o].push({event:l,listener:p}),C.addEventListener(l,p)},T.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return B});var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var z=P.prototype;return z.append=function(I,k){var v=this.queues[k];v.push(I),v.length===1&&this.buffers[k]&&this.executeNext(k)},z.insertAbort=function(I,k){var v=this.queues[k];v.unshift(I),this.executeNext(k)},z.appendBlocker=function(I){var k,v=new Promise(function(O){k=O}),A={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,I),v},z.executeNext=function(I){var k=this.buffers,v=this.queues,A=k[I],O=v[I];if(O.length){var _=O[0];try{_.execute()}catch(S){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(S),(!A||!A.updating)&&(O.shift(),this.executeNext(I))}}},z.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},z.current=function(I){return this.queues[I][0]},P}()},"./src/controller/cap-level-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts");function B(j,I){for(var k=0;k<I.length;k++){var v=I[k];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(j,v.key,v)}}function P(j,I,k){return I&&B(j.prototype,I),k&&B(j,k),j}var z=function(){function j(k){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=k,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=j.prototype;return I.setStreamController=function(v){this.streamController=v},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var v=this.hls;v.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var v=this.hls;v.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(v,A){j.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},I.onMediaAttaching=function(v,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},I.onManifestParsed=function(v,A){var O=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onBufferCodecs=function(v,A){var O=this.hls;O.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(v.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},I.getMaxLevel=function(v){var A=this,O=this.hls.levels;if(!O.length)return-1;var _=O.filter(function(S,T){return j.isLevelAllowed(T,A.restrictedLevels)&&T<=v});return this.clientRect=null,j.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},I.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,A={width:0,height:0};if(v){var O=v.getBoundingClientRect();A.width=O.width,A.height=O.height,!A.width&&!A.height&&(A.width=O.right-O.left||v.width||0,A.height=O.bottom-O.top||v.height||0)}return this.clientRect=A,A},j.isLevelAllowed=function(v,A){return A===void 0&&(A=[]),A.indexOf(v)===-1},j.getMaxLevelByMediaSize=function(v,A,O){if(!v||!v.length)return-1;for(var _=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},S=v.length-1,T=0;T<v.length;T+=1){var h=v[T];if((h.width>=A||h.height>=O)&&_(h,v[T+1])){S=T;break}}return S},P(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(A){}return v}}]),j}();Q.default=z},"./src/controller/cmcd-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/events.ts"),B=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),z=D("./src/utils/logger.ts");function j(S,T){for(var h=0;h<T.length;h++){var o=T[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function I(S,T,h){return T&&j(S.prototype,T),h&&j(S,h),S}function k(S,T){var h=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(h)return(h=h.call(S)).next.bind(h);if(Array.isArray(S)||(h=v(S))||T&&S&&typeof S.length=="number"){h&&(S=h);var o=0;return function(){return o>=S.length?{done:!0}:{done:!1,value:S[o++]}}}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 v(S,T){if(!S)return;if(typeof S=="string")return A(S,T);var h=Object.prototype.toString.call(S).slice(8,-1);if(h==="Object"&&S.constructor&&(h=S.constructor.name),h==="Map"||h==="Set")return Array.from(S);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return A(S,T)}function A(S,T){(T==null||T>S.length)&&(T=S.length);for(var h=0,o=new Array(T);h<T;h++)o[h]=S[h];return o}function O(){return O=Object.assign||function(S){for(var T=1;T<arguments.length;T++){var h=arguments[T];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(S[o]=h[o])}return S},O.apply(this,arguments)}var _=function(){function S(h){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(C){try{o.apply(C,{ot:B.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){z.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(C){try{var p=C.frag,f=o.hls.levels[p.level],L=o.getObjectType(p),b={d:p.duration*1e3,ot:L};(L===B.CMCDObjectType.VIDEO||L===B.CMCDObjectType.AUDIO||L==B.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(L),b.bl=o.getBufferLength(L)),o.apply(C,b)}catch(m){z.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=h;var l=this.config=h.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||S.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var T=S.prototype;return T.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},T.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},T.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},T.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},T.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},T.onBufferCreated=function(o,l){var d,C;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},T.createData=function(){var o;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},T.apply=function(o,l){l===void 0&&(l={}),O(l,this.createData());var d=l.ot===B.CMCDObjectType.INIT||l.ot===B.CMCDObjectType.VIDEO||l.ot===B.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=S.toHeaders(l);if(!Object.keys(C).length)return;o.headers||(o.headers={}),O(o.headers,C)}else{var p=S.toQuery(l);if(!p)return;o.url=S.appendQueryToUri(o.url,p)}},T.getObjectType=function(o){var l=o.type;return l==="subtitle"?B.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?B.CMCDObjectType.INIT:l==="audio"?B.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},T.getTopBandwidth=function(o){for(var l=0,d=o===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=k(d),p;!(p=C()).done;){var f=p.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},T.getBufferLength=function(o){var l=this.hls.media,d=o===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var C=P.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return C.len*1e3},T.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new d(f)}var p=C.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,b,m){l(L),this.loader.load(L,b,m)},I(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},T.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new d(f)}var p=C.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,b,m){l(L),this.loader.load(L,b,m)},I(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},S.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},S.serialize=function(o){for(var l=[],d=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},C=function(U){return Math.round(U)},p=function(U){return C(U/100)*100},f=function(U){return encodeURIComponent(U)},L={br:C,d:C,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:C},b=Object.keys(o||{}).sort(),m=k(b),c;!(c=m()).done;){var u=c.value,a=o[u];if(!d(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var x=L[u];x&&(a=x(a));var y=typeof a,E=void 0;u==="ot"||u==="sf"||u==="st"?E=u+"="+a:y==="boolean"?E=u:y==="number"?E=u+"="+a:E=u+"="+JSON.stringify(a),l.push(E)}return l.join(",")},S.toHeaders=function(o){for(var l=Object.keys(o),d={},C=["Object","Request","Session","Status"],p=[{},{},{},{}],f={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},L=0,b=l;L<b.length;L++){var m=b[L],c=f[m]!=null?f[m]:1;p[c][m]=o[m]}for(var u=0;u<p.length;u++){var a=S.serialize(p[u]);a&&(d["CMCD-"+C[u]]=a)}return d},S.toQuery=function(o){return"CMCD="+encodeURIComponent(S.serialize(o))},S.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},S}()},"./src/controller/eme-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),z=D("./src/utils/mediakeys-helper.ts");function j(_,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function I(_,S,T){return S&&j(_.prototype,S),T&&j(_,T),_}var k=3,v=function(S,T,h){var o={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),T.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},A=function(S,T,h,o){switch(S){case z.KeySystems.WIDEVINE:return v(T,h,o);default:throw new Error("Unknown key-system: "+S)}},O=function(){function _(T){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=T,this._config=T.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=_.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(h){switch(h){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},S._attemptKeySystemAccess=function(h,o,l){var d=this,C=A(h,o,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(h,C);this.mediaKeysPromise=p.then(function(f){return d._onMediaKeySystemAccessObtained(h,f)}),p.catch(function(f){P.logger.error('Failed to obtain key-system "'+h+'" access:',f)})},S._onMediaKeySystemAccessObtained=function(h,o){var l=this;P.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return d.mediaKeys=p,P.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),p});return C.catch(function(p){P.logger.error("Failed to create media-keys:",p)}),C},S._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},S._onNewMediaKeySession=function(h){var o=this;P.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},S._onKeySessionMessage=function(h,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},S.onMediaEncrypted=function(h){var o=this;if(P.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},S._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(h,o){var l=this,d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var C=d.mediaKeysSession;if(!C){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,C.generateRequest(h,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(p){P.logger.error("Error generating key-session request:",p),l.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(h,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,d,h),C=void 0}catch(p){P.logger.error(p)}try{d.readyState||d.open("POST",h,!0),C&&C.call(this.hls,d,h)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return d},S._onLicenseRequestReadyStageChange=function(h,o,l,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var C=h.response,p=this._licenseResponseCallback;if(p)try{C=p.call(this.hls,h,o)}catch(L){P.logger.error(L)}d(C)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>k){this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=k-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,d)}break}},S._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},S._requestLicense=function(h,o){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(d,h,o);P.logger.log("Sending license request to URL: "+d);var p=this._generateLicenseRequestChallenge(l,h);C.send(p)}catch(f){P.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),d=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,l,d)},I(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();Q.default=O},"./src/controller/fps-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=function(){function z(I){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=I,this.registerListeners()}var j=z.prototype;return j.setStreamController=function(k){this.streamController=k},j.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(k,v){var A=this.hls.config;if(A.capLevelOnFPSDrop){var O=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(k,v,A){var O=performance.now();if(v){if(this.lastTime){var _=O-this.lastTime,S=A-this.lastDroppedFrames,T=v-this.lastDecodedFrames,h=1e3*S/_,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:S,currentDecoded:T,totalDroppedFrames:A}),h>0&&S>o.config.fpsDroppedMonitoringThreshold*T){var l=o.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=A,this.lastDecodedFrames=v}},j.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var v=k.getVideoPlaybackQuality();this.checkFPS(k,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},z}();Q.default=P},"./src/controller/fragment-finders.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"findFragmentByPDT",function(){return P}),D.d(Q,"findFragmentByPTS",function(){return z}),D.d(Q,"fragmentWithinToleranceTest",function(){return j}),D.d(Q,"pdtWithinToleranceTest",function(){return I}),D.d(Q,"findFragWithCC",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/binary-search.ts");function P(v,A,O){if(A===null||!Array.isArray(v)||!v.length||!Object(Z.isFiniteNumber)(A))return null;var _=v[0].programDateTime;if(A<(_||0))return null;var S=v[v.length-1].endProgramDateTime;if(A>=(S||0))return null;O=O||0;for(var T=0;T<v.length;++T){var h=v[T];if(I(A,O,h))return h}return null}function z(v,A,O,_){O===void 0&&(O=0),_===void 0&&(_=0);var S=null;if(v?S=A[v.sn-A[0].sn+1]||null:O===0&&A[0].start===0&&(S=A[0]),S&&j(O,_,S)===0)return S;var T=B.default.search(A,j.bind(null,O,_));return T||S}function j(v,A,O){v===void 0&&(v=0),A===void 0&&(A=0);var _=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-_<=v?1:O.start-_>v&&O.start?-1:0}function I(v,A,O){var _=Math.min(A,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,S=O.endProgramDateTime||0;return S-_>v}function k(v,A){return B.default.search(v,function(O){return O.cc<A?1:O.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"FragmentState",function(){return P}),D.d(Q,"FragmentTracker",function(){return z});var Z=D("./src/events.ts"),B=D("./src/types/loader.ts"),P;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(P||(P={}));var z=function(){function k(A){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=A,this._registerListeners()}var v=k.prototype;return v._registerListeners=function(){var O=this.hls;O.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var O=this.hls;O.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(O,_){if(_===B.PlaylistLevelType.MAIN){var S=this.activeFragment,T=this.activeParts;if(!S)return null;if(T)for(var h=T.length;h--;){var o=T[h],l=o?o.end:S.appendedPTS;if(o.start<=O&&l!==void 0&&O<=l)return h>9&&(this.activeParts=T.slice(h-9)),o}else if(S.start<=O&&S.appendedPTS!==void 0&&O<=S.appendedPTS)return S}return this.getBufferedFrag(O,_)},v.getBufferedFrag=function(O,_){for(var S=this.fragments,T=Object.keys(S),h=T.length;h--;){var o=S[T[h]];if((o==null?void 0:o.body.type)===_&&o.buffered){var l=o.body;if(l.start<=O&&O<=l.end)return l}}return null},v.detectEvictedFragments=function(O,_,S){var T=this;Object.keys(this.fragments).forEach(function(h){var o=T.fragments[h];if(!o)return;if(!o.buffered){o.body.type===S&&T.removeFragment(o.body);return}var l=o.range[O];if(!l)return;l.time.some(function(d){var C=!T.isTimeBuffered(d.startPTS,d.endPTS,_);return C&&T.removeFragment(o.body),C})})},v.detectPartialFragments=function(O){var _=this,S=this.timeRanges,T=O.frag,h=O.part;if(!S||T.sn==="initSegment")return;var o=I(T),l=this.fragments[o];if(!l)return;Object.keys(S).forEach(function(d){var C=T.elementaryStreams[d];if(!C)return;var p=S[d],f=h!==null||C.partial===!0;l.range[d]=_.getBufferedTimes(T,h,f,p)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},v.fragBuffered=function(O){var _=I(O),S=this.fragments[_];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},v.getBufferedTimes=function(O,_,S,T){for(var h={time:[],partial:S},o=_?_.start:O.start,l=_?_.end:O.end,d=O.minEndPTS||l,C=O.maxStartPTS||o,p=0;p<T.length;p++){var f=T.start(p)-this.bufferPadding,L=T.end(p)+this.bufferPadding;if(C>=f&&d<=L){h.time.push({startPTS:Math.max(o,T.start(p)),endPTS:Math.min(l,T.end(p))});break}else if(o<L&&l>f)h.partial=!0,h.time.push({startPTS:Math.max(o,T.start(p)),endPTS:Math.min(l,T.end(p))});else if(l<=f)break}return h},v.getPartialFragment=function(O){var _=null,S,T,h,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(C){var p=d[C];if(!p)return;j(p)&&(T=p.body.start-l,h=p.body.end+l,O>=T&&O<=h&&(S=Math.min(O-T,h-O),o<=S&&(_=p.body,o=S)))}),_},v.getState=function(O){var _=I(O),S=this.fragments[_];return S?S.buffered?j(S)?P.PARTIAL:P.OK:S.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},v.backtrack=function(O,_){var S=I(O),T=this.fragments[S];if(!T||T.backtrack)return null;var h=T.backtrack=_||T.loaded;return T.loaded=null,h},v.getBacktrackData=function(O){var _=I(O),S=this.fragments[_];if(S){var T,h=S.backtrack;if(h!=null&&(T=h.payload)!==null&&T!==void 0&&T.byteLength)return h;this.removeFragment(O)}return null},v.isTimeBuffered=function(O,_,S){for(var T,h,o=0;o<S.length;o++){if(T=S.start(o)-this.bufferPadding,h=S.end(o)+this.bufferPadding,O>=T&&_<=h)return!0;if(_<=T)return!1}return!1},v.onFragLoaded=function(O,_){var S=_.frag,T=_.part;if(S.sn==="initSegment"||S.bitrateTest||T)return;var h=I(S);this.fragments[h]={body:S,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(O,_){var S=this,T=_.frag,h=_.part,o=_.timeRanges;if(T.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=T,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var C=o[d];if(S.detectEvictedFragments(d,C),!h)for(var p=0;p<C.length;p++)T.appendedPTS=Math.max(C.end(p),T.appendedPTS||0)})},v.onFragBuffered=function(O,_){this.detectPartialFragments(_)},v.hasFragment=function(O){var _=I(O);return!!this.fragments[_]},v.removeFragmentsInRange=function(O,_,S){var T=this;Object.keys(this.fragments).forEach(function(h){var o=T.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===S&&l.start<_&&l.end>O&&T.removeFragment(l)}})},v.removeFragment=function(O){var _=I(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[_]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function j(k){var v,A;return k.buffered&&(((v=k.range.video)===null||v===void 0?void 0:v.partial)||((A=k.range.audio)===null||A===void 0?void 0:A.partial))}function I(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(Q,"MAX_START_GAP_JUMP",function(){return I}),D.d(Q,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),D.d(Q,"SKIP_BUFFER_RANGE_START",function(){return v}),D.d(Q,"default",function(){return A});var Z=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts"),z=D("./src/utils/logger.ts"),j=250,I=2,k=.1,v=.05,A=function(){function O(S,T,h,o){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=T,this.fragmentTracker=h,this.hls=o}var _=O.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(T){var h=this.config,o=this.media,l=this.stalled,d=o.currentTime,C=o.seeking,p=this.seeking&&!C,f=!this.seeking&&C;if(this.seeking=C,d!==T){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;z.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var b=Z.BufferHelper.bufferInfo(o,d,0),m=b.len>0,c=b.nextStart||0;if(!m&&!c)return;if(C){var u=b.len>I,a=!c||c-d>I&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,b.start||0)-d,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((x=E.details)===null||x===void 0)?void 0:x.live,U=N?E.details.targetduration*2:I;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!C&&V>=j&&this._reportStall(b.len);var R=Z.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(R,V)},_._tryFixBufferStall=function(T,h){var o=this.config,l=this.fragmentTracker,d=this.media,C=d.currentTime,p=l.getPartialFragment(C);if(p){var f=this._trySkipBufferHole(p);if(f)return}T.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(T){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+T+")"),h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:T}))},_._trySkipBufferHole=function(T){for(var h=this.config,o=this.hls,l=this.media,d=l.currentTime,C=0,p=Z.BufferHelper.getBuffered(l),f=0;f<p.length;f++){var L=p.start(f);if(d+h.maxBufferHole>=C&&d<L){var b=Math.max(L+v,l.currentTime+k);return z.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,T&&o.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:T}),b}C=p.end(f)}return 0},_._tryNudgeBuffer=function(){var T=this.config,h=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<T.nudgeMaxRetry){var C=l+d*T.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+l+" to "+C),o.currentTime=C,h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+T.nudgeMaxRetry+" nudges"),h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),z=.25,j=function(){function I(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var k=I.prototype;return k.destroy=function(){this._unregisterListeners()},k._registerListeners=function(){var A=this.hls;A.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k._unregisterListeners=function(){var A=this.hls;A.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k.onMediaAttached=function(A,O){this.media=O.media},k.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},k.getID3Track=function(A){if(!this.media)return;for(var O=0;O<A.length;O++){var _=A[O];if(_.kind==="metadata"&&_.label==="id3")return Object(B.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},k.onFragParsingMetadata=function(A,O){if(!this.media)return;var _=O.frag,S=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var T=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<S.length;h++){var o=P.getID3Frames(S[h].data);if(o){var l=S[h].pts,d=h<S.length-1?S[h+1].pts:_.end,C=d-l;C<=0&&(d=l+z);for(var p=0;p<o.length;p++){var f=o[p];if(!P.isTimeStampFrame(f)){var L=new T(l,d,"");L.value=f,this.id3Track.addCue(L)}}}}},k.onBufferFlushing=function(A,O){var _=O.startOffset,S=O.endOffset,T=O.type;if(!T||T==="audio"){var h=this.id3Track;h&&Object(B.removeCuesInRange)(h,_,S)}},I}();Q.default=j},"./src/controller/latency-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/errors.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts");function z(k,v){for(var A=0;A<v.length;A++){var O=v[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(k,O.key,O)}}function j(k,v,A){return v&&z(k.prototype,v),A&&z(k,A),k}var I=function(){function k(A){var O=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 O.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var v=k.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},v.onMediaAttached=function(O,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(O,_){var S=_.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(O,_){if(_.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var O=this.media,_=this.levelDetails;if(!O||!_)return;this.currentTime=O.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var T=this.config,h=T.lowLatencyMode,o=T.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var d=S-l,C=Math.min(this.maxLatency,l+_.targetduration),p=d<C;if(_.live&&p&&d>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,L))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},v.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},v.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},j(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,_=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:_?O.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var _=O.holdBack,S=O.partHoldBack,T=O.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,d=h.lowLatencyMode,C=this.hls.userConfig,p=d&&S||_;(C.liveSyncDuration||C.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:l*T);var f=T,L=1;return p+Math.min(this.stallCount*L,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),_=this.targetLatency,S=this.levelDetails;if(O===null||_===null||S===null)return null;var T=S.edge,h=O-_-this.edgeStalled,o=T-S.totalduration,l=T-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(o,h),l)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var _=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-_,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,_=this.levelDetails;if(!O||!_)return 0;var S=O.buffered.length;return S?O.buffered.end(S-1):_.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return h});var Z=D("./src/types/level.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),z=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),k=D("./src/types/loader.ts");function v(){return v=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var C in d)Object.prototype.hasOwnProperty.call(d,C)&&(o[C]=d[C])}return o},v.apply(this,arguments)}function A(o,l){for(var d=0;d<l.length;d++){var C=l[d];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function O(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}function _(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,S(o,l)}function S(o,l){return S=Object.setPrototypeOf||function(C,p){return C.__proto__=p,C},S(o,l)}var T=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){_(l,o);function l(C){var p;return p=o.call(this,C,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var d=l.prototype;return d._registerListeners=function(){var p=this.hls;p.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(B.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var p=this.hls;p.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(B.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(p,f){var L=[],b=[],m=[],c,u={},a,x=!1,y=!1,E=!1;if(f.levels.forEach(function(V){var R=V.attrs;x=x||!!(V.width&&V.height),y=y||!!V.videoCodec,E=E||!!V.audioCodec,T&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var M=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=u[M],a?a.url.push(V.url):(a=new Z.Level(V),u[M]=a,L.push(a)),R&&(R.AUDIO&&Object(j.addGroupId)(a,"audio",R.AUDIO),R.SUBTITLES&&Object(j.addGroupId)(a,"text",R.SUBTITLES))}),(x||y)&&E&&(L=L.filter(function(V){var R=V.videoCodec,M=V.width,$=V.height;return!!R||!!(M&&$)})),L=L.filter(function(V){var R=V.audioCodec,M=V.videoCodec;return(!R||Object(z.isCodecSupportedInMp4)(R,"audio"))&&(!M||Object(z.isCodecSupportedInMp4)(M,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(V){return!V.audioCodec||Object(z.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(b)),f.subtitles&&(m=f.subtitles,Object(j.assignTrackIdsByGroup)(m)),L.length>0){c=L[0].bitrate,L.sort(function(V,R){return V.bitrate-R.bitrate}),this._levels=L;for(var N=0;N<L.length;N++)if(L[N].bitrate===c){this._firstLevel=N,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var U=E&&!y,K={levels:L,audioTracks:b,subtitleTracks:m,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:y,altAudio:!U&&b.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var L=f.context,b=this._levels[this.currentLevelIndex];if(L&&(L.type===k.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&L.groupId===b.audioGroupIds[b.urlId]||L.type===k.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&L.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,c=!0,u;switch(f.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=f.frag.level)):u=f.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),u=L.level),m=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:u=f.level,m=!0;break}u!==void 0&&this.recoverLevel(f,u,m,c)},d.recoverLevel=function(p,f,L,b){var m=p.details,c=this._levels[f];if(c.loadError++,L){var u=this.retryLoadingOrFail(p);if(u)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var x=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(m+": switch to "+x),p.levelRetry=!0,this.hls.nextAutoLevel=x)}}},d.redundantFailover=function(p){var f=this._levels[p],L=f.url.length;if(L>1){var b=(f.urlId+1)%L;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(m){m.urlId=b}),this.level=p}},d.onFragLoaded=function(p,f){var L=f.frag;if(L!==void 0&&L.type===k.PlaylistLevelType.MAIN){var b=this._levels[L.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(p,f){var L,b=f.level,m=f.details,c=this._levels[b];if(!c){var u;this.warn("Invalid level index "+b),(u=f.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(m.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(L=f.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(m.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(p,f){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var b=-1,m=this.hls.audioTracks[f.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===m){b=c;break}b!==L.urlId&&(L.urlId=b,this.startLoad())}},d.loadPlaylist=function(p){var f=this.currentLevelIndex,L=this._levels[f];if(this.canLoad&&L&&L.url.length>0){var b=L.urlId,m=L.url[b];if(p)try{m=p.addDirectives(m)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+m),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:m,level:f,id:b,deliveryDirectives:p||null})}},d.removeLevel=function(p,f){var L=function(c,u){return u!==f},b=this._levels.filter(function(m,c){return c!==p?!0:m.url.length>1&&f!==void 0?(m.url=m.url.filter(L),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(L)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(L)),m.urlId=0,!0):!1}).map(function(m,c){var u=m.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),m});this._levels=b,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:b})},O(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===p&&(f=L[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=L.length){var b=p<0;if(this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,L.length-1)}this.clearTimer();var m=this.currentLevelIndex,c=L[m],u=L[p];this.log("switching to level "+p+" from "+m),this.currentLevelIndex=p;var a=v({},u,{level:p,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,a);var x=u.details;if(!x||x.live){var y=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),l}(I.default)},"./src/controller/level-helper.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"addGroupId",function(){return P}),D.d(Q,"assignTrackIdsByGroup",function(){return z}),D.d(Q,"updatePTS",function(){return j}),D.d(Q,"updateFragPTSDTS",function(){return k}),D.d(Q,"mergeDetails",function(){return v}),D.d(Q,"mapPartIntersection",function(){return A}),D.d(Q,"mapFragmentIntersection",function(){return O}),D.d(Q,"adjustSliding",function(){return _}),D.d(Q,"addSliding",function(){return S}),D.d(Q,"computeReloadInterval",function(){return T}),D.d(Q,"getFragmentWithSN",function(){return h}),D.d(Q,"getPartWith",function(){return o});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts");function P(l,d,C){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function z(l){var d={};l.forEach(function(C){var p=C.groupId||"";C.id=d[p]=d[p]||0,d[p]++})}function j(l,d,C){var p=l[d],f=l[C];I(p,f)}function I(l,d){var C=d.startPTS;if(Object(Z.isFiniteNumber)(C)){var p=0,f;d.sn>l.sn?(p=C-l.start,f=l):(p=l.start-C,f=d),f.duration!==p&&(f.duration=p)}else if(d.sn>l.sn){var L=l.cc===d.cc;L&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function k(l,d,C,p,f,L){var b=p-C;b<=0&&(B.logger.warn("Fragment should have a positive duration",d),p=C+d.duration,L=f+d.duration);var m=C,c=p,u=d.startPTS,a=d.endPTS;if(Object(Z.isFiniteNumber)(u)){var x=Math.abs(u-C);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(x,d.deltaPTS):d.deltaPTS=x,m=Math.max(C,u),C=Math.min(C,u),f=Math.min(f,d.startDTS),c=Math.min(p,a),p=Math.max(p,a),L=Math.max(L,d.endDTS)}d.duration=p-C;var y=C-d.start;d.appendedPTS=p,d.start=d.startPTS=C,d.maxStartPTS=m,d.startDTS=f,d.endPTS=p,d.minEndPTS=c,d.endDTS=L;var E=d.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var N,U=E-l.startSN,K=l.fragments;for(K[U]=d,N=U;N>0;N--)I(K[N],K[N-1]);for(N=U;N<K.length-1;N++)I(K[N],K[N+1]);return l.fragmentHint&&I(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function v(l,d){for(var C=null,p=l.fragments,f=p.length-1;f>=0;f--){var L=p[f].initSegment;if(L){C=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,m;if(O(l,d,function(N,U){N.relurl&&(b=N.cc-U.cc),Object(Z.isFiniteNumber)(N.startPTS)&&Object(Z.isFiniteNumber)(N.endPTS)&&(U.start=U.startPTS=N.startPTS,U.startDTS=N.startDTS,U.appendedPTS=N.appendedPTS,U.maxStartPTS=N.maxStartPTS,U.endPTS=N.endPTS,U.endDTS=N.endDTS,U.minEndPTS=N.minEndPTS,U.duration=N.endPTS-N.startPTS,U.duration&&(m=U),d.PTSKnown=d.alignedSliding=!0),U.elementaryStreams=N.elementaryStreams,U.loader=N.loader,U.stats=N.stats,U.urlId=N.urlId,N.initSegment&&(U.initSegment=N.initSegment,C=N.initSegment)}),C){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(N){var U;(!N.initSegment||N.initSegment.relurl===((U=C)===null||U===void 0?void 0:U.relurl))&&(N.initSegment=C)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(N){return!N}),d.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=d.skippedSegments;u--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(l.partList,d.partList,function(N,U){U.elementaryStreams=N.elementaryStreams,U.stats=N.stats}),m?k(d,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):_(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var y=d.advancedDateTime;if(d.advanced&&y){var E=d.edge;d.driftStart||(d.driftStartTime=y,d.driftStart=E),d.driftEndTime=y,d.driftEnd=E}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function A(l,d,C){if(l&&d)for(var p=0,f=0,L=l.length;f<=L;f++){var b=l[f],m=d[f+p];b&&m&&b.index===m.index&&b.fragment.sn===m.fragment.sn?C(b,m):p--}}function O(l,d,C){for(var p=d.skippedSegments,f=Math.max(l.startSN,d.startSN)-d.startSN,L=(l.fragmentHint?1:0)+(p?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,b=d.startSN-l.startSN,m=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=f;u<=L;u++){var a=c[b+u],x=m[u];p&&!x&&u<p&&(x=d.fragments[u]=a),a&&x&&C(a,x)}}function _(l,d){var C=d.startSN+d.skippedSegments-l.startSN,p=l.fragments;if(C<0||C>=p.length)return;S(d,p[C].start)}function S(l,d){if(d){for(var C=l.fragments,p=l.skippedSegments;p<C.length;p++)C[p].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function T(l,d){var C=1e3*l.levelTargetDuration,p=C/2,f=l.age,L=f>0&&f<C*3,b=d.loading.end-d.loading.start,m,c=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;m=Math.max(Math.min(p,b*2),u),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=p;else L?(c=Math.min(c||C/2,f),l.availabilityDelay=c,m=c+C-f):m=C-b;return Math.round(m)}function h(l,d,C){if(!l||!l.details)return null;var p=l.details,f=p.fragments[d-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===d?f:d<p.startSN&&C&&C.sn===d?C:null)}function o(l,d,C){if(!l||!l.details)return null;var p=l.details.partList;if(p)for(var f=p.length;f--;){var L=p[f];if(L.index===C&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),z=D("./src/events.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),O=D("./src/types/transmuxer.ts"),_=D("./src/controller/gap-controller.ts"),S=D("./src/errors.ts"),T=D("./src/utils/logger.ts");function h(f,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function o(f,L,b){return L&&h(f.prototype,L),b&&h(f,b),f}function l(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,d(f,L)}function d(f,L){return d=Object.setPrototypeOf||function(m,c){return m.__proto__=c,m},d(f,L)}var C=100,p=function(f){l(L,f);function L(m,c){var u;return u=f.call(this,m,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var b=L.prototype;return b._registerListeners=function(){var c=this.hls;c.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(z.Events.ERROR,this.onError,this),c.on(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(z.Events.ERROR,this.onError,this),c.off(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,x=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var y,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,u,a=this.hls,x=this.levelLastLoaded,y=this.levels,E=this.media,N=a.config,U=a.nextLoadLevel;if(x===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var K=y[U];this.level=a.nextLoadLevel=U;var V=K.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==U){this.state=B.State.WAITING_LEVEL;return}var R=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,k.PlaylistLevelType.MAIN);if(R===null)return;var M=R.len,$=this.getMaxBufferLength(K.maxBitrate);if(M>=$)return;if(this._streamEnded(R,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,ee),this.state=B.State.ENDED;return}var oe=R.end,ce=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var De=ce.sn-V.startSN;De>1&&(ce=V.fragments[De-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===I.FragmentState.OK&&this.nextLoadPosition>oe){var Ee=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,Ee,k.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,V)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((c=ce.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=ce.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ce,V):this.loadFragment(ce,V,oe)},b.loadFragment=function(c,u,a){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===I.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else y=I.FragmentState.NOT_LOADED}y===I.FragmentState.NOT_LOADED||y===I.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,f.prototype.loadFragment.call(this,c,u,a)):y===I.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,k.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,k.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var y=this.hls.nextLoadLevel,E=c[y],N=this.fragLastKbps;N&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:a=0}else a=0;var U=this.getBufferedFrag(u.currentTime+a);if(U){var K=this.followingBufferedFrag(U);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,R=K.duration,M=Math.max(U.end,V+Math.min(Math.max(R-this.config.maxFragLookUpTolerance,R*.5),R*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,u){f.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},b.onMediaAttached=function(c,u){f.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new _.default(this.config,a,this.fragmentTracker,this.hls)},b.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),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(Z.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(z.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,u){var a=!1,x=!1,y;u.levels.forEach(function(E){y=E.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==B.State.IDLE)return;var x=a[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=B.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,u){var a,x=this.levels,y=u.level,E=u.details,N=E.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var U=this.fragCurrent;U&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=B.State.IDLE,U.loader.abort()));var K=x[y],V=0;if(E.live||(a=K.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;V=this.alignPlaylists(E,K.details)}if(K.details=E,this.levelLastLoaded=y,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:E,level:y}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=B.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,V),this.tick()},b._handleFragmentLoadProgress=function(c){var u,a=c.frag,x=c.part,y=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var N=E[a.level],U=N.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=N.videoCodec,V=U.PTSKnown||!U.live,R=(u=a.initSegment)===null||u===void 0?void 0:u.data,M=this._getAudioCodec(N),$=this.transmuxer=this.transmuxer||new A.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=x?x.index:-1,oe=ee!==-1,ce=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,ee,oe),De=this.initPTS[a.cc];$.push(y,R,M,K,a,x,U.totalduration,V,ce,De)},b.onAudioTrackSwitching=function(c,u){var a=this.altAudio,x=!!u.url,y=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;a&&N.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(c,u){var a=u.id,x=!!this.hls.audioTracks[a].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},b.onBufferCreated=function(c,u){var a=u.tracks,x,y,E=!1;for(var N in a){var U=a[N];if(U.id==="main"){if(y=N,x=U,N==="video"){var K=a[N];K&&(this.videoBuffer=K.buffer)}}else E=!0}E&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,u){var a=u.frag,x=u.part;if(a&&a.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var y=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},b.onError=function(c,u){switch(u.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(k.PlaylistLevelType.MAIN,u);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=B.State.ERROR):!u.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=j.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,u){var a=u.type;if(a!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,k.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,u){this.levels=u.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){T.logger.log("could not seek to "+a+", already seeking at "+u);return}var x=j.BufferHelper.getBuffered(c),y=x.length?x.start(0):0,E=y-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(T.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},b._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},b._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var x=u.hls;if(!a||x.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=B.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(z.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var u,a="main",x=this.hls,y=c.remuxResult,E=c.chunkMeta,N=this.getCurrentContext(E);if(!N){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var U=N.frag,K=N.part,V=N.level,R=y.video,M=y.text,$=y.id3,ee=y.initSegment,oe=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=B.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,U,E),x.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:ee.tracks}));var ce=ee.initPTS,De=ee.timescale;Object(Z.isFiniteNumber)(ce)&&(this.initPTS[U.cc]=ce,x.trigger(z.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ce,timescale:De}))}if(R&&y.independent!==!1){if(V.details){var Ee=R.startPTS,Ce=R.endPTS,Te=R.startDTS,we=R.endDTS;if(K)K.elementaryStreams[R.type]={startPTS:Ee,endPTS:Ce,startDTS:Te,endDTS:we};else if(R.firstKeyFrame&&R.independent&&(this.couldBacktrack=!0),R.dropped&&R.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Ee){this.backtrack(U);return}U.setElementaryStreamInfo(R.type,U.start,Ce,U.start,we,!0)}U.setElementaryStreamInfo(R.type,Ee,Ce,Te,we),this.bufferFragmentData(R,U,K,E)}}else if(y.independent===!1){this.backtrack(U);return}if(oe){var le=oe.startPTS,te=oe.endPTS,he=oe.startDTS,ie=oe.endDTS;K&&(K.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:te,startDTS:he,endDTS:ie}),U.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,le,te,he,ie),this.bufferFragmentData(oe,U,K,E)}if($!=null&&(u=$.samples)!==null&&u!==void 0&&u.length){var Ae={frag:U,id:a,samples:$.samples};x.trigger(z.Events.FRAG_PARSING_METADATA,Ae)}if(M){var Re={frag:U,id:a,samples:M.samples};x.trigger(z.Events.FRAG_PARSING_USERDATA,Re)}},b._bufferInitSegment=function(c,u,a,x){var y=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var E=u.audio,N=u.video,U=u.audiovideo;if(E){var K=c.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),E.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),c.audioCodec&&c.audioCodec!==K&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+K+'"'),E.levelCodec=K,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}N&&(N.levelCodec=c.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+N.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(R){var M=u[R],$=M.initSegment;$!=null&&$.byteLength&&y.hls.trigger(z.Events.BUFFER_APPENDING,{type:R,data:$,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=B.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(j.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):j.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var x=this.fragPlaying,y=u.level;(!x||u.sn!==x.sn||x.level!==y||u.urlId!==x.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==y)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=u)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"SubtitleStreamController",function(){return l});var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),z=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),v=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),O=D("./src/types/level.ts");function _(d,C){for(var p=0;p<C.length;p++){var f=C[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}function S(d,C,p){return C&&_(d.prototype,C),p&&_(d,p),d}function T(d,C){d.prototype=Object.create(C.prototype),d.prototype.constructor=d,h(d,C)}function h(d,C){return h=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},h(d,C)}var o=500,l=function(d){T(C,d);function C(f,L){var b;return b=d.call(this,f,L,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=C.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var L=this.hls;L.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(Z.Events.ERROR,this.onError,this),L.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var L=this.hls;L.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(Z.Events.ERROR,this.onError,this),L.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(L,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(L,b){var m=b.frag,c=b.success;if(this.fragPrevious=m,this.state=v.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,x=m.start,y=0;y<u.length;y++)if(x>=u[y].start&&x<=u[y].end){a=u[y];break}var E=m.start+m.duration;a?a.end=E:(a={start:x,end:E},u.push(a)),this.fragmentTracker.fragBuffered(m)},p.onBufferFlushing=function(L,b){var m=b.startOffset,c=b.endOffset;if(m===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var x=a[u].details,y=x.targetduration,E=c-y;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var U=0;U<N.length;){if(N[U].end<=E){N.shift();continue}else if(N[U].start<E)N[U].start=E;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,E,A.PlaylistLevelType.SUBTITLE)}},p.onError=function(L,b){var m,c=b.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},p.onSubtitleTracksUpdated=function(L,b){var m=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new O.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){m.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(L,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(L,b){var m,c=b.details,u=b.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[a];if(u>=x.length||u!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(m=y.details)!==null&&m!==void 0&&m.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!y.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(c,E):N&&Object(I.addSliding)(c,N.start);else{var U=this.alignPlaylists(c,y.details);U===0&&N&&Object(I.addSliding)(c,N.start)}}if(y.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var K=Object(z.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},p._handleFragmentLoadComplete=function(L){var b=L.frag,m=L.payload,c=b.decryptdata,u=this.hls;if(this.fragContextChanged(b))return;if(m&&m.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();u.trigger(Z.Events.FRAG_DECRYPTED,{frag:b,payload:x,stats:{tstart:a,tdecrypt:y}})})}},p.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var L,b=this.currentTrackId,m=this.levels;if(!m.length||!m[b]||!m[b].details)return;var c=m[b].details,u=c.targetduration,a=this.config,x=this.media,y=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,a.maxBufferHole),E=y.end,N=y.len,U=this.getMaxBufferLength()+u;if(N>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var K=c.fragments,V=K.length,R=c.edge,M,$=this.fragPrevious;if(E<R){var ee=a.maxFragLookUpTolerance;$&&c.hasProgramDateTime&&(M=Object(z.findFragmentByPDT)(K,$.endProgramDateTime,ee)),M||(M=Object(z.findFragmentByPTS)($,K,E,ee),!M&&$&&$.start<K[0].start&&(M=K[0]))}else M=K[V-1];(L=M)!==null&&L!==void 0&&L.encrypted?(B.logger.log("Loading key for "+M.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===k.FragmentState.NOT_LOADED&&this.loadFragment(M,c,E)}},p.loadFragment=function(L,b,m){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,b,m)},S(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(v.default)},"./src/controller/subtitle-track-controller.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),z=D("./src/types/loader.ts");function j(_,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function I(_,S,T){return S&&j(_.prototype,S),T&&j(_,T),_}function k(_,S){_.prototype=Object.create(S.prototype),_.prototype.constructor=_,v(_,S)}function v(_,S){return v=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},v(_,S)}var A=function(_){k(S,_);function S(h){var o;return o=_.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var T=S.prototype;return T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},T.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},T.onMediaAttached=function(o,l){if(this.media=l.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)},T.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},T.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 o=O(this.media.textTracks);o.forEach(function(l){Object(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},T.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},T.onSubtitleTrackLoaded=function(o,l){var d=l.id,C=l.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+d);return}var L=f.details;f.details=l.details,this.log("subtitle track "+d+" loaded ["+C.startSN+"-"+C.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,L))},T.onLevelLoading=function(o,l){this.switchLevel(l.level)},T.onLevelSwitching=function(o,l){this.switchLevel(l.level)},T.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=p;var f=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,L),f!==-1&&this.setSubtitleTrack(f,C)}},T.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var C=l[d];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},T.onError=function(o,l){if(_.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},T.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,C=l.groupId,p=l.url;if(o)try{p=o.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:d,groupId:C,deliveryDirectives:o||null})}},T.toggleTrackModes=function(o){var l=this,d=this.media,C=this.subtitleDisplay,p=this.trackId;if(!d)return;var f=O(d.textTracks),L=f.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var b=L[p];b&&(b.mode="disabled")}var m=L[o];m&&(m.mode=C?"showing":"hidden")},T.setSubtitleTrack=function(o,l){var d,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=C[o])!==null&&d!==void 0&&d.details)||o<-1||o>=C.length)return;this.clearTimer();var p=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,L=p.groupId,b=L===void 0?"":L,m=p.name,c=p.type,u=p.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:m,type:c,url:u});var a=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},T.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=O(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},I(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),S}(P.default);function O(_){for(var S=[],T=0;T<_.length;T++){var h=_[T];h.kind==="subtitles"&&h.label&&S.push(_[T])}return S}Q.default=A},"./src/controller/timeline-controller.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"TimelineController",function(){return O});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),z=D("./src/utils/output-filter.ts"),j=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),k=D("./src/utils/imsc1-ttml-parser.ts"),v=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),O=function(){function h(l){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=T(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.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 d=new z.default(this,"textTrack1"),C=new z.default(this,"textTrack2"),p=new z.default(this,"textTrack3"),f=new z.default(this,"textTrack4");this.cea608Parser1=new P.default(1,d,C),this.cea608Parser2=new P.default(3,p,f)}l.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(B.Events.FRAG_LOADING,this.onFragLoading,this),l.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(B.Events.FRAG_LOADING,this.onFragLoading,this),d.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,C,p,f,L){for(var b=!1,m=L.length;m--;){var c=L[m],u=S(c[0],c[1],C,p);if(u>=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],p),b=!0,u/(p-C)>.5))return}if(b||L.push([C,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,C,p,f)}else{var x=this.Cues.newCue(null,C,p,f);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:x,track:d})}},o.onInitPtsFound=function(d,C){var p=this,f=C.frag,L=C.id,b=C.initPTS,m=C.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=m),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){p.onFragLoaded(B.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var C=this.media;if(C)for(var p=0;p<C.textTracks.length;p++){var f=C.textTracks[p];if(f[d])return f}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var C=this.captionsProperties,p=this.captionsTracks,f=this.media,L=C[d],b=L.label,m=L.languageCode,c=this.getExistingTrack(d);if(c)p[d]=c,Object(I.clearCurrentCues)(p[d]),Object(I.sendAddTrackEvent)(p[d],f);else{var u=this.createTextTrack("captions",b,m);u&&(u[d]=!0,p[d]=u)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var C=this.captionsProperties[d];if(!C)return;var p=C.label,f={_id:d,label:p,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[d]=f,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(d,C,p){var f=this.media;return f?f.addTextTrack(d,C,p):void 0},o.onMediaAttaching=function(d,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(C){Object(I.clearCurrentCues)(d[C]),delete d[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),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())},o._cleanTracks=function(){var d=this.media;if(!d)return;var C=d.textTracks;if(C)for(var p=0;p<C.length;p++)Object(I.clearCurrentCues)(C[p])},o.onSubtitleTracksUpdated=function(d,C){var p=this;this.textTracks=[];var f=C.subtitleTracks||[],L=f.some(function(u){return u.textCodec===k.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var x;if(a<m.length){for(var y=null,E=0;E<m.length;E++)if(_(m[E],u)){y=m[E];break}y&&(x=y)}x?Object(I.clearCurrentCues)(x):(x=p.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,p.textTracks.push(x))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,C){var p=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(f){var L=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!L)return;var b="textTrack"+L[1],m=p.captionsProperties[b];if(!m)return;m.label=f.name,f.lang&&(m.languageCode=f.lang),m.media=f})},o.onFragLoading=function(d,C){var p=this.cea608Parser1,f=this.cea608Parser2,L=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(C.frag.type===v.PlaylistLevelType.MAIN){var m,c,u=C.frag.sn,a=(m=C==null||((c=C.part)===null||c===void 0)?void 0:c.index)!=null?m:-1;u===L+1||u===L&&a===b+1||(p.reset(),f.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(d,C){var p=C.frag,f=C.payload,L=this.initPTS,b=this.unparsedVttFrags;if(p.type===v.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(Z.isFiniteNumber)(L[p.cc])){b.push(C),L.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var m=p.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var c=this.tracks[p.level],u=this.vttCCs;u[p.cc]||(u[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===k.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,u)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,C){var p=this,f=this.hls;Object(k.parseIMSC1)(C,this.initPTS[d.cc],this.timescale[d.cc],function(L){p._appendCues(L,d.level),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){A.logger.log("Failed to parse IMSC1: "+L),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},o._parseVTTs=function(d,C,p){var f=this,L=this.hls;Object(j.parseWebVTT)(C,this.initPTS[d.cc],this.timescale[d.cc],p,d.cc,d.start,function(b){f._appendCues(b,d.level),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){f._fallbackToIMSC1(d,C),A.logger.log("Failed to parse VTT cue: "+b),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,C){var p=this,f=this.tracks[d.level];f.textCodec||Object(k.parseIMSC1)(C,this.initPTS[d.cc],this.timescale[d.cc],function(){f.textCodec=k.IMSC1_CODEC,p._parseIMSC1(d,C)},function(){f.textCodec="wvtt"})},o._appendCues=function(d,C){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[C];if(f.mode==="disabled")return;d.forEach(function(m){return Object(I.addCueToTrack)(f,m)})}else{var L=this.tracks[C],b=L.default?"default":"subtitles"+C;p.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,C){var p=C.frag;if(p.type===v.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(B.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,C){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var L=0;L<C.samples.length;L++){var b=C.samples[L].bytes;if(b){var m=this.extractCea608Data(b);p.addData(C.samples[L].pts,m[0]),f.addData(C.samples[L].pts,m[1])}}},o.onBufferFlushing=function(d,C){var p=C.startOffset,f=C.endOffset,L=C.endOffsetSubtitles,b=C.type,m=this.media;if(!m||m.currentTime<f)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(I.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(I.removeCuesInRange)(u[a],p,L)})}},o.extractCea608Data=function(d){for(var C=d[0]&31,p=2,f=[[],[]],L=0;L<C;L++){var b=d[p++],m=127&d[p++],c=127&d[p++],u=(4&b)!==0,a=3&b;if(m===0&&c===0)continue;u&&((a===0||a===1)&&(f[a].push(m),f[a].push(c)))}return f},h}();function _(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function S(h,o,l,d){return Math.min(o,d)-Math.max(h,l)}function T(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(z,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=j}var P=B.prototype;return P.decrypt=function(j,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,j)},B}()},"./src/crypt/aes-decryptor.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"removePadding",function(){return B}),D.d(Q,"default",function(){return P});var Z=D("./src/utils/typed-array.ts");function B(z){var j=z.byteLength,I=j&&new DataView(z.buffer).getUint8(j-1);return I?Object(Z.sliceUint8)(z,0,j-I):z}var P=function(){function z(){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 j=z.prototype;return j.uint8ArrayToUint32Array_=function(k){for(var v=new DataView(k),A=new Uint32Array(4),O=0;O<4;O++)A[O]=v.getUint32(O*4);return A},j.initTable=function(){var k=this.sBox,v=this.invSBox,A=this.subMix,O=A[0],_=A[1],S=A[2],T=A[3],h=this.invSubMix,o=h[0],l=h[1],d=h[2],C=h[3],p=new Uint32Array(256),f=0,L=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var m=L^L<<1^L<<2^L<<3^L<<4;m=m>>>8^m&255^99,k[f]=m,v[m]=f;var c=p[f],u=p[c],a=p[u],x=p[m]*257^m*16843008;O[f]=x<<24|x>>>8,_[f]=x<<16|x>>>16,S[f]=x<<8|x>>>24,T[f]=x,x=a*16843009^u*65537^c*257^f*16843008,o[m]=x<<24|x>>>8,l[m]=x<<16|x>>>16,d[m]=x<<8|x>>>24,C[m]=x,f?(f=c^p[p[p[a^c]]],L^=p[p[L]]):f=L=1}},j.expandKey=function(k){for(var v=this.uint8ArrayToUint32Array_(k),A=!0,O=0;O<v.length&&A;)A=v[O]===this.key[O],O++;if(A)return;this.key=v;var _=this.keySize=v.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var S=this.ksRows=(_+6+1)*4,T,h,o=this.keySchedule=new Uint32Array(S),l=this.invKeySchedule=new Uint32Array(S),d=this.sBox,C=this.rcon,p=this.invSubMix,f=p[0],L=p[1],b=p[2],m=p[3],c,u;for(T=0;T<S;T++){if(T<_){c=o[T]=v[T];continue}u=c,T%_===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=C[T/_|0]<<24):_>6&&T%_===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),o[T]=c=(o[T-_]^u)>>>0}for(h=0;h<S;h++)T=S-h,h&3?u=o[T]:u=o[T-4],h<4||T<=4?l[h]=u:l[h]=f[d[u>>>24]]^L[d[u>>>16&255]]^b[d[u>>>8&255]]^m[d[u&255]],l[h]=l[h]>>>0},j.networkToHostOrderSwap=function(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},j.decrypt=function(k,v,A){for(var O=this.keySize+6,_=this.invKeySchedule,S=this.invSBox,T=this.invSubMix,h=T[0],o=T[1],l=T[2],d=T[3],C=this.uint8ArrayToUint32Array_(A),p=C[0],f=C[1],L=C[2],b=C[3],m=new Int32Array(k),c=new Int32Array(m.length),u,a,x,y,E,N,U,K,V,R,M,$,ee,oe,ce=this.networkToHostOrderSwap;v<m.length;){for(V=ce(m[v]),R=ce(m[v+1]),M=ce(m[v+2]),$=ce(m[v+3]),E=V^_[0],N=$^_[1],U=M^_[2],K=R^_[3],ee=4,oe=1;oe<O;oe++)u=h[E>>>24]^o[N>>16&255]^l[U>>8&255]^d[K&255]^_[ee],a=h[N>>>24]^o[U>>16&255]^l[K>>8&255]^d[E&255]^_[ee+1],x=h[U>>>24]^o[K>>16&255]^l[E>>8&255]^d[N&255]^_[ee+2],y=h[K>>>24]^o[E>>16&255]^l[N>>8&255]^d[U&255]^_[ee+3],E=u,N=a,U=x,K=y,ee=ee+4;u=S[E>>>24]<<24^S[N>>16&255]<<16^S[U>>8&255]<<8^S[K&255]^_[ee],a=S[N>>>24]<<24^S[U>>16&255]<<16^S[K>>8&255]<<8^S[E&255]^_[ee+1],x=S[U>>>24]<<24^S[K>>16&255]<<16^S[E>>8&255]<<8^S[N&255]^_[ee+2],y=S[K>>>24]<<24^S[E>>16&255]<<16^S[N>>8&255]<<8^S[U&255]^_[ee+3],c[v]=ce(u^p),c[v+1]=ce(y^f),c[v+2]=ce(x^L),c[v+3]=ce(a^b),p=V,f=R,L=M,b=$,v=v+4}return c.buffer},z}()},"./src/crypt/decrypter.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return v});var Z=D("./src/crypt/aes-crypto.ts"),B=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),z=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),k=16,v=function(){function A(_,S,T){var h=T===void 0?{}:T,o=h.removePKCS7Padding,l=o===void 0?!0:o;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=_,this.config=S,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=A.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var T=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(T):T},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(S,T,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),T,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),T,h).then(o)},O.softwareDecrypt=function(S,T,h){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(S=Object(j.appendUint8Array)(d,S),this.remainderData=null);var C=this.getValidChunk(S);if(!C.length)return null;o&&(h=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new P.default),p.expandKey(T);var f=l;return this.currentResult=p.decrypt(C.buffer,0,h),this.currentIV=Object(I.sliceUint8)(C,-16).buffer,f||null},O.webCryptoDecrypt=function(S,T,h){var o=this,l=this.subtle;return(this.key!==T||!this.fastAesKey)&&(this.key=T,this.fastAesKey=new B.default(l,T)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new Z.default(l,h);return C.decrypt(S.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,S,T,h)})},O.onWebCryptoError=function(S,T,h,o){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(T,h,o)},O.getValidChunk=function(S){var T=S,h=S.length-S.length%k;return h!==S.length&&(T=Object(I.sliceUint8)(S,0,h),this.remainderData=Object(I.sliceUint8)(S,h)),T},O.logOnce=function(S){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(z,j){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=j}var P=B.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),z=D("./src/demux/id3.ts");function j(v,A){v.prototype=Object.create(A.prototype),v.prototype.constructor=v,I(v,A)}function I(v,A){return I=Object.setPrototypeOf||function(_,S){return _.__proto__=S,_},I(v,A)}var k=function(v){j(A,v);function A(_,S){var T;return T=v.call(this)||this,T.observer=void 0,T.config=void 0,T.observer=_,T.config=S,T}var O=A.prototype;return O.resetInitSegment=function(S,T,h){v.prototype.resetInitSegment.call(this,S,T,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var T=z.getID3Data(S,0)||[],h=T.length,o=S.length;h<o;h++)if(B.probe(S,h))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(S,T){return B.canParse(S,T)},O.appendFrame=function(S,T,h){B.initTrackConfig(S,this.observer,T,h,S.manifestCodec);var o=B.appendFrame(S,T,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Z.default);k.minProbeByteLength=9,Q.default=k},"./src/demux/adts.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"getAudioConfig",function(){return z}),D.d(Q,"isHeaderPattern",function(){return j}),D.d(Q,"getHeaderLength",function(){return I}),D.d(Q,"getFullFrameLength",function(){return k}),D.d(Q,"canGetFrameLength",function(){return v}),D.d(Q,"isHeader",function(){return A}),D.d(Q,"canParse",function(){return O}),D.d(Q,"probe",function(){return _}),D.d(Q,"initTrackConfig",function(){return S}),D.d(Q,"getFrameDuration",function(){return T}),D.d(Q,"parseFrameHeader",function(){return h}),D.d(Q,"appendFrame",function(){return o});var Z=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts");function z(l,d,C,p){var f,L,b,m,c=navigator.userAgent.toLowerCase(),u=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((d[C+2]&192)>>>6)+1;var x=(d[C+2]&60)>>>2;if(x>a.length-1){l.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return b=(d[C+2]&1)<<2,b|=(d[C+3]&192)>>>6,Z.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(f=5,m=new Array(4),L=x-3):(f=2,m=new Array(2),L=x):c.indexOf("android")!==-1?(f=2,m=new Array(2),L=x):(f=5,m=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&x>=6?L=x-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(x>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,m=new Array(2)),L=x)),m[0]=f<<3,m[0]|=(x&14)>>1,m[1]|=(x&1)<<7,m[1]|=b<<3,f===5&&(m[1]|=(L&14)>>1,m[2]=(L&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:a[x],channelCount:b,codec:"mp4a.40."+f,manifestCodec:u}}function j(l,d){return l[d]===255&&(l[d+1]&246)===240}function I(l,d){return l[d+1]&1?7:9}function k(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function v(l,d){return d+5<l.length}function A(l,d){return d+1<l.length&&j(l,d)}function O(l,d){return v(l,d)&&j(l,d)&&k(l,d)<=l.length-d}function _(l,d){if(A(l,d)){var C=I(l,d);if(d+C>=l.length)return!1;var p=k(l,d);if(p<=C)return!1;var f=d+p;return f===l.length||A(l,f)}return!1}function S(l,d,C,p,f){if(!l.samplerate){var L=z(d,C,p,f);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function T(l){return 1024*9e4/l}function h(l,d,C,p,f){var L=I(l,d),b=k(l,d);if(b-=L,b>0){var m=C+p*f;return{headerLength:L,frameLength:b,stamp:m}}}function o(l,d,C,p,f){var L=T(l.samplerate),b=h(d,C,p,f,L);if(b){var m=b.frameLength,c=b.headerLength,u=b.stamp,a=c+m,x=Math.max(0,C+a-d.length),y;x?(y=new Uint8Array(a-c),y.set(d.subarray(C+c,d.length),0)):y=d.subarray(C+c,C+a);var E={unit:y,pts:u};return x||l.samples.push(E),{sample:E,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"initPTSFn",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),z=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),I=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=v.prototype;return A.resetInitSegment=function(_,S,T){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(_,S){return!1},A.appendFrame=function(_,S,T){},A.demux=function(_,S){this.cachedData&&(_=Object(z.appendUint8Array)(this.cachedData,_),this.cachedData=null);var T=B.getID3Data(_,0),h=T?T.length:0,o,l,d=this._audioTrack,C=this._id3Track,p=T?B.getTimeStamp(T):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(p,S)),T&&T.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:T}),l=this.initPTS;h<f;){if(this.canParse(_,h)){var L=this.appendFrame(d,_,h);L?(this.frameIndex++,l=L.sample.pts,h+=L.length,o=h):h=f}else B.canParse(_,h)?(T=B.getID3Data(_,h),C.samples.push({pts:l,dts:l,data:T}),h+=T.length,o=h):h++;if(h===f&&o!==f){var b=Object(j.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(P.dummyTrack)(),id3Track:C,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(_,S,T){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(_){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},v}(),k=function(A,O){return Object(Z.isFiniteNumber)(A)?A*90:O*9e4};Q.default=I},"./src/demux/chunk-cache.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function P(){this.chunks=[],this.dataLength=0}var z=P.prototype;return z.push=function(I){this.chunks.push(I),this.dataLength+=I.length},z.flush=function(){var I=this.chunks,k=this.dataLength,v;if(I.length)I.length===1?v=I[0]:v=B(I,k);else return new Uint8Array(0);return this.reset(),v},z.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function B(P,z){for(var j=new Uint8Array(z),I=0,k=0;k<P.length;k++){var v=P[k];j.set(v,I),I+=v.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var z=P.prototype;return z.loadWord=function(){var I=this.data,k=this.bytesAvailable,v=I.byteLength-k,A=new Uint8Array(4),O=Math.min(4,k);if(O===0)throw new Error("no bytes available");A.set(I.subarray(v,v+O)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},z.skipBits=function(I){var k;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,k=I>>3,I-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},z.readBits=function(I){var k=Math.min(this.bitsAvailable,I),v=this.word>>>32-k;return I>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=I-k,k>0&&this.bitsAvailable?v<<k|this.readBits(k):v},z.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},z.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},z.readBoolean=function(){return this.readBits(1)===1},z.readUByte=function(){return this.readBits(8)},z.readUShort=function(){return this.readBits(16)},z.readUInt=function(){return this.readBits(32)},z.skipScalingList=function(I){for(var k=8,v=8,A,O=0;O<I;O++)v!==0&&(A=this.readEG(),v=(k+A+256)%256),k=v===0?k:v},z.readSPS=function(){var I=0,k=0,v=0,A=0,O,_,S,T=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),C=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);T();var L=T();if(h(5),d(3),T(),p(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var b=o();if(b===3&&d(1),p(),p(),d(1),l())for(_=b!==3?8:12,S=0;S<_;S++)l()&&(S<6?f(16):f(64))}p();var m=o();if(m===0)o();else if(m===1)for(d(1),C(),C(),O=o(),S=0;S<O;S++)C();p(),d(1);var c=o(),u=o(),a=h(1);a===0&&d(1),d(1),l()&&(I=o(),k=o(),v=o(),A=o());var x=[1,1];if(l()&&l()){var y=T();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[T()<<8|T(),T()<<8|T()];break}}}return{width:Math.ceil((c+1)*16-I*2-k*2),height:(2-a)*(u+1)*16-(a?2:4)*(v+A),pixelRatio:x}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();Q.default=B},"./src/demux/id3.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"isHeader",function(){return Z}),D.d(Q,"isFooter",function(){return B}),D.d(Q,"getID3Data",function(){return P}),D.d(Q,"canParse",function(){return j}),D.d(Q,"getTimeStamp",function(){return I}),D.d(Q,"isTimeStampFrame",function(){return k}),D.d(Q,"getID3Frames",function(){return A}),D.d(Q,"decodeFrame",function(){return O}),D.d(Q,"utf8ArrayToStr",function(){return o}),D.d(Q,"testables",function(){return l});var Z=function(f,L){return L+10<=f.length&&(f[L]===73&&f[L+1]===68&&f[L+2]===51&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},B=function(f,L){return L+10<=f.length&&(f[L]===51&&f[L+1]===68&&f[L+2]===73&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},P=function(f,L){for(var b=L,m=0;Z(f,L);){m+=10;var c=z(f,L+6);m+=c,B(f,L+10)&&(m+=10),L+=m}return m>0?f.subarray(b,b+m):void 0},z=function(f,L){var b=0;return b=(f[L]&127)<<21,b|=(f[L+1]&127)<<14,b|=(f[L+2]&127)<<7,b|=f[L+3]&127,b},j=function(f,L){return Z(f,L)&&z(f,L+6)+10<=f.length-L},I=function(f){for(var L=A(f),b=0;b<L.length;b++){var m=L[b];if(k(m))return h(m)}return},k=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},v=function(f){var L=String.fromCharCode(f[0],f[1],f[2],f[3]),b=z(f,4),m=10;return{type:L,size:b,data:f.subarray(m,m+b)}},A=function(f){for(var L=0,b=[];Z(f,L);){var m=z(f,L+6);L+=10;for(var c=L+m;L+8<c;){var u=v(f.subarray(L)),a=O(u);a&&b.push(a),L+=u.size+10}B(f,L)&&(L+=10)}return b},O=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?T(f):S(f)},_=function(f){if(f.size<2)return;var L=o(f.data,!0),b=new Uint8Array(f.data.subarray(L.length+1));return{key:f.type,info:L,data:b.buffer}},S=function(f){if(f.size<2)return;if(f.type==="TXXX"){var L=1,b=o(f.data.subarray(L),!0);L+=b.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:b,data:m}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},T=function(f){if(f.type==="WXXX"){if(f.size<2)return;var L=1,b=o(f.data.subarray(L),!0);L+=b.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:b,data:m}}var c=o(f.data);return{key:f.type,data:c}},h=function(f){if(f.data.byteLength===8){var L=new Uint8Array(f.data),b=L[3]&1,m=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return m/=45,b&&(m+=4772185884e-2),Math.round(m)}return},o=function(f,L){L===void 0&&(L=!1);var b=C();if(b){var m=b.decode(f);if(L){var c=m.indexOf("\0");return c!==-1?m.substring(0,c):m}return m.replace(/\0/g,"")}for(var u=f.length,a,x,y,E="",N=0;N<u;){if(a=f[N++],a===0&&L)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:x=f[N++],E+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=f[N++],y=f[N++],E+=String.fromCharCode((a&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return E},l={decodeTextFrame:S},d;function C(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),z=D("./src/demux/mpegaudio.ts");function j(v,A){v.prototype=Object.create(A.prototype),v.prototype.constructor=v,I(v,A)}function I(v,A){return I=Object.setPrototypeOf||function(_,S){return _.__proto__=S,_},I(v,A)}var k=function(v){j(A,v);function A(){return v.apply(this,arguments)||this}var O=A.prototype;return O.resetInitSegment=function(S,T,h){v.prototype.resetInitSegment.call(this,S,T,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var T=B.getID3Data(S,0)||[],h=T.length,o=S.length;h<o;h++)if(z.probe(S,h))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(S,T){return z.canParse(S,T)},O.appendFrame=function(S,T,h){return this.initPTS===null?void 0:z.appendFrame(S,T,h,this.initPTS,this.frameIndex)},A}(Z.default);k.minProbeByteLength=4,Q.default=k},"./src/demux/mp4demuxer.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function z(I,k){this.remainderData=null,this.config=void 0,this.config=k}var j=z.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},z.probe=function(k){return Object(Z.findBox)({data:k,start:0,end:Math.min(k.length,16384)},["moof"]).length>0},j.demux=function(k){var v=k,A=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(Z.appendUint8Array)(this.remainderData,k));var O=Object(Z.segmentValidRange)(v);this.remainderData=O.remainder,A.samples=O.valid||new Uint8Array}else A.samples=v;return{audioTrack:Object(B.dummyTrack)(),avcTrack:A,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.flush=function(){var k=Object(B.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:k,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.demuxSampleAes=function(k,v,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},z}();P.minProbeByteLength=1024,Q.default=P},"./src/demux/mpegaudio.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"appendFrame",function(){return I}),D.d(Q,"parseHeader",function(){return k}),D.d(Q,"isHeaderPattern",function(){return v}),D.d(Q,"isHeader",function(){return A}),D.d(Q,"canParse",function(){return O}),D.d(Q,"probe",function(){return _});var Z=null,B=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],z=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function I(S,T,h,o,l){if(h+24>T.length)return;var d=k(T,h);if(d&&h+d.frameLength<=T.length){var C=d.samplesPerFrame*9e4/d.sampleRate,p=o+l*C,f={unit:T.subarray(h,h+d.frameLength),pts:p,dts:p};return S.config=[],S.channelCount=d.channelCount,S.samplerate=d.sampleRate,S.samples.push(f),{sample:f,length:d.frameLength,missing:0}}}function k(S,T){var h=S[T+1]>>3&3,o=S[T+1]>>1&3,l=S[T+2]>>4&15,d=S[T+2]>>2&3;if(h!==1&&l!==0&&l!==15&&d!==3){var C=S[T+2]>>1&1,p=S[T+3]>>6,f=h===3?3-o:o===3?3:4,L=B[f*14+l-1]*1e3,b=h===3?0:h===2?1:2,m=P[b*3+d],c=p===3?1:2,u=z[h][o],a=j[o],x=u*8*a,y=Math.floor(u*L/m+C)*a;if(Z===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);Z=N?parseInt(N[1]):0}var U=!!Z&&Z<=87;return U&&o===2&&L>=224e3&&p===0&&(S[T+3]=S[T+3]|128),{sampleRate:m,channelCount:c,frameLength:y,samplesPerFrame:x}}}function v(S,T){return S[T]===255&&(S[T+1]&224)===224&&(S[T+1]&6)!==0}function A(S,T){return T+1<S.length&&v(S,T)}function O(S,T){var h=4;return v(S,T)&&h<=S.length-T}function _(S,T){if(T+1<S.length&&v(S,T)){var h=4,o=k(S,T),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var d=T+l;return d===S.length||A(S,d)}return!1}},"./src/demux/sample-aes.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/crypt/decrypter.ts"),B=D("./src/demux/tsdemuxer.ts"),P=function(){function z(I,k,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new Z.default(I,k,{removePKCS7Padding:!1})}var j=z.prototype;return j.decryptBuffer=function(k,v){this.decrypter.decrypt(k,this.keyData.key.buffer,this.keyData.iv.buffer,v)},j.decryptAacSample=function(k,v,A,O){var _=k[v].unit,S=_.subarray(16,_.length-_.length%16),T=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),h=this;this.decryptBuffer(T,function(o){var l=new Uint8Array(o);_.set(l,16),O||h.decryptAacSamples(k,v+1,A)})},j.decryptAacSamples=function(k,v,A){for(;;v++){if(v>=k.length){A();return}if(k[v].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(k,v,A,O),!O)return}},j.getAvcEncryptedData=function(k){for(var v=Math.floor((k.length-48)/160)*16+16,A=new Int8Array(v),O=0,_=32;_<=k.length-16;_+=160,O+=16)A.set(k.subarray(_,_+16),O);return A},j.getAvcDecryptedUnit=function(k,v){for(var A=new Uint8Array(v),O=0,_=32;_<=k.length-16;_+=160,O+=16)k.set(A.subarray(O,O+16),_);return k},j.decryptAvcSample=function(k,v,A,O,_,S){var T=Object(B.discardEPB)(_.data),h=this.getAvcEncryptedData(T),o=this;this.decryptBuffer(h.buffer,function(l){_.data=o.getAvcDecryptedUnit(T,l),S||o.decryptAvcSamples(k,v,A+1,O)})},j.decryptAvcSamples=function(k,v,A,O){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,A=0){if(v>=k.length){O();return}for(var _=k[v].units;!(A>=_.length);A++){var S=_[A];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var T=this.decrypter.isSync();if(this.decryptAvcSample(k,v,A,O,S,T),!T)return}}},z}();Q.default=P},"./src/demux/transmuxer-interface.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./node_modules/webworkify-webpack/index.js"),B=D.n(Z),P=D("./src/events.ts"),z=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),k=D("./src/utils/mediasource-helper.ts"),v=D("./node_modules/eventemitter3/index.js"),A=D.n(v),O=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function S(h,o,l,d){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var p=h.config,f=function(u,a){a=a||{},a.frag=C.frag,a.id=C.id,h.trigger(u,a)};this.observer=new v.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,f),this.observer.on(P.Events.ERROR,f);var L={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var m;try{m=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(c){h.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},m.postMessage({cmd:"init",typeSupported:L,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){j.logger.warn("Error in worker:",c),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new z.default(this.observer,L,p,b,o),this.worker=null}}else this.transmuxer=new z.default(this.observer,L,p,b,o)}var T=S.prototype;return T.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},T.push=function(o,l,d,C,p,f,L,b,m,c){var u=this;m.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,y=f?f.start:p.start,E=p.decryptdata,N=this.frag,U=!(N&&p.cc===N.cc),K=!(N&&m.level===N.level),V=N?m.sn-N.sn:-1,R=this.part?m.part-this.part.index:1,M=!K&&(V===1||V===0&&R===1),$=self.performance.now();(K||V||p.stats.parsing.start===0)&&(p.stats.parsing.start=$),f&&(R||!M)&&(f.stats.parsing.start=$);var ee=new z.TransmuxState(U,M,b,K,y);if(!M||U){j.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
discontinuity: `+U+`
trackSwitch: `+K+`
contiguous: `+M+`
accurateTimeOffset: `+b+`
timeOffset: `+y);var oe=new z.TransmuxConfig(d,C,l,L,c);this.configureTransmuxer(oe)}if(this.frag=p,this.part=f,x)x.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:m,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var ce=a.push(o,E,m,ee);Object(z.isPromise)(ce)?ce.then(function(De){u.handleTransmuxComplete(De)}):this.handleTransmuxComplete(ce)}},T.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(d){var p=d.flush(o);Object(z.isPromise)(p)?p.then(function(f){l.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},T.handleFlushResult=function(o,l){var d=this;o.forEach(function(C){d.handleTransmuxComplete(C)}),this.onFlush(l)},T.onWorkerMessage=function(o){var l=o.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},T.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},T.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},S}()},"./src/demux/transmuxer-worker.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/demux/transmuxer.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),z=D("./node_modules/eventemitter3/index.js"),j=D.n(z);function I(_){var S=new z.EventEmitter,T=function(o,l){_.postMessage({event:o,data:l})};S.on(B.Events.FRAG_DECRYPTED,T),S.on(B.Events.ERROR,T),_.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);_.transmuxer=new Z.default(S,o.typeSupported,l,o.vendor,o.id),Object(P.enableLogs)(l.debug),T("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var d=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(d)?d.then(function(f){k(_,f)}):k(_,d);break}case"flush":{var C=o.chunkMeta,p=_.transmuxer.flush(C);Object(Z.isPromise)(p)?p.then(function(f){A(_,f,C)}):A(_,p,C);break}default:break}})}function k(_,S){if(O(S.remuxResult))return;var T=[],h=S.remuxResult,o=h.audio,l=h.video;o&&v(T,o),l&&v(T,l),_.postMessage({event:"transmuxComplete",data:S},T)}function v(_,S){S.data1&&_.push(S.data1.buffer),S.data2&&_.push(S.data2.buffer)}function A(_,S,T){S.forEach(function(h){k(_,h)}),_.postMessage({event:"flush",data:T})}function O(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"isPromise",function(){return p}),D.d(Q,"TransmuxConfig",function(){return f}),D.d(Q,"TransmuxState",function(){return L});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),z=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),k=D("./src/demux/mp3demuxer.ts"),v=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),O=D("./src/demux/chunk-cache.ts"),_=D("./src/utils/mp4-tools.ts"),S=D("./src/utils/logger.ts"),T;try{T=self.performance.now.bind(self.performance)}catch(b){S.logger.debug("Unable to use Performance API on this environment"),T=self.Date.now}var h=[{demux:I.default,remux:v.default},{demux:j.default,remux:A.default},{demux:z.default,remux:v.default},{demux:k.default,remux:v.default}],o=1024;h.forEach(function(b){var m=b.demux;o=Math.max(o,m.minProbeByteLength)});var l=function(){function b(c,u,a,x,y){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 O.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=x,this.id=y}var m=b.prototype;return m.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},m.push=function(u,a,x,y){var E=this,N=x.transmuxing;N.executeStart=T();var U=new Uint8Array(u),K=this.cache,V=this.config,R=this.currentTransmuxState,M=this.transmuxConfig;y&&(this.currentTransmuxState=y);var $=d(U,a);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(U,$.key.buffer,$.iv.buffer);if(!oe)return N.executeEnd=T(),C(x);U=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(U,$.key.buffer,$.iv.buffer).then(function(Oe){var Me=E.push(Oe,null,x);return E.decryptionPromise=null,Me}),this.decryptionPromise}var ce=y||R,De=ce.contiguous,Ee=ce.discontinuity,Ce=ce.trackSwitch,Te=ce.accurateTimeOffset,we=ce.timeOffset,me=M.audioCodec,le=M.videoCodec,te=M.defaultInitPts,he=M.duration,ie=M.initSegmentData;if((Ee||Ce)&&this.resetInitSegment(ie,me,le,he),Ee&&this.resetInitialTimestamp(te),De||this.resetContiguity(),this.needsProbing(U,Ee,Ce)){if(K.dataLength){var Ae=K.flush();U=Object(_.appendUint8Array)(Ae,U)}this.configureTransmuxer(U,M)}var Re=this.transmux(U,$,we,Te,x),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,N.executeEnd=T(),Re},m.flush=function(u){var a=this,x=u.transmuxing;x.executeStart=T();var y=this.decrypter,E=this.cache,N=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(u)});var K=[],V=N.timeOffset;if(y){var R=y.flush();R&&K.push(this.push(R,null,u))}var M=E.dataLength;E.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return M>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=T(),[C(u)];var oe=$.flush(V);return p(oe)?oe.then(function(ce){return a.flushRemux(K,ce,u),K}):(this.flushRemux(K,oe,u),K)},m.flushRemux=function(u,a,x){var y=a.audioTrack,E=a.avcTrack,N=a.id3Track,U=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,R=K.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var M=this.remuxer.remux(y,E,N,U,R,V,!0,this.id);u.push({remuxResult:M,chunkMeta:x}),x.transmuxing.executeEnd=T()},m.resetInitialTimestamp=function(u){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(u),x.resetTimeStamp(u)},m.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},m.resetInitSegment=function(u,a,x,y){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(a,x,y),N.resetInitSegment(u,a,x)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(u,a,x,y,E){var N;return a&&a.method==="SAMPLE-AES"?N=this.transmuxSampleAes(u,a,x,y,E):N=this.transmuxUnencrypted(u,x,y,E),N},m.transmuxUnencrypted=function(u,a,x,y){var E=this.demuxer.demux(u,a,!1,!this.config.progressive),N=E.audioTrack,U=E.avcTrack,K=E.id3Track,V=E.textTrack,R=this.remuxer.remux(N,U,K,V,a,x,!1,this.id);return{remuxResult:R,chunkMeta:y}},m.transmuxSampleAes=function(u,a,x,y,E){var N=this;return this.demuxer.demuxSampleAes(u,a,x).then(function(U){var K=N.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,y,!1,N.id);return{remuxResult:K,chunkMeta:E}})},m.configureTransmuxer=function(u,a){for(var x=this.config,y=this.observer,E=this.typeSupported,N=this.vendor,U=a.audioCodec,K=a.defaultInitPts,V=a.duration,R=a.initSegmentData,M=a.videoCodec,$,ee=0,oe=h.length;ee<oe;ee++)if(h[ee].demux.probe(u)){$=h[ee];break}$||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:j.default,remux:A.default});var ce=this.demuxer,De=this.remuxer,Ee=$.remux,Ce=$.demux;(!De||!(De instanceof Ee))&&(this.remuxer=new Ee(y,x,E,N)),(!ce||!(ce instanceof Ce))&&(this.demuxer=new Ce(y,x,E),this.probe=Ce.probe),this.resetInitSegment(R,U,M,V),this.resetInitialTimestamp(K)},m.needsProbing=function(u,a,x){return!this.demuxer||!this.remuxer||a||x},m.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new P.default(this.observer,this.config)),u},b}();function d(b,m){var c=null;return b.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(c=m),c}var C=function(m){return{remuxResult:{},chunkMeta:m}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(m,c,u,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=x},L=function(m,c,u,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"discardEPB",function(){return C});var Z=D("./src/demux/adts.ts"),B=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),z=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),k=D("./src/utils/mp4-tools.ts"),v=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},_=function(){function p(L,b,m){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=L,this.config=b,this.typeSupported=m}p.probe=function(b){var m=p.syncOffset(b);return m<0?!1:(m&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var m=Math.min(1e3,b.length-3*188),c=0;c<m;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,m){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:O[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?m:void 0}};var f=p.prototype;return f.resetInitSegment=function(b,m,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=m,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,m=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),m&&(m.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,m,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,y=this._audioTrack,E=this._id3Track,N=x.pid,U=x.pesData,K=y.pid,V=E.pid,R=y.pesData,M=E.pesData,$=!1,ee=this.pmtParsed,oe=this._pmtId,ce=b.length;if(this.remainderData&&(b=Object(k.appendUint8Array)(this.remainderData,b),ce=b.length,this.remainderData=null),ce<188&&!u)return this.remainderData=b,{audioTrack:y,avcTrack:x,id3Track:E,textTrack:this._txtTrack};var De=Math.max(0,p.syncOffset(b));ce-=(ce+De)%188,ce<b.byteLength&&!u&&(this.remainderData=new Uint8Array(b.buffer,ce,b.buffer.byteLength-ce));for(var Ee=De;Ee<ce;Ee+=188)if(b[Ee]===71){var Ce=!!(b[Ee+1]&64),Te=((b[Ee+1]&31)<<8)+b[Ee+2],we=(b[Ee+3]&48)>>4,me=void 0;if(we>1){if(me=Ee+5+b[Ee+4],me===Ee+188)continue}else me=Ee+4;switch(Te){case N:Ce&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(me,Ee+188)),U.size+=Ee+188-me);break;case K:Ce&&(R&&(a=o(R))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),R={data:[],size:0}),R&&(R.data.push(b.subarray(me,Ee+188)),R.size+=Ee+188-me);break;case V:Ce&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(b.subarray(me,Ee+188)),M.size+=Ee+188-me);break;case 0:Ce&&(me+=b[me]+1),oe=this._pmtId=T(b,me);break;case oe:{Ce&&(me+=b[me]+1);var le=h(b,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);N=le.avc,N>0&&(x.pid=N),K=le.audio,K>0&&(y.pid=K,y.isAAC=le.isAAC),V=le.id3,V>0&&(E.pid=V),$&&!ee&&(v.logger.log("reparse from beginning"),$=!1,Ee=De-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,y.pesData=R,E.pesData=M;var te={audioTrack:y,avcTrack:x,id3Track:E,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(te),te},f.flush=function(){var b=this.remainderData;this.remainderData=null;var m;return b?m=this.demux(b,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},f.extractRemainingSamples=function(b){var m=b.audioTrack,c=b.avcTrack,u=b.id3Track,a=c.pesData,x=m.pesData,y=u.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,x&&(E=o(x))?(m.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),m.pesData=null):(x!=null&&x.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=x),y&&(E=o(y))?(this.parseID3PES(E),u.pesData=null):u.pesData=y},f.demuxSampleAes=function(b,m,c){var u=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,m);return this.decrypt(u,a)},f.decrypt=function(b,m){return new Promise(function(c){var u=b.audioTrack,a=b.avcTrack;u.samples&&u.isAAC?m.decryptAacSamples(u.samples,0,function(){a.samples?m.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&m.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,m){var c=this,u=this._avcTrack,a=this.parseAVCNALu(b.data),x=!1,y=this.avcSample,E,N=!1;b.data=null,y&&a.length&&!u.audFound&&(l(y,u),y=this.avcSample=S(!1,b.pts,b.dts,"")),a.forEach(function(U){switch(U.type){case 1:{E=!0,y||(y=c.avcSample=S(!0,b.pts,b.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var K=U.data;if(N&&K.length>4){var V=new P.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(y.key=!0)}break}case 5:E=!0,y||(y=c.avcSample=S(!0,b.pts,b.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{E=!0,x&&y&&(y.debug+="SEI ");var R=new P.default(C(U.data));R.readUByte();for(var M=0,$=0,ee=!1,oe=0;!ee&&R.bytesAvailable>1;){M=0;do oe=R.readUByte(),M+=oe;while(oe===255);$=0;do oe=R.readUByte(),$+=oe;while(oe===255);if(M===4&&R.bytesAvailable!==0){ee=!0;var ce=R.readUByte();if(ce===181){var De=R.readUShort();if(De===49){var Ee=R.readUInt();if(Ee===1195456820){var Ce=R.readUByte();if(Ce===3){for(var Te=R.readUByte(),we=R.readUByte(),me=31&Te,le=[Te,we],te=0;te<me;te++)le.push(R.readUByte()),le.push(R.readUByte()),le.push(R.readUByte());d(c._txtTrack.samples,{type:3,pts:b.pts,bytes:le})}}}}}else if(M===5&&R.bytesAvailable!==0){if(ee=!0,$>16){for(var he=[],ie=0;ie<16;ie++)he.push(R.readUByte().toString(16)),(ie===3||ie===5||ie===7||ie===9)&&he.push("-");for(var Ae=$-16,Re=new Uint8Array(Ae),ye=0;ye<Ae;ye++)Re[ye]=R.readUByte();d(c._txtTrack.samples,{pts:b.pts,payloadType:M,uuid:he.join(""),userData:Object(z.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if($<R.bytesAvailable)for(var Oe=0;Oe<$;Oe++)R.readUByte()}break}case 7:if(E=!0,N=!0,x&&y&&(y.debug+="SPS "),!u.sps){var Me=new P.default(U.data),Ie=Me.readSPS();u.width=Ie.width,u.height=Ie.height,u.pixelRatio=Ie.pixelRatio,u.sps=[U.data],u.duration=c._duration;for(var je=U.data.subarray(1,4),Be="avc1.",Ne=0;Ne<3;Ne++){var rt=je[Ne].toString(16);rt.length<2&&(rt="0"+rt),Be+=rt}u.codec=Be}break;case 8:E=!0,x&&y&&(y.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:E=!1,u.audFound=!0,y&&l(y,u),y=c.avcSample=S(!1,b.pts,b.dts,x?"AUD ":"");break;case 12:E=!1;break;default:E=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&E){var qe=y.units;qe.push(U)}}),m&&y&&(l(y,u),this.avcSample=null)},f.getLastNalUnit=function(){var b,m=this.avcSample,c;if(!m||m.units.length===0){var u=this._avcTrack.samples;m=u[u.length-1]}if((b=m)!==null&&b!==void 0&&b.units){var a=m.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(b){var m=b.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,x=[],y=0,E,N,U,K=-1,V=0;for(u===-1&&(K=0,V=b[0]&31,u=0,y=1);y<m;){if(E=b[y++],!u){u=E?0:1;continue}if(u===1){u=E?0:2;continue}if(!E)u=3;else if(E===1){if(K>=0){var R={data:b.subarray(K,y-u-1),type:V};x.push(R)}else{var M=this.getLastNalUnit();if(M&&(a&&y<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),N=y-u-1,N>0)){var $=new Uint8Array(M.data.byteLength+N);$.set(M.data,0),$.set(b.subarray(0,N),M.data.byteLength),M.data=$,M.state=0}}y<m?(U=b[y]&31,K=y,V=U,u=0):u=-1}else u=0}if(K>=0&&u>=0){var ee={data:b.subarray(K,m),type:V,state:u};x.push(ee)}if(x.length===0){var oe=this.getLastNalUnit();if(oe){var ce=new Uint8Array(oe.data.byteLength+b.byteLength);ce.set(oe.data,0),ce.set(b,oe.data.byteLength),oe.data=ce}}return c.naluState=u,x},f.parseAACPES=function(b){var m=0,c=this._audioTrack,u=this.aacOverFlow,a=b.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,y=Math.min(u.missing,x),E=x-y;u.sample.unit.set(a.subarray(0,y),E),c.samples.push(u.sample),m=u.missing}var N,U;for(N=m,U=a.length;N<U-1&&!Z.isHeader(a,N);N++);if(N!==m){var K,V;if(N<U-1?(K="AAC PES did not start with ADTS header,offset:"+N,V=!1):(K="no ADTS header found in AAC PES",V=!0),v.logger.warn("parsing error:"+K),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Z.initTrackConfig(c,this.observer,a,N,this.audioCodec);var R;if(b.pts!==void 0)R=b.pts;else if(u){var M=Z.getFrameDuration(c.samplerate);R=u.sample.pts+M}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;N<U;)if(Z.isHeader(a,N)){if(N+5<U){var ee=Z.appendFrame(c,a,N,R,$);if(ee)if(ee.missing)this.aacOverFlow=ee;else{N+=ee.length,$++;continue}}break}else N++},f.parseMPEGPES=function(b){var m=b.data,c=m.length,u=0,a=0,x=b.pts;if(x===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(B.isHeader(m,a)){var y=B.appendFrame(this._audioTrack,m,a,x,u);if(y)a+=y.length,u++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();_.minProbeByteLength=188;function S(p,f,L,b){return{key:p,frame:!1,pts:f,dts:L,units:[],debug:b,length:0}}function T(p,f){return(p[f+10]&31)<<8|p[f+11]}function h(p,f,L,b){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],u=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<u;){var x=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!b){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=x);break;case 21:m.id3===-1&&(m.id3=x);break;case 219:if(!b){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=x);break;case 3:case 4:L?m.audio===-1&&(m.audio=x,m.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return m}function o(p){var f=0,L,b,m,c,u,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}L=a[0];var y=(L[0]<<16)+(L[1]<<8)+L[2];if(y===1){if(b=(L[4]<<8)+L[5],b&&b>p.size-6)return null;var E=L[7];E&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,E&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-u>60*9e4&&(v.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),m=L[8];var N=m+9;if(p.size<=N)return null;p.size-=N;for(var U=new Uint8Array(p.size),K=0,V=a.length;K<V;K++){L=a[K];var R=L.byteLength;if(N)if(N>R){N-=R;continue}else L=L.subarray(N),R-=N,N=0;U.set(L,f),f+=R}return b&&(b-=m+3),{data:U,pts:c,dts:u,len:b}}return null}function l(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var L=f.samples,b=L.length;if(b){var m=L[b-1];p.pts=m.pts,p.dts=m.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&v.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function d(p,f){var L=p.length;if(L>0){if(f.pts>=p[L-1].pts)p.push(f);else for(var b=L-1;b>=0;b--)if(f.pts<p[b].pts){p.splice(b,0,f);break}}else p.push(f)}function C(p){for(var f=p.byteLength,L=[],b=1;b<f-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(L.push(b+2),b+=2):b++;if(L.length===0)return p;var m=f-L.length,c=new Uint8Array(m),u=0;for(b=0;b<m;u++,b++)u===L[0]&&(u++,L.shift()),c[b]=p[u];return c}Q.default=_},"./src/errors.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"ErrorTypes",function(){return Z}),D.d(Q,"ErrorDetails",function(){return B});var Z;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Z||(Z={}));var B;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"Events",function(){return Z});var Z;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z),P=D("./src/loader/playlist-loader.ts"),z=D("./src/loader/key-loader.ts"),j=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),k=D("./src/controller/level-controller.ts"),v=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),O=D("./src/is-supported.ts"),_=D("./src/utils/logger.ts"),S=D("./src/config.ts"),T=D("./node_modules/eventemitter3/index.js"),h=D.n(T),o=D("./src/events.ts"),l=D("./src/errors.ts");function d(f,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function C(f,L,b){return L&&d(f.prototype,L),b&&d(f,b),f}var p=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new T.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 m=this.config=Object(S.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(_.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(S.enableStreamingMode)(m);var c=m.abrController,u=m.bufferController,a=m.capLevelController,x=m.fpsController,y=this.abrController=new c(this),E=this.bufferController=new u(this),N=this.capLevelController=new a(this),U=new x(this),K=new P.default(this),V=new z.default(this),R=new j.default(this),M=this.levelController=new k.default(this),$=new v.FragmentTracker(this),ee=this.streamController=new A.default(this,$);N.setStreamController(ee),U.setStreamController(ee);var oe=[M,ee];this.networkControllers=oe;var ce=[K,V,y,E,N,U,R,$];this.audioTrackController=this.createController(m.audioTrackController,null,oe),this.createController(m.audioStreamController,$,oe),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,oe),this.createController(m.subtitleStreamController,$,oe),this.createController(m.timelineController,null,ce),this.emeController=this.createController(m.emeController,null,ce),this.cmcdController=this.createController(m.cmcdController,null,ce),this.latencyController=this.createController(I.default,null,ce),this.coreComponents=ce}var L=f.prototype;return L.createController=function(m,c,u){if(m){var a=c?new m(this,c):new m(this);return u&&u.push(a),a}return null},L.on=function(m,c,u){u===void 0&&(u=this),this._emitter.on(m,c,u)},L.once=function(m,c,u){u===void 0&&(u=this),this._emitter.once(m,c,u)},L.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},L.off=function(m,c,u,a){u===void 0&&(u=this),this._emitter.off(m,c,u,a)},L.listeners=function(m){return this._emitter.listeners(m)},L.emit=function(m,c,u){return this._emitter.emit(m,c,u)},L.trigger=function(m,c){if(this.config.debug)return this.emit(m,m,c);try{return this.emit(m,m,c)}catch(u){_.logger.error("An internal error happened while handling event "+m+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:u})}return!1},L.listenerCount=function(m){return this._emitter.listenerCount(m)},L.destroy=function(){_.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},L.attachMedia=function(m){_.logger.log("attachMedia"),this._media=m,this.trigger(o.Events.MEDIA_ATTACHING,{media:m})},L.detachMedia=function(){_.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(m){this.stopLoad();var c=this.media,u=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:m})},L.startLoad=function(m){m===void 0&&(m=-1),_.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(c){c.startLoad(m)})},L.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},L.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){_.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},L.removeLevel=function(m,c){c===void 0&&(c=0),this.levelController.removeLevel(m,c)},C(f,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){_.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){_.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){_.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){_.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){_.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var c=!!m;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(m){this._autoLevelCapping!==m&&(_.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,c=this.config.minAutoBitrate;if(!m)return 0;for(var u=m.length,a=0;a<u;a++)if(m[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,c=this.autoLevelCapping,u;return c===-1&&m&&m.length?u=m.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var c=this.audioTrackController;c&&(c.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{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 o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:S.hlsDefaultConfig},set:function(m){f.defaultConfig=m}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"isSupported",function(){return P}),D.d(Q,"changeTypeSupported",function(){return z});var Z=D("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var j=Object(Z.getMediaSource)();if(!j)return!1;var I=B(),k=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!k&&!!v}function z(){var j,I=B();return typeof(I==null||((j=I.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _}),D.d(Q,"LoadError",function(){return T});var Z=D("./src/polyfills/number.ts"),B=D("./src/errors.ts");function P(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,v(h,o)}function z(h){var o=typeof Map=="function"?new Map:void 0;return z=function(d){if(d===null||!k(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,C)}function C(){return j(d,arguments,A(this).constructor)}return C.prototype=Object.create(d.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),v(C,d)},z(h)}function j(h,o,l){return I()?j=Reflect.construct:j=function(C,p,f){var L=[null];L.push.apply(L,p);var b=Function.bind.apply(C,L),m=new b;return f&&v(m,f.prototype),m},j.apply(null,arguments)}function I(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function k(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function v(h,o){return v=Object.setPrototypeOf||function(d,C){return d.__proto__=C,d},v(h,o)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(h)}var O=Math.pow(2,17),_=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,C){var p=this,f=d.url;if(!f)return Promise.reject(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var L=this.config,b=L.fLoader,m=L.loader;return new Promise(function(c,u){p.loader&&p.loader.destroy();var a=p.loader=d.loader=b?new b(L):new m(L),x=S(d),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:O};d.stats=a.stats,a.load(x,y,{onSuccess:function(N,U,K,V){p.resetLoader(d,a),c({frag:d,part:null,payload:N.data,networkDetails:V})},onError:function(N,U,K){p.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:N,networkDetails:K}))},onAbort:function(N,U,K){p.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:K}))},onTimeout:function(N,U,K){p.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:K}))},onProgress:function(N,U,K,V){C&&C({frag:d,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(d,C,p){var f=this;this.abort();var L=this.config,b=L.fLoader,m=L.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=d.loader=b?new b(L):new m(L),x=S(d,C),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:O};C.stats=a.stats,a.load(x,y,{onSuccess:function(N,U,K,V){f.resetLoader(d,a),f.updateStatsFromPart(d,C);var R={frag:d,part:C,payload:N.data,networkDetails:V};p(R),c(R)},onError:function(N,U,K){f.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:C,response:N,networkDetails:K}))},onAbort:function(N,U,K){d.stats.aborted=C.stats.aborted,f.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:C,networkDetails:K}))},onTimeout:function(N,U,K){f.resetLoader(d,a),u(new T({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:C,networkDetails:K}))}})})},o.updateStatsFromPart=function(d,C){var p=d.stats,f=C.stats,L=f.total;if(p.loaded+=f.loaded,L){var b=Math.round(d.duration/C.duration),m=Math.min(Math.round(p.loaded/L),b),c=b-m,u=c*Math.round(p.loaded/m);p.total=p.loaded+u}else p.total=Math.max(p.loaded,p.total);var a=p.loading,x=f.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(d,C){d.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},h}();function S(h,o){o===void 0&&(o=null);var l=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,p=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(C)&&Object(Z.isFiniteNumber)(p)&&(d.rangeStart=C,d.rangeEnd=p),d}var T=function(h){P(o,h);function o(l){for(var d,C=arguments.length,p=new Array(C>1?C-1:0),f=1;f<C;f++)p[f-1]=arguments[f];return d=h.call.apply(h,[this].concat(p))||this,d.data=void 0,d.data=l,d}return o}(z(Error))},"./src/loader/fragment.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"ElementaryStreamTypes",function(){return _}),D.d(Q,"BaseSegment",function(){return S}),D.d(Q,"Fragment",function(){return T}),D.d(Q,"Part",function(){return h});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),z=D("./src/utils/logger.ts"),j=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,v(o,l)}function v(o,l){return v=Object.setPrototypeOf||function(C,p){return C.__proto__=p,C},v(o,l)}function A(o,l){for(var d=0;d<l.length;d++){var C=l[d];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function O(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var S=function(){function o(d){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[_.AUDIO]=null,C[_.VIDEO]=null,C[_.AUDIOVIDEO]=null,C),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(C,p){var f=C.split("@",2),L=[];f.length===1?L[0]=p?p.byteRangeEndOffset:0:L[0]=parseInt(f[1]),L[1]=parseInt(f[0])+L[0],this._byteRange=L},O(o,[{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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),T=function(o){k(l,o);function l(C,p){var f;return f=o.call(this,p)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new I.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=C,f}var d=l.prototype;return d.createInitializationVector=function(p){for(var f=new Uint8Array(16),L=12;L<16;L++)f[L]=p>>8*(15-L)&255;return f},d.setDecryptDataFromLevelKey=function(p,f){var L=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(L=j.LevelKey.fromURI(p.uri),L.method=p.method,L.iv=this.createInitializationVector(f),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(p,f,L,b,m,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[p];if(!a){u[p]={startPTS:f,endPTS:L,startDTS:b,endDTS:m,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,m)},d.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[_.AUDIO]=null,p[_.VIDEO]=null,p[_.AUDIOVIDEO]=null},O(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&z.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var p=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),l}(S),h=function(o){k(l,o);function l(d,C,p,f,L){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new I.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=C,b.index=f;var m=d.enumeratedString("BYTERANGE");return m&&b.setByteRange(m,L),L&&(b.fragOffset=L.fragOffset+L.duration),b}return O(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(S)},"./src/loader/key-loader.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return z});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),z=function(){function j(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var I=j.prototype;return I._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var A=this.loaders[v];A&&A.destroy()}this.loaders={}},I.onKeyLoading=function(v,A){var O=A.frag,_=O.type,S=this.loaders[_];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var T=O.decryptdata.uri;if(T!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(S&&(P.logger.warn("abort previous key loader for type:"+_),S.abort()),!T){P.logger.warn("key uri is falsy");return}var o=h.loader,l=O.loader=this.loaders[_]=new o(h);this.decrypturl=T,this.decryptkey=null;var d={url:T,frag:O,responseType:"arraybuffer"},C={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,C,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:O}))},I.loadsuccess=function(v,A,O){var _=O.frag;if(!_.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(v.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:_})},I.loaderror=function(v,A){var O=A.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:v})},I.loadtimeout=function(v,A){var O=A.frag,_=O.loader;_&&_.abort(),delete this.loaders[O.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},j}()},"./src/loader/level-details.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"LevelDetails",function(){return j});var Z=D("./src/polyfills/number.ts");function B(I,k){for(var v=0;v<k.length;v++){var A=k[v];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function P(I,k,v){return k&&B(I.prototype,k),v&&B(I,v),I}var z=10,j=function(){function I(v){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=v}var k=I.prototype;return k.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-A.lastPartSn,_=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!_||!!O,this.advanced=this.endSN>A.endSN||O>0||O===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var O=this.driftEnd-this.driftStart;return O*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"LevelKey",function(){return j});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z);function P(I,k){for(var v=0;v<k.length;v++){var A=k[v];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function z(I,k,v){return k&&P(I.prototype,k),v&&P(I,v),I}var j=function(){I.fromURL=function(v,A){return new I(v,A)},I.fromURI=function(v){return new I(v)};function I(k,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(Z.buildAbsoluteURL)(k,v,{alwaysNormalize:!0}):this._uri=k}return z(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"LoadStats",function(){return Z});var Z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),z=D("./src/loader/fragment.ts"),j=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),k=D("./src/utils/attr-list.ts"),v=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#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"),T=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("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var b,m;return h.test((b=(m=B.parseURL(L))===null||m===void 0?void 0:m.path)!=null?b:"")}var l=function(){function L(){}return L.findGroup=function(m,c){for(var u=0;u<m.length;u++){var a=m[u];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(m){var c=m.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return m},L.resolve=function(m,c){return B.buildAbsoluteURL(c,m,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(m,c){var u=[],a={},x=!1;O.lastIndex=0;for(var y;(y=O.exec(m))!=null;)if(y[1]){var E=new k.AttrList(y[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:L.resolve(y[2],c)},U=E.decimalResolution("RESOLUTION");U&&(N.width=U.width,N.height=U.height),d((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=L.convertAVC1ToAVCOTI(N.videoCodec)),u.push(N)}else if(y[3]){var K=new k.AttrList(y[3]);K["DATA-ID"]&&(x=!0,a[K["DATA-ID"]]=K)}return{levels:u,sessionData:x?a:null}},L.parseMasterPlaylistMedia=function(m,c,u,a){a===void 0&&(a=[]);var x,y=[],E=0;for(_.lastIndex=0;(x=_.exec(m))!==null;){var N=new k.AttrList(x[1]);if(N.TYPE===u){var U={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:u,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?L.resolve(N.URI,c):""};if(a.length){var K=L.findGroup(a,U.groupId)||a[0];C(U,K,"audioCodec"),C(U,K,"textCodec")}y.push(U)}}return y},L.parseLevelPlaylist=function(m,c,u,a,x){var y=new j.LevelDetails(c),E=y.fragments,N=null,U=0,K=0,V=0,R=0,M=null,$=new z.Fragment(a,c),ee,oe,ce,De=-1,Ee=!1;for(S.lastIndex=0,y.m3u8=m;(ee=S.exec(m))!==null;){Ee&&(Ee=!1,$=new z.Fragment(a,c),$.start=V,$.sn=U,$.cc=R,$.level=u,N&&($.initSegment=N,$.rawProgramDateTime=N.rawProgramDateTime));var Ce=ee[1];if(Ce){$.duration=parseFloat(Ce);var Te=(" "+ee[2]).slice(1);$.title=Te||null,$.tagList.push(Te?["INF",Ce,Te]:["INF",Ce])}else if(ee[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,ce&&($.levelkey=ce),$.sn=U,$.level=u,$.cc=R,$.urlId=x,E.push($),$.relurl=(" "+ee[3]).slice(1),f($,M),M=$,V+=$.duration,U++,K=0,Ee=!0);else if(ee[4]){var we=(" "+ee[4]).slice(1);M?$.setByteRange(we,M):$.setByteRange(we)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),De===-1&&(De=E.length);else{if(ee=ee[0].match(T),!ee){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var me=(" "+ee[oe]).slice(1),le=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":y.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(le);break;case"SKIP":{var he=new k.AttrList(le),ie=he.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ie)){y.skippedSegments=ie;for(var Ae=ie;Ae--;)E.unshift(null);U+=ie}var Re=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(y.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(le);break;case"VERSION":y.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(le||te)&&$.tagList.push(te?[le,te]:[le]);break;case"DIS":R++;case"GAP":$.tagList.push([me]);break;case"BITRATE":$.tagList.push([me,le]);break;case"DISCONTINUITY-SEQ":R=parseInt(le);break;case"KEY":{var ye,Oe=new k.AttrList(le),Me=Oe.enumeratedString("METHOD"),Ie=Oe.URI,je=Oe.hexadecimalInteger("IV"),Be=Oe.enumeratedString("KEYFORMATVERSIONS"),Ne=Oe.enumeratedString("KEYID"),rt=(ye=Oe.enumeratedString("KEYFORMAT"))!=null?ye:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf(rt)>-1){v.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;Me&&(ce=I.LevelKey.fromURL(c,Ie),Ie&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(ce.method=Me,ce.keyFormat=rt,Ne&&(ce.keyID=Ne),Be&&(ce.keyFormatVersions=Be),ce.iv=je));break}case"START":{var Ye=new k.AttrList(le),$e=Ye.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)($e)&&(y.startTimeOffset=$e);break}case"MAP":{var ht=new k.AttrList(le);$.relurl=ht.URI,ht.BYTERANGE&&$.setByteRange(ht.BYTERANGE),$.level=u,$.sn="initSegment",ce&&($.levelkey=ce),$.initSegment=null,N=$,Ee=!0;break}case"SERVER-CONTROL":{var Qe=new k.AttrList(le);y.canBlockReload=Qe.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Qe.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Qe.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Qe.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var nt=new k.AttrList(le);y.partTarget=nt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=y.partList;Pe||(Pe=y.partList=[]);var ct=K>0?Pe[Pe.length-1]:void 0,at=K++,Ue=new z.Part(new k.AttrList(le),$,c,at,ct);Pe.push(Ue),$.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ke=new k.AttrList(le);y.preloadHint=Ke;break}case"RENDITION-REPORT":{var xe=new k.AttrList(le);y.renditionReports=y.renditionReports||[],y.renditionReports.push(xe);break}default:v.logger.warn("line parsed but not handled: "+ee);break}}}M&&!M.relurl?(E.pop(),V-=M.duration,y.partList&&(y.fragmentHint=M)):y.partList&&(f($,M),$.cc=R,y.fragmentHint=$);var ge=E.length,be=E[0],re=E[ge-1];if(V+=y.skippedSegments*y.targetduration,V>0&&ge&&re){y.averagetargetduration=V/ge;var ne=re.sn;y.endSN=ne!=="initSegment"?ne:0,be&&(y.startCC=be.cc,be.initSegment||y.fragments.every(function(se){return se.relurl&&o(se.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new z.Fragment(a,c),$.relurl=re.relurl,$.level=u,$.sn="initSegment",be.initSegment=$,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(V+=y.fragmentHint.duration),y.totalduration=V,y.endCC=R,De>0&&p(E,De),y},L}();function d(L,b){["video","audio","text"].forEach(function(m){var c=L.filter(function(a){return Object(A.isCodecType)(a,m)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[m+"Codec"]=u.length>0?u[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=L}function C(L,b,m){var c=b[m];c&&(L[m]=c)}function p(L,b){for(var m=L[b],c=b;c--;){var u=L[c];if(!u)return;u.programDateTime=m.programDateTime-u.duration*1e3,m=u}}function f(L,b){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):b!=null&&b.programDateTime&&(L.programDateTime=b.endProgramDateTime),Object(Z.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),z=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),k=D("./src/types/loader.ts"),v=D("./src/utils/attr-list.ts");function A(S){var T=S.type;switch(T){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function O(S,T){var h=S.url;return(h===void 0||h.indexOf("data:")===0)&&(h=T.url),h}var _=function(){function S(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var T=S.prototype;return T.registerListeners=function(){var o=this.hls;o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,C=l.loader,p=d||C,f=new p(l);return o.loader=f,this.loaders[o.type]=f,f},T.getInternalLoader=function(o){return this.loaders[o.type]},T.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},T.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},T.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},T.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:k.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},T.onLevelLoading=function(o,l){var d=l.id,C=l.level,p=l.url,f=l.deliveryDirectives;this.load({id:d,groupId:null,level:C,responseType:"text",type:k.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},T.onAudioTrackLoading=function(o,l){var d=l.id,C=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},T.onSubtitleTrackLoading=function(o,l){var d=l.id,C=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:d,groupId:C,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},T.load=function(o){var l,d=this.hls.config,C=this.getInternalLoader(o);if(C){var p=C.context;if(p&&p.url===o.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var f,L,b,m;switch(o.type){case k.PlaylistContextType.MANIFEST:f=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,m=d.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:f=0,L=d.levelLoadingTimeOut;break;default:f=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,m=d.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===k.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===k.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===k.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(L=Math.min(Math.max(u*3,a*.8)*1e3,L))}}var x={timeout:L,maxRetry:f,retryDelay:b,maxRetryDelay:m,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,x,y)},T.loadsuccess=function(o,l,d,C){if(C===void 0&&(C=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,C);return}this.resetInternalLoader(d.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,C):this.handleMasterPlaylist(o,l,d,C)},T.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},T.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},T.handleMasterPlaylist=function(o,l,d,C){var p=this.hls,f=o.data,L=O(o,d),b=I.default.parseMasterPlaylist(f,L),m=b.levels,c=b.sessionData;if(!m.length){this.handleManifestParsingError(o,d,"no level found in manifest",C);return}var u=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=I.default.parseMasterPlaylistMedia(f,L,"AUDIO",u),y=I.default.parseMasterPlaylistMedia(f,L,"SUBTITLES",a),E=I.default.parseMasterPlaylistMedia(f,L,"CLOSED-CAPTIONS");if(x.length){var N=x.some(function(U){return!U.url});!N&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}p.trigger(B.Events.MANIFEST_LOADED,{levels:m,audioTracks:x,subtitles:y,captions:E,url:L,stats:l,networkDetails:C,sessionData:c})},T.handleTrackOrLevelPlaylist=function(o,l,d,C){var p=this.hls,f=d.id,L=d.level,b=d.type,m=O(o,d),c=Object(Z.isFiniteNumber)(f)?f:0,u=Object(Z.isFiniteNumber)(L)?L:c,a=A(d),x=I.default.parseLevelPlaylist(o.data,m,u,a,c);if(!x.fragments.length){p.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===k.PlaylistContextType.MANIFEST){var y={attrs:new v.AttrList({}),bitrate:0,details:x,name:"",url:m};p.trigger(B.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:m,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var E,N=(E=x.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:b,level:L,levelDetails:x,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=x,this.handlePlaylistLoaded(o,l,d,C)},T.handleSidxRequest=function(o,l){var d=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var C=d.references,p=l.levelDetails;C.forEach(function(f,L){var b=f.info,m=p.fragments[L];m.byteRange.length===0&&m.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),m.initSegment&&m.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},T.handleManifestParsingError=function(o,l,d,C){this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===k.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:C})},T.handleNetworkError=function(o,l,d,C){d===void 0&&(d=!1),z.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=P.ErrorDetails.UNKNOWN,f=!1,L=this.getInternalLoader(o);switch(o.type){case k.PlaylistContextType.MANIFEST:p=d?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case k.PlaylistContextType.LEVEL:p=d?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.AUDIO_TRACK:p=d?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:p=d?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}L&&this.resetInternalLoader(o.type);var b={type:P.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:L,context:o,networkDetails:l};C&&(b.response=C),this.hls.trigger(B.Events.ERROR,b)},T.handlePlaylistLoaded=function(o,l,d,C){var p=d.type,f=d.level,L=d.id,b=d.groupId,m=d.loader,c=d.levelDetails,u=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",C);return}if(!m)return;c.live&&(m.getCacheAge&&(c.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:c,level:f||0,id:L||0,stats:l,networkDetails:C,deliveryDirectives:u});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:b||"",stats:l,networkDetails:C,deliveryDirectives:u});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:b||"",stats:l,networkDetails:C,deliveryDirectives:u});break}},S}();Q.default=_},"./src/polyfills/number.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"isFiniteNumber",function(){return Z}),D.d(Q,"MAX_SAFE_INTEGER",function(){return B});var Z=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=function(){function B(){}return B.getSilentFrame=function(z,j){switch(z){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},B}();Q.default=Z},"./src/remux/mp4-generator.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=Math.pow(2,32)-1,B=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var j;for(j in P.types)P.types.hasOwnProperty(j)&&(P.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var I=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),k=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:I,audio:k};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,O,S,O,_),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,v))},P.box=function(j){for(var I=8,k=arguments.length,v=new Array(k>1?k-1:0),A=1;A<k;A++)v[A-1]=arguments[A];for(var O=v.length,_=O;O--;)I+=v[O].byteLength;var S=new Uint8Array(I);for(S[0]=I>>24&255,S[1]=I>>16&255,S[2]=I>>8&255,S[3]=I&255,S.set(j,4),O=0,I=8;O<_;O++)S.set(v[O],I),I+=v[O].byteLength;return S},P.hdlr=function(j){return P.box(P.types.hdlr,P.HDLR_TYPES[j])},P.mdat=function(j){return P.box(P.types.mdat,j)},P.mdhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),v=Math.floor(I%(Z+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},P.mdia=function(j){return P.box(P.types.mdia,P.mdhd(j.timescale,j.duration),P.hdlr(j.type),P.minf(j))},P.mfhd=function(j){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},P.minf=function(j){return j.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(j)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(j))},P.moof=function(j,I,k){return P.box(P.types.moof,P.mfhd(j),P.traf(k,I))},P.moov=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trak(j[I]);return P.box.apply(null,[P.types.moov,P.mvhd(j[0].timescale,j[0].duration)].concat(k).concat(P.mvex(j)))},P.mvex=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trex(j[I]);return P.box.apply(null,[P.types.mvex].concat(k))},P.mvhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),v=Math.floor(I%(Z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,A)},P.sdtp=function(j){var I=j.samples||[],k=new Uint8Array(4+I.length),v,A;for(v=0;v<I.length;v++)A=I[v].flags,k[v+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,k)},P.stbl=function(j){return P.box(P.types.stbl,P.stsd(j),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(j){var I=[],k=[],v,A,O;for(v=0;v<j.sps.length;v++)A=j.sps[v],O=A.byteLength,I.push(O>>>8&255),I.push(O&255),I=I.concat(Array.prototype.slice.call(A));for(v=0;v<j.pps.length;v++)A=j.pps[v],O=A.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(A));var _=P.box(P.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|j.sps.length].concat(I).concat([j.pps.length]).concat(k))),S=j.width,T=j.height,h=j.pixelRatio[0],o=j.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,S>>8&255,S&255,T>>8&255,T&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(j){var I=j.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(j.config).concat([6,1,2]))},P.mp4a=function(j){var I=j.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),P.box(P.types.esds,P.esds(j)))},P.mp3=function(j){var I=j.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},P.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(j)):P.box(P.types.stsd,P.STSD,P.mp4a(j)):P.box(P.types.stsd,P.STSD,P.avc1(j))},P.tkhd=function(j){var I=j.id,k=j.duration*j.timescale,v=j.width,A=j.height,O=Math.floor(k/(Z+1)),_=Math.floor(k%(Z+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&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,v>>8&255,v&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(j,I){var k=P.sdtp(j),v=j.id,A=Math.floor(I/(Z+1)),O=Math.floor(I%(Z+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,O>>24,O>>16&255,O>>8&255,O&255])),P.trun(j,k.length+16+20+8+16+8+8),k)},P.trak=function(j){return j.duration=j.duration||4294967295,P.box(P.types.trak,P.tkhd(j),P.mdia(j))},P.trex=function(j){var I=j.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(j,I){var k=j.samples||[],v=k.length,A=12+16*v,O=new Uint8Array(A),_,S,T,h,o,l;for(I+=8+A,O.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),_=0;_<v;_++)S=k[_],T=S.duration,h=S.size,o=S.flags,l=S.cts,O.set([T>>>24&255,T>>>16&255,T>>>8&255,T&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*_);return P.box(P.types.trun,O)},P.initSegment=function(j){P.types||P.init();var I=P.moov(j),k=new Uint8Array(P.FTYP.byteLength+I.byteLength);return k.set(P.FTYP),k.set(I,P.FTYP.byteLength),k},P}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Q.default=B},"./src/remux/mp4-remuxer.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"normalizePts",function(){return d});var Z=D("./src/polyfills/number.ts"),B=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),z=D("./src/events.ts"),j=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),k=D("./src/types/loader.ts"),v=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var m=arguments[b];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},A.apply(this,arguments)}var O=10*1e3,_=1024,S=1152,T=null,h=null,o=!1,l=function(){function L(m,c,u,a){if(a===void 0&&(a=""),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=m,this.config=c,this.typeSupported=u,this.ISGenerated=!1,T===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);T=y?parseInt(y[1]):0}if(h===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);h=E?parseInt(E[1]):0}o=!!T&&T<75||!!h&&h<600}var b=L.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(x,y){var E=y.pts-x;return E<-4294967296?(u=!0,d(x,y.pts)):E>0?x:y.pts},c[0].pts);return u&&I.logger.debug("PTS rollover detected"),a},b.remux=function(c,u,a,x,y,E,N,U){var K,V,R,M,$,ee,oe=y,ce=y,De=c.pid>-1,Ee=u.pid>-1,Ce=u.samples.length,Te=c.samples.length>0,we=Ce>1,me=(!De||Te)&&(!Ee||we)||this.ISGenerated||N;if(me){this.ISGenerated||(R=this.generateIS(c,u,y));var le=this.isVideoContiguous,te=-1;if(we&&(te=C(u.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){I.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ce+" video samples due to a missing keyframe");var he=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(te),u.dropped+=te,ce+=(u.samples[0].pts-he)/(u.timescale||9e4)}else te===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),ee=!1);if(this.ISGenerated){if(Te&&we){var ie=this.getVideoStartPts(u.samples),Ae=d(c.samples[0].pts,ie)-ie,Re=Ae/u.inputTimeScale;oe+=Math.max(0,Re),ce+=Math.max(0,-Re)}if(Te){if(c.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),R=this.generateIS(c,u,y)),V=this.remuxAudio(c,oe,this.isAudioContiguous,E,Ee||we||U===k.PlaylistLevelType.AUDIO?ce:void 0),we){var ye=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),R=this.generateIS(c,u,y)),K=this.remuxVideo(u,ce,le,ye)}}else we&&(K=this.remuxVideo(u,ce,le,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,y)),x.samples.length&&(M=this.remuxText(x,y))),{audio:V,video:K,initSegment:R,independent:ee,text:M,id3:$}},b.generateIS=function(c,u,a){var x=c.samples,y=u.samples,E=this.typeSupported,N={},U=!Object(Z.isFiniteNumber)(this._initPTS),K="audio/mp4",V,R,M;if(U&&(V=R=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(K="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),N.audio={id:"audio",container:K,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(M=c.inputTimeScale,V=R=x[0].pts-Math.round(M*a))),u.sps&&u.pps&&y.length&&(u.timescale=u.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:P.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){M=u.inputTimeScale;var $=this.getVideoStartPts(y),ee=Math.round(M*a);R=Math.min(R,d(y[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(N).length)return this.ISGenerated=!0,U&&(this._initPTS=V,this._initDTS=R),{tracks:N,initPTS:V,timescale:M}},b.remuxVideo=function(c,u,a,x){var y=c.inputTimeScale,E=c.samples,N=[],U=E.length,K=this._initPTS,V=this.nextAvcDts,R=8,M,$,ee,oe=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,De=0,Ee=!1;if(!a||V===null){var Ce=u*y,Te=E[0].pts-d(E[0].dts,E[0].pts);V=Ce-Te}for(var we=0;we<U;we++){var me=E[we];if(me.pts=d(me.pts-K,V),me.dts=d(me.dts-K,V),me.dts>me.pts){var le=9e4*.2;De=Math.max(Math.min(De,me.pts-me.dts),-1*le)}me.dts<E[we>0?we-1:we].dts&&(Ee=!0)}Ee&&E.sort(function(wt,St){var dt=wt.dts-St.dts,Gt=wt.pts-St.pts;return dt||Gt}),$=E[0].dts,ee=E[E.length-1].dts;var te=Math.round((ee-$)/(U-1));if(De<0){if(De<te*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-te,!0)+" ms");for(var he=De,ie=0;ie<U;ie++)E[ie].dts=he=Math.max(he,E[ie].pts-te),E[ie].pts=Math.max(he,E[ie].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(De,!0)+" ms to overcome this issue");for(var Ae=0;Ae<U;Ae++)E[Ae].dts=E[Ae].dts+De}$=E[0].dts}if(a){var Re=$-V,ye=Re>te,Oe=Re<-1;if(ye||Oe){ye?I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),$=V;var Me=E[0].pts-Re;E[0].dts=$,E[0].pts=Me,I.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Me,!0)+"/"+Object(v.toMsFromMpegTsClock)($,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Re,!0)+" ms")}}o&&($=Math.max(0,$));for(var Ie=0,je=0,Be=0;Be<U;Be++){for(var Ne=E[Be],rt=Ne.units,qe=rt.length,Ye=0,$e=0;$e<qe;$e++)Ye+=rt[$e].data.length;je+=Ye,Ie+=qe,Ne.length=Ye,Ne.dts=Math.max(Ne.dts,$),Ne.pts=Math.max(Ne.pts,Ne.dts,0),oe=Math.min(Ne.pts,oe),ce=Math.max(Ne.pts,ce)}ee=E[U-1].dts;var ht=je+4*Ie+8,Qe;try{Qe=new Uint8Array(ht)}catch(wt){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating video mdat "+ht});return}var nt=new DataView(Qe.buffer);nt.setUint32(0,ht),Qe.set(P.default.types.mdat,4);for(var Pe=0;Pe<U;Pe++){for(var ct=E[Pe],at=ct.units,Ue=0,Ke=0,xe=at.length;Ke<xe;Ke++){var ge=at[Ke],be=ge.data,re=ge.data.byteLength;nt.setUint32(R,re),R+=4,Qe.set(be,R),R+=re,Ue+=4+re}if(Pe<U-1)M=E[Pe+1].dts-ct.dts;else{var ne=this.config,se=ct.dts-E[Pe>0?Pe-1:Pe].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ne.maxBufferHole*y),Le=(x?oe+x*y:this.nextAudioPts)-ct.pts;Le>de?(M=Le-se,M<0&&(M=se),I.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=se}else M=se}var Se=Math.round(ct.pts-ct.dts);N.push(new p(ct.key,M,Ue,Se))}if(N.length&&T&&T<70){var We=N[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+M,this.isVideoContiguous=!0;var it=P.default.moof(c.sequenceNumber++,$,A({},c,{samples:N})),ft="video",st={data1:it,data2:Qe,startPTS:oe/y,endPTS:(ce+M)/y,startDTS:$/y,endDTS:V/y,type:ft,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Qe.length,"MDAT length must not be zero"),st},b.remuxAudio=function(c,u,a,x,y){var E=c.inputTimeScale,N=c.samplerate?c.samplerate:E,U=E/N,K=c.isAAC?_:S,V=K*U,R=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,$=[],ee=c.samples,oe=M?0:8,ce=this.nextAudioPts||-1,De=u*E;if(this.isAudioContiguous=a=a||ee.length&&ce>0&&(x&&Math.abs(De-ce)<9e3||Math.abs(d(ee[0].pts-R,De)-ce)<20*V),ee.forEach(function(be){be.pts=d(be.pts-R,De)}),!a||ce<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;y===0?ce=0:x?ce=Math.max(0,De):ce=ee[0].pts}if(c.isAAC)for(var Ee=y!==void 0,Ce=this.config.maxAudioFramesDrift,Te=0,we=ce;Te<ee.length;Te++){var me=ee[Te],le=me.pts,te=le-we,he=Math.abs(1e3*te/E);if(te<=-Ce*V&&Ee)Te===0&&(I.logger.warn("Audio frame @ "+(le/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/E)+" ms."),this.nextAudioPts=ce=we=le);else if(te>=Ce*V&&he<O&&Ee){var ie=Math.round(te/V);we=le-ie*V,we<0&&(ie--,we+=V),Te===0&&(this.nextAudioPts=ce=we),I.logger.warn("[mp4-remuxer]: Injecting "+ie+" audio frame @ "+(we/E).toFixed(3)+"s due to "+Math.round(1e3*te/E)+" ms gap.");for(var Ae=0;Ae<ie;Ae++){var Re=Math.max(we,0),ye=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=me.unit.subarray()),ee.splice(Te,0,{unit:ye,pts:Re}),we+=V,Te++}}me.pts=we,we+=V}for(var Oe=null,Me=null,Ie,je=0,Be=ee.length;Be--;)je+=ee[Be].unit.byteLength;for(var Ne=0,rt=ee.length;Ne<rt;Ne++){var qe=ee[Ne],Ye=qe.unit,$e=qe.pts;if(Me!==null){var ht=$[Ne-1];ht.duration=Math.round(($e-Me)/U)}else if(a&&c.isAAC&&($e=ce),Oe=$e,je>0){je+=oe;try{Ie=new Uint8Array(je)}catch(be){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!M){var Qe=new DataView(Ie.buffer);Qe.setUint32(0,je),Ie.set(P.default.types.mdat,4)}}else return;Ie.set(Ye,oe);var nt=Ye.byteLength;oe+=nt,$.push(new p(!0,K,nt,0)),Me=$e}var Pe=$.length;if(!Pe)return;var ct=$[$.length-1];this.nextAudioPts=ce=Me+U*ct.duration;var at=M?new Uint8Array(0):P.default.moof(c.sequenceNumber++,Oe/U,A({},c,{samples:$}));c.samples=[];var Ue=Oe/E,Ke=ce/E,xe="audio",ge={data1:at,data2:Ie,startPTS:Ue,endPTS:Ke,startDTS:Ue,endDTS:Ke,type:xe,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(Ie.length,"MDAT length must not be zero"),ge},b.remuxEmptyAudio=function(c,u,a,x){var y=c.inputTimeScale,E=c.samplerate?c.samplerate:y,N=y/E,U=this.nextAudioPts,K=(U!==null?U:x.startDTS*y)+this._initDTS,V=x.endDTS*y+this._initDTS,R=N*_,M=Math.ceil((V-K)/R),$=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<M;oe++){var ce=K+oe*R;ee.push({unit:$,pts:ce,dts:ce})}return c.samples=ee,this.remuxAudio(c,u,a,!1)},b.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,E=this._initDTS,N=0;N<a;N++){var U=c.samples[N];U.pts=d(U.pts-y,u*x)/x,U.dts=d(U.dts-E,u*x)/x}var K=c.samples;return c.samples=[],{samples:K}},b.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,E=0;E<a;E++){var N=c.samples[E];N.pts=d(N.pts-y,u*x)/x}c.samples.sort(function(K,V){return K.pts-V.pts});var U=c.samples;return c.samples=[],{samples:U}},L}();function d(L,b){var m;if(b===null)return L;for(b<L?m=-8589934592:m=8589934592;Math.abs(L-b)>4294967296;)L+=m;return L}function C(L){for(var b=0;b<L.length;b++)if(L[b].key)return b;return-1}var p=function(b,m,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=c,this.cts=u,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),z=D("./src/utils/logger.ts"),j=function(){function v(){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 A=v.prototype;return A.destroy=function(){},A.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(_,S,T){this.audioCodec=S,this.videoCodec=T,this.generateInitSegment(_),this.emitInitSegment=!0},A.generateInitSegment=function(_){var S=this.audioCodec,T=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(B.parseInitSegment)(_);S||(S=k(h.audio,P.ElementaryStreamTypes.AUDIO)),T||(T=k(h.video,P.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:S+","+T,initSegment:_,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:S,initSegment:_,id:"audio"}:h.video?o.video={container:"video/mp4",codec:T,initSegment:_,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(_,S,T,h,o){var l=this.initPTS,d=this.lastEndDTS,C={audio:void 0,video:void 0,text:h,id3:T,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var p=S.samples;if(!p||!p.length)return C;var f={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(p),L=this.initData),!L||!L.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=I(L,p,d));var b=Object(B.getDuration)(p,L),m=d,c=b+m;Object(B.offsetStartDTS)(L,p,l),b>0?this.lastEndDTS=c:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,a=!!L.video,x="";u&&(x+="audio"),a&&(x+="video");var y={data1:p,startPTS:m,startDTS:m,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:a,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=h,C.id3=T,C.initSegment=f,C},v}(),I=function(A,O,_){return Object(B.getStartDTS)(A,O)-_};function k(v,A){var O=v==null?void 0:v.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Q.default=j},"./src/task-loop.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=B.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"CMCDVersion",function(){return Z}),D.d(Q,"CMCDObjectType",function(){return B}),D.d(Q,"CMCDStreamingFormat",function(){return P}),D.d(Q,"CMCDStreamType",function(){return z});var Z=1,B;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(B||(B={}));var P;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(P||(P={}));var z;(function(j){j.VOD="v",j.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"HlsSkip",function(){return P}),D.d(Q,"getSkipValue",function(){return z}),D.d(Q,"HlsUrlParameters",function(){return j}),D.d(Q,"Level",function(){return I});function Z(k,v){for(var A=0;A<v.length;A++){var O=v[A];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(k,O.key,O)}}function B(k,v,A){return v&&Z(k.prototype,v),A&&Z(k,A),k}var P;(function(k){k.No="",k.Yes="YES",k.v2="v2"})(P||(P={}));function z(k,v){var A=k.canSkipUntil,O=k.canSkipDateRanges,_=k.endSN,S=v!==void 0?v-_:0;return A&&S<A?O?P.v2:P.Yes:P.No}var j=function(){function k(A,O,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=O,this.skip=_}var v=k.prototype;return v.addDirectives=function(O){var _=new self.URL(O);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},k}(),I=function(){function k(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return B(k,[{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(A){var O=A%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),k}()},"./src/types/loader.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"PlaylistContextType",function(){return Z}),D.d(Q,"PlaylistLevelType",function(){return B});var Z;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var B;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"ChunkMetadata",function(){return Z});var Z=function(z,j,I,k,v,A){k===void 0&&(k=0),v===void 0&&(v=-1),A===void 0&&(A=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=z,this.sn=j,this.id=I,this.size=k,this.part=v,this.partial=A};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"AttrList",function(){return P});var Z=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function z(I){typeof I=="string"&&(I=z.parseAttrList(I));for(var k in I)I.hasOwnProperty(k)&&(this[k]=I[k])}var j=z.prototype;return j.decimalInteger=function(k){var v=parseInt(this[k],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.hexadecimalInteger=function(k){if(this[k]){var v=(this[k]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var A=new Uint8Array(v.length/2),O=0;O<v.length/2;O++)A[O]=parseInt(v.slice(O*2,O*2+2),16);return A}else return null},j.hexadecimalIntegerAsNumber=function(k){var v=parseInt(this[k],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.decimalFloatingPoint=function(k){return parseFloat(this[k])},j.optionalFloat=function(k,v){var A=this[k];return A?parseFloat(A):v},j.enumeratedString=function(k){return this[k]},j.bool=function(k){return this[k]==="YES"},j.decimalResolution=function(k){var v=Z.exec(this[k]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},z.parseAttrList=function(k){var v,A={},O='"';for(B.lastIndex=0;(v=B.exec(k))!==null;){var _=v[2];_.indexOf(O)===0&&_.lastIndexOf(O)===_.length-1&&(_=_.slice(1,-1)),A[v[1]]=_}return A},z}()},"./src/utils/binary-search.ts":function(ue,Q,D){"use strict";D.r(Q);var Z={search:function(P,z){for(var j=0,I=P.length-1,k=null,v=null;j<=I;){k=(j+I)/2|0,v=P[k];var A=z(v);if(A>0)j=k+1;else if(A<0)I=k-1;else return v}return null}};Q.default=Z},"./src/utils/buffer-helper.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"BufferHelper",function(){return P});var Z=D("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function z(){}return z.isBuffered=function(I,k){try{if(I){for(var v=z.getBuffered(I),A=0;A<v.length;A++)if(k>=v.start(A)&&k<=v.end(A))return!0}}catch(O){}return!1},z.bufferInfo=function(I,k,v){try{if(I){var A=z.getBuffered(I),O=[],_;for(_=0;_<A.length;_++)O.push({start:A.start(_),end:A.end(_)});return this.bufferedInfo(O,k,v)}}catch(S){}return{len:0,start:k,end:k,nextStart:void 0}},z.bufferedInfo=function(I,k,v){k=Math.max(0,k),I.sort(function(f,L){var b=f.start-L.start;return b||L.end-f.end});var A=[];if(v)for(var O=0;O<I.length;O++){var _=A.length;if(_){var S=A[_-1].end;I[O].start-S<v?I[O].end>S&&(A[_-1].end=I[O].end):A.push(I[O])}else A.push(I[O])}else A=I;for(var T=0,h,o=k,l=k,d=0;d<A.length;d++){var C=A[d].start,p=A[d].end;if(k+v>=C&&k<p)o=C,l=p,T=l-k;else if(k+v<C){h=C;break}}return{len:T,start:o||0,end:l||0,nextStart:h}},z.getBuffered=function(I){try{return I.buffered}catch(k){return Z.logger.log("failed to get media.buffered",k),B}},z}()},"./src/utils/cea-608-parser.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"Row",function(){return l}),D.d(Q,"CaptionScreen",function(){return d});var Z=D("./src/utils/logger.ts"),B={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var u=c;return B.hasOwnProperty(c)&&(u=B[c]),String.fromCharCode(u)},z=15,j=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},k={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(_||(_={}));var S=function(){function m(){this.time=null,this.verboseLevel=_.ERROR}var c=m.prototype;return c.log=function(a,x){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+x)},m}(),T=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},h=function(){function m(u,a,x,y,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=x||!1,this.background=y||"black",this.flash=E||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var E=x[y];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),o=function(){function m(u,a,x,y,E,N){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new h(a,x,y,E,N)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<j;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new h}var c=m.prototype;return c.equals=function(a){for(var x=!0,y=0;y<j;y++)if(!this.chars[y].equals(a.chars[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<j;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<j;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=P(a);if(this.pos>=j){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<j;x++)this.chars[x].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 a=[],x=!0,y=0;y<j;y++){var E=this.chars[y].uchar;E!==" "&&(x=!1),a.push(E)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},m}(),d=function(){function m(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<z;a++)this.rows.push(new l(u));this.logger=u,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var a=0;a<z;a++)this.rows[a].clear();this.currRow=z-1},c.equals=function(a){for(var x=!0,y=0;y<z;y++)if(!this.rows[y].equals(a.rows[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<z;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<z;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<z;y++)this.rows[y].clear();var E=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var U=N.rows[E].cueStartTime,K=this.logger.time;if(U&&K!==null&&U<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[x-this.nrRollUpRows+V+1].copy(N.rows[E+V])}}this.currRow=x;var R=this.rows[this.currRow];if(a.indent!==null){var M=a.indent,$=Math.max(M-1,0);R.setCursor(a.indent),a.color=R.chars[$].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},c.setBkgData=function(a){this.logger.log(_.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(_.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],y="",E=-1,N=0;N<z;N++){var U=this.rows[N].getTextString();U&&(E=N+1,a?x.push("Row "+E+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(a?y="["+x.join(" | ")+"]":y=x.join(`
`)),y},c.getTextAndFormat=function(){return this.rows},m}(),C=function(){function m(u,a,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(x),this.nonDisplayedMemory=new d(x),this.lastOutputScreen=new d(x),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=m.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[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(_.INFO,"MODE="+a),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=a},c.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(_.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(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(_.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(_.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(_.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var y=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=E[y]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},m}(),p=function(){function m(u,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new S;this.channels=[null,new C(u,a,y),new C(u+1,x,y)],this.cmdHistory=b(),this.logger=y}var c=m.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var y,E,N,U=!1;this.logger.time=a;for(var K=0;K<x.length;K+=2){if(E=x[K]&127,N=x[K+1]&127,E===0&&N===0)continue;if(this.logger.log(_.DATA,"["+T([x[K],x[K+1]])+"] -> ("+T([E,N])+")"),y=this.parseCmd(E,N),y||(y=this.parseMidrow(E,N)),y||(y=this.parsePAC(E,N)),y||(y=this.parseBackgroundAttributes(E,N)),!y&&(U=this.parseChars(E,N),U)){var V=this.currentChannel;if(V&&V>0){var R=this.channels[V];R.insertChars(U)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+T([E,N])+" orig: "+T([x[K],x[K+1]]))}},c.parseCmd=function(a,x){var y=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,N=(a===23||a===31)&&x>=33&&x<=35;if(!(E||N))return!1;if(L(a,x,y))return f(null,null,y),this.logger.log(_.DEBUG,"Repeated command ("+T([a,x])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,K=this.channels[U];return a===20||a===21||a===28||a===29?x===32?K.ccRCL():x===33?K.ccBS():x===34?K.ccAOF():x===35?K.ccAON():x===36?K.ccDER():x===37?K.ccRU(2):x===38?K.ccRU(3):x===39?K.ccRU(4):x===40?K.ccFON():x===41?K.ccRDC():x===42?K.ccTR():x===43?K.ccRTD():x===44?K.ccEDM():x===45?K.ccCR():x===46?K.ccENM():x===47&&K.ccEOC():K.ccTO(x-32),f(a,x,y),this.currentChannel=U,!0},c.parseMidrow=function(a,x){var y=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[y];return E?(E.ccMIDROW(x),this.logger.log(_.DEBUG,"MIDROW ("+T([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var y,E=this.cmdHistory,N=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,U=(a===16||a===24)&&x>=64&&x<=95;if(!(N||U))return!1;if(L(a,x,E))return f(null,null,E),!0;var K=a<=23?1:2;x>=64&&x<=95?y=K===1?I[a]:v[a]:y=K===1?k[a]:A[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(y,x)),f(a,x,E),this.currentChannel=K,!0):!1},c.interpretPAC=function(a,x){var y,E={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?y=x-96:y=x-64,E.underline=(y&1)===1,y<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((y-16)/2)*4,E},c.parseChars=function(a,x){var y,E=null,N=null;if(a>=25?(y=2,N=a-8):(y=1,N=a),N>=17&&N<=19){var U;N===17?U=x+80:N===18?U=x+112:U=x+144,this.logger.log(_.INFO,"Special char '"+P(U)+"' in channel "+y),E=[U]}else a>=32&&a<=127&&(E=x===0?[a]:[a,x]);if(E){var K=T(E);this.logger.log(_.DEBUG,"Char codes = "+K.join(",")),f(a,x,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,x){var y=(a===16||a===24)&&x>=32&&x<=47,E=(a===23||a===31)&&x>=45&&x<=47;if(!(y||E))return!1;var N,U={};a===16||a===24?(N=Math.floor((x-32)/2),U.background=O[N],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(U),f(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(a)}},m}();function f(m,c,u){u.a=m,u.b=c}function L(m,c,u){return u.a===m&&u.b===c}function b(){return{a:null,b:null}}Q.default=p},"./src/utils/codecs.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"isCodecType",function(){return B}),D.d(Q,"isCodecSupportedInMp4",function(){return P});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function B(z,j){var I=Z[j];return!!I&&I[z.slice(0,4)]===!0}function P(z,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/vttparser.ts"),B=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),z=/\s/,j={newCue:function(k,v,A,O){for(var _=[],S,T,h,o,l,d=self.VTTCue||self.TextTrackCue,C=0;C<O.rows.length;C++)if(S=O.rows[C],h=!0,o=0,l="",!S.isEmpty()){for(var p=0;p<S.chars.length;p++)z.test(S.chars[p].uchar)&&h?o++:(l+=S.chars[p].uchar,h=!1);S.cueStartTime=v,v===A&&(A+=1e-4),o>=16?o--:o++;var f=Object(Z.fixLineBreaks)(l.trim()),L=Object(B.generateCueId)(v,A,f);(!k||!k.cues||!k.cues.getCueById(L))&&(T=new d(v,A,f),T.id=L,T.line=C+1,T.align="left",T.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(T))}return k&&_.length&&(_.sort(function(b,m){return b.line==="auto"||m.line==="auto"?0:b.line>8&&m.line>8?m.line-b.line:b.line-m.line}),_.forEach(function(b){return Object(P.addCueToTrack)(k,b)})),_}};Q.default=j},"./src/utils/discontinuities.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"findFirstFragWithCC",function(){return z}),D.d(Q,"shouldAlignOnDiscontinuities",function(){return j}),D.d(Q,"findDiscontinuousReferenceFrag",function(){return I}),D.d(Q,"adjustSlidingStart",function(){return v}),D.d(Q,"alignStream",function(){return A}),D.d(Q,"alignPDT",function(){return _}),D.d(Q,"alignFragmentByPDTDelta",function(){return S}),D.d(Q,"alignMediaPlaylistByPDT",function(){return T});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function z(h,o){for(var l=null,d=0,C=h.length;d<C;d++){var p=h[d];if(p&&p.cc===o){l=p;break}}return l}function j(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function I(h,o){var l=h.fragments,d=o.fragments;if(!d.length||!l.length){B.logger.log("No fragments to align");return}var C=z(l,d[0].cc);if(!C||C&&!C.startPTS){B.logger.log("No frag in previous level to align on");return}return C}function k(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function v(h,o){for(var l=o.fragments,d=0,C=l.length;d<C;d++)k(l[d],h);o.fragmentHint&&k(o.fragmentHint,h),o.alignedSliding=!0}function A(h,o,l){if(!o)return;O(h,l,o),!l.alignedSliding&&o.details&&_(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(P.adjustSliding)(o.details,l)}function O(h,o,l){if(j(h,l,o)){var d=I(l.details,o);d&&Object(Z.isFiniteNumber)(d.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),v(d.start,o))}}function _(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,C=(d-l)/1e3+o.fragments[0].start;C&&Object(Z.isFiniteNumber)(C)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+C.toFixed(3)+" "+h.url+" "),v(C,h))}function S(h,o){var l=h.programDateTime;if(!l)return;var d=(l-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function T(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,C=l-d*1e3;h.fragments.forEach(function(p){S(p,C)}),h.fragmentHint&&S(h.fragmentHint,C),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/ewma.ts"),B=function(){function P(j,I,k){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=k,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(j),this.fast_=new Z.default(I)}var z=P.prototype;return z.update=function(I,k){var v=this.slow_,A=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new Z.default(I,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==k&&(this.fast_=new Z.default(k,A.getEstimate(),A.getTotalWeight()))},z.sample=function(I,k){I=Math.max(I,this.minDelayMs_);var v=8*k,A=I/1e3,O=v/A;this.fast_.sample(A,O),this.slow_.sample(A,O)},z.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},P}();Q.default=B},"./src/utils/ewma.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=function(){function B(z,j,I){j===void 0&&(j=0),I===void 0&&(I=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=z,this.alpha_=z?Math.exp(Math.log(.5)/z):0,this.estimate_=j,this.totalWeight_=I}var P=B.prototype;return P.sample=function(j,I){var k=Math.pow(this.alpha_,j);this.estimate_=I*(1-k)+k*this.estimate_,this.totalWeight_+=j},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},B}();Q.default=Z},"./src/utils/fetch-loader.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"fetchSupported",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function z(d,C){d.prototype=Object.create(C.prototype),d.prototype.constructor=d,A(d,C)}function j(d){var C=typeof Map=="function"?new Map:void 0;return j=function(f){if(f===null||!v(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(f))return C.get(f);C.set(f,L)}function L(){return I(f,arguments,O(this).constructor)}return L.prototype=Object.create(f.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),A(L,f)},j(d)}function I(d,C,p){return k()?I=Reflect.construct:I=function(L,b,m){var c=[null];c.push.apply(c,b);var u=Function.bind.apply(L,c),a=new u;return m&&A(a,m.prototype),a},I.apply(null,arguments)}function k(){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 v(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,C){return A=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},A(d,C)}function O(d){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(d)}function _(){return _=Object.assign||function(d){for(var C=1;C<arguments.length;C++){var p=arguments[C];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(d[f]=p[f])}return d},_.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var T=function(){function d(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new B.LoadStats}var C=d.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(f,L,b){var m=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=h(f,this.controller.signal),a=b.onProgress,x=f.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=f,this.config=L,this.callbacks=b,this.request=this.fetchSetup(f,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),b.onTimeout(c,f,m.response)},L.timeout),self.fetch(this.request).then(function(E){if(m.response=m.loader=E,!E.ok){var N=E.status,U=E.statusText;throw new l(U||"fetch, bad network response",N,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(L.highWaterMark)?m.loadProgressively(E,c,f,L.highWaterMark,a):x?E.arrayBuffer():E.text()}).then(function(E){var N=m.response;self.clearTimeout(m.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[y];var U={url:N.url,data:E};a&&!Object(Z.isFiniteNumber)(L.highWaterMark)&&a(c,f,E,N),b.onSuccess(U,c,f,N)}).catch(function(E){if(self.clearTimeout(m.requestTimeout),c.aborted)return;var N=E.code||0;b.onError({code:N,text:E.message},f,E.details)})},C.getCacheAge=function(){var f=null;if(this.response){var L=this.response.headers.get("age");f=L?parseFloat(L):null}return f},C.loadProgressively=function(f,L,b,m,c){m===void 0&&(m=0);var u=new P.default,a=f.body.getReader(),x=function y(){return a.read().then(function(E){if(E.done)return u.dataLength&&c(L,b,u.flush(),f),Promise.resolve(new ArrayBuffer(0));var N=E.value,U=N.length;return L.loaded+=U,U<m||u.dataLength?(u.push(N),u.dataLength>=m&&c(L,b,u.flush(),f)):c(L,b,N,f),y()}).catch(function(){return Promise.reject()})};return x()},d}();function h(d,C){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(_({},d.headers))};return d.rangeEnd&&p.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),p}function o(d,C){return new self.Request(d.url,C)}var l=function(d){z(C,d);function C(p,f,L){var b;return b=d.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=L,b}return C}(j(Error));Q.default=T},"./src/utils/imsc1-ttml-parser.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"IMSC1_CODEC",function(){return v}),D.d(Q,"parseIMSC1",function(){return S});var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),z=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function k(){return k=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(m[a]=u[a])}return m},k.apply(this,arguments)}var v="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(m,c,u,a,x){var y=Object(Z.findBox)(new Uint8Array(m),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var E=y[0],N=Object(z.utf8ArrayToStr)(new Uint8Array(m,E.start,E.end-E.start)),U=Object(j.toTimescaleFromScale)(c,1,u);try{a(T(N,U))}catch(K){x(K)}}function T(m,c){var u=new DOMParser,a=u.parseFromString(m,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(y).reduce(function(R,M){return R[M]=x.getAttribute("ttp:"+M)||y[M],R},{}),N=x.getAttribute("xml:space")!=="preserve",U=o(h(x,"styling","style")),K=o(h(x,"layout","region")),V=h(x,"body","[begin]");return[].map.call(V,function(R){var M=l(R,N);if(!M||!R.hasAttribute("begin"))return null;var $=f(R.getAttribute("begin"),E),ee=f(R.getAttribute("dur"),E),oe=f(R.getAttribute("end"),E);if($===null)throw p(R);if(oe===null){if(ee===null)throw p(R);oe=$+ee}var ce=new P.default($-c,oe-c,M);ce.id=Object(I.generateCueId)(ce.startTime,ce.endTime,ce.text);var De=K[R.getAttribute("region")],Ee=U[R.getAttribute("style")];ce.position=10,ce.size=80;var Ce=d(De,Ee),Te=Ce.textAlign;if(Te){var we=_[Te];we&&(ce.lineAlign=we),ce.align=Te}return k(ce,Ce),ce}).filter(function(R){return R!==null})}function h(m,c,u){var a=m.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(m){return m.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(m,c){return[].slice.call(m.childNodes).reduce(function(u,a,x){var y;return a.nodeName==="br"&&x?u+`
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function d(m,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,y){var E=C(c,u,y)||C(m,u,y);return E&&(x[y]=E),x},{})}function C(m,c,u){return m.hasAttributeNS(c,u)?m.getAttributeNS(c,u):null}function p(m){return new Error("Could not parse ttml timestamp "+m)}function f(m,c){if(!m)return null;var u=Object(B.parseTimeStamp)(m);return u===null&&(A.test(m)?u=L(m,c):O.test(m)&&(u=b(m,c))),u}function L(m,c){var u=A.exec(m),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function b(m,c){var u=O.exec(m),a=Number(u[1]),x=u[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"enableLogs",function(){return I}),D.d(Q,"logger",function(){return k});var Z=function(){},B={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},P=B;function z(v){var A=self.console[v];return A?A.bind(self.console,"["+v+"] >"):Z}function j(v){for(var A=arguments.length,O=new Array(A>1?A-1:0),_=1;_<A;_++)O[_-1]=arguments[_];O.forEach(function(S){P[S]=v[S]?v[S].bind(v):z(S)})}function I(v){if(self.console&&v===!0||typeof v=="object"){j(v,"debug","log","info","warn","error");try{P.log()}catch(A){P=B}}else P=B}var k=P},"./src/utils/mediakeys-helper.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"KeySystems",function(){return Z}),D.d(Q,"requestMediaKeySystemAccess",function(){return B});var Z;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"bin2str",function(){return j}),D.d(Q,"readUint16",function(){return I}),D.d(Q,"readUint32",function(){return k}),D.d(Q,"writeUint32",function(){return v}),D.d(Q,"findBox",function(){return A}),D.d(Q,"parseSegmentIndex",function(){return O}),D.d(Q,"parseInitSegment",function(){return _}),D.d(Q,"getStartDTS",function(){return S}),D.d(Q,"getDuration",function(){return T}),D.d(Q,"computeRawDurationFromSamples",function(){return h}),D.d(Q,"offsetStartDTS",function(){return o}),D.d(Q,"segmentValidRange",function(){return l}),D.d(Q,"appendUint8Array",function(){return d});var Z=D("./src/utils/typed-array.ts"),B=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,z=[].push;function j(C){return String.fromCharCode.apply(null,C)}function I(C,p){"data"in C&&(p+=C.start,C=C.data);var f=C[p]<<8|C[p+1];return f<0?65536+f:f}function k(C,p){"data"in C&&(p+=C.start,C=C.data);var f=C[p]<<24|C[p+1]<<16|C[p+2]<<8|C[p+3];return f<0?4294967296+f:f}function v(C,p,f){"data"in C&&(p+=C.start,C=C.data),C[p]=f>>24,C[p+1]=f>>16&255,C[p+2]=f>>8&255,C[p+3]=f&255}function A(C,p){var f=[];if(!p.length)return f;var L,b,m;"data"in C?(L=C.data,b=C.start,m=C.end):(L=C,b=0,m=L.byteLength);for(var c=b;c<m;){var u=k(L,c),a=j(L.subarray(c+4,c+8)),x=u>1?c+u:m;if(a===p[0])if(p.length===1)f.push({data:L,start:c+8,end:x});else{var y=A({data:L,start:c+8,end:x},p.slice(1));y.length&&z.apply(f,y)}c=x}return f}function O(C){var p=A(C,["moov"]),f=p[0],L=f?f.end:null,b=A(C,["sidx"]);if(!b||!b[0])return null;var m=[],c=b[0],u=c.data[0],a=u===0?8:16,x=k(c,a);a+=4;var y=0,E=0;u===0?a+=8:a+=16,a+=2;var N=c.end+E,U=I(c,a);a+=2;for(var K=0;K<U;K++){var V=a,R=k(c,V);V+=4;var M=R&2147483647,$=(R&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=k(c,V);V+=4,m.push({referenceSize:M,subsegmentDuration:ee,info:{duration:ee/x,start:N,end:N+M-1}}),N+=M,V+=4,a=V}return{earliestPresentationTime:y,timescale:x,version:u,referencesCount:U,references:m,moovEndOffset:L}}function _(C){for(var p=[],f=A(C,["moov","trak"]),L=0;L<f.length;L++){var b=f[L],m=A(b,["tkhd"])[0];if(m){var c=m.data[m.start],u=c===0?12:20,a=k(m,u),x=A(b,["mdia","mdhd"])[0];if(x){c=x.data[x.start],u=c===0?12:20;var y=k(x,u),E=A(b,["mdia","hdlr"])[0];if(E){var N=j(E.data.subarray(E.start+8,E.start+12)),U={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(U){var K=A(b,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=j(K.data.subarray(K.start+12,K.start+16))),p[a]={timescale:y,type:U},p[U]={timescale:y,id:a,codec:V}}}}}}var R=A(C,["moov","mvex","trex"]);return R.forEach(function(M){var $=k(M,4),ee=p[$];ee&&(ee.default={duration:k(M,12),flags:k(M,20)})}),p}function S(C,p){return A(p,["moof","traf"]).reduce(function(f,L){var b=A(L,["tfdt"])[0],m=b.data[b.start],c=A(L,["tfhd"]).reduce(function(u,a){var x=k(a,4),y=C[x];if(y){var E=k(b,4);m===1&&(E*=Math.pow(2,32),E+=k(b,8));var N=y.timescale||9e4,U=E/N;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function T(C,p){for(var f=0,L=0,b=0,m=A(C,["moof","traf"]),c=0;c<m.length;c++){var u=m[c],a=A(u,["tfhd"])[0],x=k(a,4),y=p[x];if(!y)continue;var E=y.default,N=k(a,0)|(E==null?void 0:E.flags),U=E==null?void 0:E.duration;N&8&&(N&2?U=k(a,12):U=k(a,8));for(var K=y.timescale||9e4,V=A(u,["trun"]),R=0;R<V.length;R++){if(U){var M=k(V[R],4);f=U*M}else f=h(V[R]);y.type===B.ElementaryStreamTypes.VIDEO?L+=f/K:y.type===B.ElementaryStreamTypes.AUDIO&&(b+=f/K)}}if(L===0&&b===0){var $=O(C);if($!=null&&$.references)return $.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return L||b}function h(C){var p=k(C,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var L=0,b=k(C,4),m=0;m<b;m++){if(p&256){var c=k(C,f);L+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return L}function o(C,p,f){A(p,["moof","traf"]).forEach(function(L){A(L,["tfhd"]).forEach(function(b){var m=k(b,4),c=C[m];if(!c)return;var u=c.timescale||9e4;A(L,["tfdt"]).forEach(function(a){var x=a.data[a.start],y=k(a,4);if(x===0)v(a,4,y-f*u);else{y*=Math.pow(2,32),y+=k(a,8),y-=f*u,y=Math.max(y,0);var E=Math.floor(y/(P+1)),N=Math.floor(y%(P+1));v(a,4,E),v(a,8,N)}})})})}function l(C){var p={valid:null,remainder:null},f=A(C,["moof"]);if(f){if(f.length<2)return p.remainder=C,p}else return p;var L=f[f.length-1];return p.valid=Object(Z.sliceUint8)(C,0,L.start-8),p.remainder=Object(Z.sliceUint8)(C,L.start-8),p}function d(C,p){var f=new Uint8Array(C.length+p.length);return f.set(C),f.set(p,C.length),f}},"./src/utils/output-filter.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(z,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=j}var P=B.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(j,I,k){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=I,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"sendAddTrackEvent",function(){return B}),D.d(Q,"addCueToTrack",function(){return P}),D.d(Q,"clearCurrentCues",function(){return z}),D.d(Q,"removeCuesInRange",function(){return j}),D.d(Q,"getCuesInRange",function(){return k});var Z=D("./src/utils/logger.ts");function B(v,A){var O;try{O=new Event("addtrack")}catch(_){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=v,A.dispatchEvent(O)}function P(v,A){var O=v.mode;if(O==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(A.id))try{if(v.addCue(A),!v.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(S){Z.logger.debug("[texttrack-utils]: "+S);var _=new self.TextTrackCue(A.startTime,A.endTime,A.text);_.id=A.id,v.addCue(_)}O==="disabled"&&(v.mode=O)}function z(v){var A=v.mode;if(A==="disabled"&&(v.mode="hidden"),v.cues)for(var O=v.cues.length;O--;)v.removeCue(v.cues[O]);A==="disabled"&&(v.mode=A)}function j(v,A,O){var _=v.mode;if(_==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var S=k(v.cues,A,O),T=0;T<S.length;T++)v.removeCue(S[T]);_==="disabled"&&(v.mode=_)}function I(v,A){if(A<v[0].startTime)return 0;var O=v.length-1;if(A>v[O].endTime)return-1;for(var _=0,S=O;_<=S;){var T=Math.floor((S+_)/2);if(A<v[T].startTime)S=T-1;else if(A>v[T].startTime&&_<O)_=T+1;else return T}return v[_].startTime-A<A-v[S].startTime?_:S}function k(v,A,O){var _=[],S=I(v,A);if(S>-1)for(var T=S,h=v.length;T<h;T++){var o=v[T];if(o.startTime>=A&&o.endTime<=O)_.push(o);else if(o.startTime>O)return _}return _}},"./src/utils/time-ranges.ts":function(ue,Q,D){"use strict";D.r(Q);var Z={toString:function(P){for(var z="",j=P.length,I=0;I<j;I++)z+="["+P.start(I).toFixed(3)+","+P.end(I).toFixed(3)+"]";return z}};Q.default=Z},"./src/utils/timescale-conversion.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"toTimescaleFromBase",function(){return B}),D.d(Q,"toTimescaleFromScale",function(){return P}),D.d(Q,"toMsFromMpegTsClock",function(){return z}),D.d(Q,"toMpegTsClockFromTimescale",function(){return j});var Z=9e4;function B(I,k,v,A){v===void 0&&(v=1),A===void 0&&(A=!1);var O=I*k*v;return A?Math.round(O):O}function P(I,k,v,A){return v===void 0&&(v=1),A===void 0&&(A=!1),B(I,k,1/v,A)}function z(I,k){return k===void 0&&(k=!1),B(I,1e3,1/Z,k)}function j(I,k){return k===void 0&&(k=1),B(I,Z,1/k)}},"./src/utils/typed-array.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"sliceUint8",function(){return Z});function Z(B,P,z){return Uint8Array.prototype.slice?B.slice(P,z):new Uint8Array(Array.prototype.slice.call(B,P,z))}},"./src/utils/vttcue.ts":function(ue,Q,D){"use strict";D.r(Q),Q.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],B=["start","middle","end","left","right"];function P(v,A){if(typeof A!="string")return!1;if(!Array.isArray(v))return!1;var O=A.toLowerCase();return~v.indexOf(O)?O:!1}function z(v){return P(Z,v)}function j(v){return P(B,v)}function I(v){for(var A=arguments.length,O=new Array(A>1?A-1:0),_=1;_<A;_++)O[_-1]=arguments[_];for(var S=1;S<arguments.length;S++){var T=arguments[S];for(var h in T)v[h]=T[h]}return v}function k(v,A,O){var _=this,S={enumerable:!0};_.hasBeenReset=!1;var T="",h=!1,o=v,l=A,d=O,C=null,p="",f=!0,L="auto",b="start",m=50,c="middle",u=50,a="middle";Object.defineProperty(_,"id",I({},S,{get:function(){return T},set:function(y){T=""+y}})),Object.defineProperty(_,"pauseOnExit",I({},S,{get:function(){return h},set:function(y){h=!!y}})),Object.defineProperty(_,"startTime",I({},S,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",I({},S,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",I({},S,{get:function(){return d},set:function(y){d=""+y,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",I({},S,{get:function(){return C},set:function(y){C=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",I({},S,{get:function(){return p},set:function(y){var E=z(y);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",I({},S,{get:function(){return f},set:function(y){f=!!y,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",I({},S,{get:function(){return L},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",I({},S,{get:function(){return b},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",I({},S,{get:function(){return m},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");m=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",I({},S,{get:function(){return c},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",I({},S,{get:function(){return u},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");u=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",I({},S,{get:function(){return a},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),_.displayState=void 0}return k.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"parseTimeStamp",function(){return P}),D.d(Q,"fixLineBreaks",function(){return A}),D.d(Q,"VTTParser",function(){return O});var Z=D("./src/utils/vttcue.ts"),B=function(){function _(){}var S=_.prototype;return S.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},_}();function P(_){function S(h,o,l,d){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var T=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return T?parseFloat(T[2])>59?S(T[2],T[3],0,T[4]):S(T[1],T[2],T[3],T[4]):null}var z=function(){function _(){this.values=Object.create(null)}var S=_.prototype;return S.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},S.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},S.has=function(h){return h in this.values},S.alt=function(h,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(h,o);break}},S.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},S.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},_}();function j(_,S,T,h){var o=h?_.split(h):[_];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(T);if(d.length!==2)continue;var C=d[0],p=d[1];S(C,p)}}var I=new Z.default(0,0,""),k=I.align==="middle"?"middle":"center";function v(_,S,T){var h=_;function o(){var C=P(_);if(C===null)throw new Error("Malformed timestamp: "+h);return _=_.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,p){var f=new z;j(C,function(m,c){var u;switch(m){case"region":for(var a=T.length-1;a>=0;a--)if(T[a].id===c){f.set(m,T[a].region);break}break;case"vertical":f.alt(m,c,["rl","lr"]);break;case"line":u=c.split(","),f.integer(m,u[0]),f.percent(m,u[0])&&f.set("snapToLines",!1),f.alt(m,u[0],["auto"]),u.length===2&&f.alt("lineAlign",u[1],["start",k,"end"]);break;case"position":u=c.split(","),f.percent(m,u[0]),u.length===2&&f.alt("positionAlign",u[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":f.percent(m,c);break;case"align":f.alt(m,c,["start",k,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var L=f.get("line","auto");L==="auto"&&I.line===-1&&(L=-1),p.line=L,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",k);var b=f.get("position","auto");b==="auto"&&I.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function d(){_=_.replace(/^\s+/,"")}if(d(),S.startTime=o(),d(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);_=_.substr(3),d(),S.endTime=o(),d(),l(_,S)}function A(_){return _.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=_.prototype;return S.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var b=o.buffer,m=0;for(b=A(b);m<b.length&&b[m]!=="\r"&&b[m]!==`
`;)++m;var c=b.substr(0,m);return b[m]==="\r"&&++m,b[m]===`
`&&++m,o.buffer=b.substr(m),c}function d(b){j(b,function(m,c){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=l();var p=C.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:C=l();switch(o.state){case"HEADER":/:/.test(C)?d(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{v(C,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=C.indexOf("-->")!==-1;if(!C||L&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(ue,Q,D){"use strict";D.r(Q),D.d(Q,"generateCueId",function(){return O}),D.d(Q,"parseWebVTT",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),z=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,k=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},v=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),C=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*C,o},A=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function O(T,h,o){return A(T.toString())+A(h.toString())+A(o)}var _=function(h,o,l){var d=h[o],C=h[d.prevCC];if(!C||!C.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(p=C)!==null&&p!==void 0&&p.new;){var p;h.ccOffset+=d.start-C.start,d.new=!1,d=C,C=h[d.prevCC]}h.presentationOffset=l};function S(T,h,o,l,d,C,p,f){var L=new B.VTTParser,b=Object(P.utf8ArrayToStr)(new Uint8Array(T)).trim().replace(I,`
`).split(`
`),m=[],c=Object(z.toMpegTsClockFromTimescale)(h,o),u="00:00.000",a=0,x=0,y,E=!0,N=!1;L.oncue=function(U){var K=l[d],V=l.ccOffset,R=(a-c)/9e4;if(K!=null&&K.new&&(x!==void 0?V=l.ccOffset=K.start:_(l,d,R)),R&&(V=R-l.presentationOffset),N){var M=U.endTime-U.startTime,$=Object(j.normalizePts)((U.startTime+V-x)*9e4,C*9e4)/9e4;U.startTime=$,U.endTime=$+M}var ee=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(ee)),U.id||(U.id=O(U.startTime,U.endTime,ee)),U.endTime>0&&m.push(U)},L.onparsingerror=function(U){y=U},L.onflush=function(){if(y){f(y);return}p(m)},b.forEach(function(U){if(E)if(k(U,"X-TIMESTAMP-MAP=")){E=!1,N=!0,U.substr(16).split(",").forEach(function(K){k(K,"LOCAL:")?u=K.substr(6):k(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{x=v(u)/1e3}catch(K){N=!1,y=K}return}else U===""&&(E=!1);L.parse(U+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(ue,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,z=function(){function j(k){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=k?k.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var I=j.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},I.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(v,A,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=A,this.callbacks=O,this.retryDelay=A.retryDelay,this.loadInternal()},I.loadInternal=function(){var v=this.config,A=this.context;if(!v)return;var O=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var S=this.xhrSetup;try{if(S)try{S(O,A.url)}catch(o){O.open("GET",A.url,!0),S(O,A.url)}O.readyState||O.open("GET",A.url,!0);var T=this.context.headers;if(T)for(var h in T)O.setRequestHeader(h,T[h])}catch(o){this.callbacks.onError({code:O.status,text:o.message},A,O);return}A.rangeEnd&&O.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),O.send()},I.readystatechange=function(){var v=this.context,A=this.loader,O=this.stats;if(!v||!A)return;var _=A.readyState,S=this.config;if(O.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),_===4){A.onreadystatechange=null,A.onprogress=null;var T=A.status;if(T>=200&&T<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var h,o;if(v.responseType==="arraybuffer"?(h=A.response,o=h.byteLength):(h=A.responseText,o=h.length),O.loaded=O.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(O,v,h,A),!this.callbacks)return;var d={url:A.responseURL,data:h};this.callbacks.onSuccess(d,O,v,A)}else O.retry>=S.maxRetry||T>=400&&T<499?(Z.logger.error(T+" while loading "+v.url),this.callbacks.onError({code:T,text:A.statusText},v,A)):(Z.logger.warn(T+" while loading "+v.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),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},I.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(v){var A=this.stats;A.loaded=v.loaded,v.lengthComputable&&(A.total=v.total)},I.getCacheAge=function(){var v=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");v=A?parseFloat(A):null}return v},j}();Q.default=z}}).default})},vHTk:function(bt,Je,ae){bt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},we55:function(bt,Je,ae){bt.exports={bg:"bg___3PaSA",flexRow:"flexRow___1k1iY",flexJustifyCenter:"flexJustifyCenter___MzzvD",flexAlignEnd:"flexAlignEnd___1KYBf",flexAlignCenter:"flexAlignCenter___3XoYY",flexColumn:"flexColumn___28jeJ",formWrap:"formWrap___2IoYS",titleWrap:"titleWrap___2LenH",fieldWrap:"fieldWrap___3zhLT",mdWrap:"mdWrap___3fVSN",backgroundFa:"backgroundFa___21qxJ",button:"button___3eTeL"}},wzkS:function(bt,Je,ae){"use strict";ae.d(Je,"c",function(){return B}),ae.d(Je,"b",function(){return P}),ae.d(Je,"d",function(){return z}),ae.d(Je,"a",function(){return I}),ae.d(Je,"e",function(){return k});var ue=ae("9og8"),Q=ae("WmNS"),D=ae.n(Q),Z=ae("ErOA");function B(v){return Object(Z.c)("libraries/".concat(v,".json"))}function P(){return Object(Z.c)("library_tags.json")}function z(v){return j.apply(this,arguments)}function j(){return j=Object(ue.a)(D.a.mark(function v(A){var O;return D.a.wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,Object(Z.b)("attachments/".concat(A,".json"));case 2:return O=S.sent,S.abrupt("return",O.status===0);case 4:case"end":return S.stop()}},v)})),j.apply(this,arguments)}function I(v){return Object(Z.f)("libraries.json",v)}function k(v,A){return Object(Z.g)("libraries/".concat(v,".json"),A)}},y5JW:function(bt,Je,ae){"use strict";ae.d(Je,"c",function(){return T}),ae.d(Je,"a",function(){return h});var ue=ae("DZo9"),Q=ae("8z0m"),D=ae("+L6B"),Z=ae("2/Rp"),B=ae("9og8"),P=ae("k1fw"),z=ae("oBTY"),j=ae("miYZ"),I=ae("tsqr"),k=ae("WmNS"),v=ae.n(k),A=ae("q1tI"),O=ae.n(A),_=ae("m3rI"),S=ae("wzkS"),T="\u3000\u3000";function h(o){var l=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var d=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,d)).toFixed(1)+" "+l[d]}Je.b=function(o){var l=o.value,d=l===void 0?[]:l,C=o.action,p=o.onChange,f=o.className,L=o.maxSize,b=L===void 0?150:L,m=o.title,c=m===void 0?"\u6587\u4EF6\u4E0A\u4F20":m,u=o.accept,a=u===void 0?null:u,x={multiple:!1,fileList:d,accept:a,withCredentials:!0,beforeUpload:function(N){var U=N.size/1024/1024;return U<b?!0:(I.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(b,"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.API_SERVER,"/api/attachments.json"),onChange:function(N){var U=Object(z.a)(N.fileList);U=U.map(function(K){return K.name.indexOf(T)===-1&&(K.name="".concat(K.name).concat(T).concat(h(K.size))),Object(P.a)({},K)}),p(U)},onRemove:function(){var E=Object(B.a)(v.a.mark(function U(K){var V,R,M;return v.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(V=K.size/1024/1024,!(K.status==="uploading")){ee.next=3;break}return ee.abrupt("return",!0);case 3:if(V<b){ee.next=7;break}return ee.abrupt("return",!0);case 7:if(R=K.response?K.response.id:K.uid,!R){ee.next=15;break}return ee.next=11,Object(S.d)(K.response?K.response.id:K.id);case 11:return M=ee.sent,ee.abrupt("return",M);case 15:return ee.abrupt("return",!0);case 16:case"end":return ee.stop()}},U)}));function N(U){return E.apply(this,arguments)}return N}()};function y(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(Q.a,x,O.a.createElement(Z.a,{type:"primary",title:d.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:d.length>0,ghost:!0},c),O.a.createElement("span",{onClick:y,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M) ")))}}}]);