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

436 lines
1.1 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[47,5,6,7],{"+NIl":function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(J,P){"use strict";function Q(h,n){h.cmdState.push(n)}function H(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function F(h){var n=h.cmdState.pop();n&&n.closeBracket()}function z(h){for(var n=h.cmdState,d=n.length-1;d>=0;d--){var l=n[d];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function W(h,n,d){return function(){this.name=h,this.bracketNo=0,this.style=n,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=W("importmodule","tag",["string","builtin"]),M.documentclass=W("documentclass","tag",["","atom"]),M.usepackage=W("usepackage","tag",["atom"]),M.begin=W("begin","tag",["atom"]),M.end=W("end","tag",["atom"]),M.label=W("label","tag",["atom"]),M.ref=W("ref","tag",["atom"]),M.eqref=W("eqref","tag",["atom"]),M.cite=W("cite","tag",["atom"]),M.bibitem=W("bibitem","tag",["atom"]),M.Bibitem=W("Bibitem","tag",["atom"]),M.RBibitem=W("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(h,n){h.f=n}function g(h,n){var d;if(h.match(/^\\[a-zA-Z@]+/)){var l=h.current().slice(1);return d=M.hasOwnProperty(l)?M[l]:M.DEFAULT,d=new d,Q(n,d),O(n,f),d.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return O(n,function(u,c){return p(u,c,"\\]")}),"keyword";if(h.match("\\("))return O(n,function(u,c){return p(u,c,"\\)")}),"keyword";if(h.match("$$"))return O(n,function(u,c){return p(u,c,"$$")}),"keyword";if(h.match("$"))return O(n,function(u,c){return p(u,c,"$")}),"keyword";var a=h.next();if(a=="%")return h.skipToEnd(),"comment";if(a=="}"||a=="]"){if(d=H(n),d)d.closeBracket(a),O(n,f);else return"error";return"bracket"}else return a=="{"||a=="["?(d=M.DEFAULT,d=new d,Q(n,d),"bracket"):/\d/.test(a)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),d=z(n),d.name=="begin"&&(d.argument=h.current()),d.styleIdentifier())}function p(h,n,d){if(h.eatSpace())return null;if(d&&h.match(d))return O(n,g),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=h.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(h.skipToEnd(),"comment"):"error"}function f(h,n){var d=h.peek(),l;return d=="{"||d=="["?(l=H(n),l.openBracket(d),h.eat(d),O(n,g),"bracket"):/[ \t\r]/.test(d)?(h.eat(d),null):(O(n,g),F(n),g(h,n))}return{startState:function(){var h=P.inMathMode?function(n,d){return p(n,d)}:g;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,n){return n.f(h,n)},blankLine:function(h){h.f=g,h.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"+ua5":function(ct,Ye,ae){},"19Vz":function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){le.defineOption("placeholder","",function(W,M,O){var g=O&&O!=le.Init;if(M&&!g)W.on("blur",H),W.on("change",F),W.on("swapDoc",F),le.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Q(W)}),F(W);else if(!M&&g){W.off("blur",H),W.off("change",F),W.off("swapDoc",F),le.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),J(W);var p=W.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}M&&!W.hasFocus()&&H(W)});function J(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function P(W){J(W);var M=W.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=W.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var O=W.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),M.appendChild(O),W.display.lineSpace.insertBefore(M,W.display.lineSpace.firstChild)}function Q(W){setTimeout(function(){var M=!1,O=W.getInputField();O.nodeName=="TEXTAREA"?M=!O.value:W.lineCount()==1&&(M=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),M?P(W):J(W)},20)}function H(W){z(W)&&P(W)}function F(W){var M=W.getWrapperElement(),O=z(W);M.className=M.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?P(W):J(W)}function z(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function(Q,H){var F=Q.indentUnit,z={},W=H.htmlMode?J:P;for(var M in W)z[M]=W[M];for(var M in H)z[M]=H[M];var O,g;function p(o,b){function m(D){return b.tokenize=D,D(o,b)}var E=o.next();if(E=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?m(n("atom","]]>")):null:o.match("--")?m(n("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),m(d(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),b.tokenize=n("meta","?>"),"meta"):(O=o.eat("/")?"closeTag":"openTag",b.tokenize=f,"tag bracket");if(E=="&"){var N;return o.eat("#")?o.eat("x")?N=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):N=o.eatWhile(/[\d]/)&&o.eat(";"):N=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),N?"atom":"error"}else return o.eatWhile(/[^&<]/),null}p.isInText=!0;function f(o,b){var m=o.next();if(m==">"||m=="/"&&o.eat(">"))return b.tokenize=p,O=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return O="equals",null;if(m=="<"){b.tokenize=p,b.state=c,b.tagName=b.tagStart=null;var E=b.tokenize(o,b);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(b.tokenize=h(m),b.stringStartCol=o.column(),b.tokenize(o,b)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(o){var b=function(m,E){for(;!m.eol();)if(m.next()==o){E.tokenize=f;break}return"string"};return b.isInAttribute=!0,b}function n(o,b){return function(m,E){for(;!m.eol();){if(m.match(b)){E.tokenize=p;break}m.next()}return o}}function d(o){return function(b,m){for(var E;(E=b.next())!=null;){if(E=="<")return m.tokenize=d(o+1),m.tokenize(b,m);if(E==">")if(o==1){m.tokenize=p;break}else return m.tokenize=d(o-1),m.tokenize(b,m)}return"meta"}}function l(o,b,m){this.prev=o.context,this.tagName=b,this.indent=o.indented,this.startOfLine=m,(z.doNotIndent.hasOwnProperty(b)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function u(o,b){for(var m;;){if(!o.context)return;if(m=o.context.tagName,!z.contextGrabbers.hasOwnProperty(m)||!z.contextGrabbers[m].hasOwnProperty(b))return;a(o)}}function c(o,b,m){return o=="openTag"?(m.tagStart=b.column(),L):o=="closeTag"?S:c}function L(o,b,m){return o=="word"?(m.tagName=b.current(),g="tag",C):z.allowMissingTagName&&o=="endTag"?(g="tag bracket",C(o,b,m)):(g="error",L)}function S(o,b,m){if(o=="word"){var E=b.current();return m.context&&m.context.tagName!=E&&z.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==E||z.matchClosing===!1?(g="tag",T):(g="tag error",R)}else return z.allowMissingTagName&&o=="endTag"?(g="tag bracket",T(o,b,m)):(g="error",R)}function T(o,b,m){return o!="endTag"?(g="error",T):(a(m),c)}function R(o,b,m){return g="error",T(o,b,m)}function C(o,b,m){if(o=="word")return g="attribute",w;if(o=="endTag"||o=="selfcloseTag"){var E=m.tagName,N=m.tagStart;return m.tagName=m.tagStart=null,o=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new l(m,E,N==m.indented)),c}return g="error",C}function w(o,b,m){return o=="equals"?x:(z.allowMissing||(g="error"),C(o,b,m))}function x(o,b,m){return o=="string"?_:o=="word"&&z.allowUnquoted?(g="string",C):(g="error",C(o,b,m))}function _(o,b,m){return o=="string"?_:C(o,b,m)}return{startState:function(o){var b={tokenize:p,state:c,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(b.baseIndent=o),b},token:function(o,b){if(!b.tagName&&o.sol()&&(b.indented=o.indentation()),o.eatSpace())return null;O=null;var m=b.tokenize(o,b);return(m||O)&&m!="comment"&&(g=null,b.state=b.state(O||m,o,b),g&&(m=g=="error"?m+" error":g)),m},indent:function(o,b,m){var E=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+F;if(E&&E.noIndent)return le.Pass;if(o.tokenize!=f&&o.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(o.tagName)return z.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+F*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var N=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);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 D=z.contextGrabbers[E.tagName];if(D&&D.hasOwnProperty(N[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+F:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(o){o.state==x&&(o.state=C)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var b=[],m=o.context;m;m=m.prev)m.tagName&&b.push(m.tagName);return b.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return S});var le=ae("+L6B"),J=ae("2/Rp"),P=ae("2qtc"),Q=ae("kLXV"),H=ae("9og8"),F=ae("k1fw"),z=ae("miYZ"),W=ae("tsqr"),M=ae("oBTY"),O=ae("tJVT"),g=ae("DZo9"),p=ae("8z0m"),f=ae("WmNS"),h=ae.n(f),n=ae("q1tI"),d=ae.n(n),l=ae("m3rI"),a=ae("wzkS"),u=ae("y5JW"),c=ae("LtfV"),L=p.a.Dragger;function S(T){var R=[];return T&&T.length>0&&(R=T.map(function(C){return{uid:C.id,id:C.id,name:C.title+u.c+C.filesize,url:C.url,filesize:C.filesize,status:"done",response:{id:C.id}}})),R}Ye.b=function(T){var R=T.value,C=T.onChange,w=T.action,x=T.className,_=T.maxSize,o=_===void 0?150:_,b=T.title,m=b===void 0?"\u4E0A\u4F20\u9644\u4EF6":b,E=T.showRemoveModal,N=E===void 0?!1:E,D=T.accept,B=D===void 0?"":D,j=T.additionalText,I=T.isDragger,v=T.number,G=v===void 0?1e3:v,Y=T.aloneClear,re=Y===void 0?!1:Y,oe=Object(n.useState)(!1),we=Object(O.a)(oe,2),pe=we[0],xe=we[1],_e=Object(n.useState)(R||[]),Se=Object(O.a)(_e,2),ce=Se[0],ue=Se[1];Object(n.useEffect)(function(){R&&(ue(Object(M.a)(R)),G===(R==null?void 0:R.length)&&xe(!0))},[R]);var ie=function(){setTimeout(function(){ce.pop(),ue(Object(M.a)(ce))},500)},de={multiple:!0,disabled:pe,accept:B,withCredentials:!0,fileList:ce,beforeUpload:function(ke,Te){var Ae=ke.size/1024/1024;return ce.concat(Te).length>G?(ce.pop(),ue(Object(M.a)(ce)),W.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(G,"\u4E2A\u6587\u4EF6")),re?Promise.reject():(ie(),!1)):!0},action:w||"".concat(l.a.API_SERVER,"/api/attachments.json"),onChange:function(ke){var Te,Ae,Le=Object(M.a)(ke.fileList);if(ke.file.status==="done"&&((Te=ke.file)===null||Te===void 0||((Ae=Te.response)===null||Ae===void 0)?void 0:Ae.status)===-1){var Be,Fe;W.b.error((Be=ke.file)===null||Be===void 0||((Fe=Be.response)===null||Fe===void 0)?void 0:Fe.message);return}Le.length>=G?xe(!0):xe(!1),ue(Object(M.a)(Le)),Le=Le.map(function(De){var Ne;if(De!=null&&(Ne=De.response)!==null&&Ne!==void 0&&Ne.id){var Xe;De.url="/api/attachments/".concat(De==null||((Xe=De.response)===null||Xe===void 0)?void 0:Xe.id)}return De.name.indexOf(u.c)===-1&&(De.name="".concat(De.name).concat(u.c).concat(Object(u.a)(De.size))),Object(F.a)({},De)}),console.log("info:",ke),C(Le)},onRemove:function(){var Oe=Object(H.a)(h.a.mark(function Te(Ae){var Le;return h.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Le=function(){var De=Object(H.a)(h.a.mark(function Ne(){var Xe,Ze;return h.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:if(Xe=Ae.response?Ae.response.id:Ae.id,!Xe){$e.next=8;break}return $e.next=4,Object(a.d)(Ae.response?Ae.response.id:Ae.uid);case 4:return Ze=$e.sent,$e.abrupt("return",Ze);case 8:return $e.abrupt("return",!0);case 9:case"end":return $e.stop()}},Ne)}));return function(){return De.apply(this,arguments)}}(),!N){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(De,Ne){Q.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:d.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Xe=Object(H.a)(h.a.mark(function Je(){var $e;return h.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return tt.next=2,Le();case 2:$e=tt.sent,W.b.success("\u5220\u9664\u6210\u529F"),De(!0);case 5:case"end":return tt.stop()}},Je)}));function Ze(){return Xe.apply(this,arguments)}return Ze}(),onCancel:function(){return De(!1)}})}));case 5:return Fe.next=7,Le();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Te)}));function ke(Te){return Oe.apply(this,arguments)}return ke}()};function se(Oe){Oe.preventDefault(),Oe.stopPropagation()}return d.a.createElement("div",{className:"multi-upload ".concat(x||"")},I&&d.a.createElement(L,de,d.a.createElement("p",{className:"ant-upload-drag-icon"},d.a.createElement(c.a,null)),d.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",d.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB)"," "),j),!I&&d.a.createElement(p.a,de,d.a.createElement(J.a,{disabled:pe},m),d.a.createElement("span",{onClick:se,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB)"," ")))}},"55Ip":function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return u});var le=ae("Ty5D"),J=ae("dI71"),P=ae("q1tI"),Q=ae.n(P),H=ae("YS25"),F=ae("17x9"),z=ae.n(F),W=ae("wx14"),M=ae("zLVn"),O=ae("9R94"),g=function(x){Object(J.a)(_,x);function _(){for(var b,m=arguments.length,E=new Array(m),N=0;N<m;N++)E[N]=arguments[N];return b=x.call.apply(x,[this].concat(E))||this,b.history=Object(H.a)(b.props),b}var o=_.prototype;return o.render=function(){return Q.a.createElement(le.c,{history:this.history,children:this.props.children})},_}(Q.a.Component),p=function(x){Object(J.a)(_,x);function _(){for(var b,m=arguments.length,E=new Array(m),N=0;N<m;N++)E[N]=arguments[N];return b=x.call.apply(x,[this].concat(E))||this,b.history=Object(H.b)(b.props),b}var o=_.prototype;return o.render=function(){return Q.a.createElement(le.c,{history:this.history,children:this.props.children})},_}(Q.a.Component),f=function(_,o){return typeof _=="function"?_(o):_},h=function(_,o){return typeof _=="string"?Object(H.c)(_,null,null,o):_},n=function(_){return _},d=Q.a.forwardRef;typeof d=="undefined"&&(d=n);function l(x){return!!(x.metaKey||x.altKey||x.ctrlKey||x.shiftKey)}var a=d(function(x,_){var o=x.innerRef,b=x.navigate,m=x.onClick,E=Object(M.a)(x,["innerRef","navigate","onClick"]),N=E.target,D=Object(W.a)({},E,{onClick:function(j){try{m&&m(j)}catch(I){throw j.preventDefault(),I}!j.defaultPrevented&&j.button===0&&(!N||N==="_self")&&!l(j)&&(j.preventDefault(),b())}});return n!==d?D.ref=_||o:D.ref=o,Q.a.createElement("a",D)}),u=d(function(x,_){var o=x.component,b=o===void 0?a:o,m=x.replace,E=x.to,N=x.innerRef,D=Object(M.a)(x,["component","replace","to","innerRef"]);return Q.a.createElement(le.e.Consumer,null,function(B){B||Object(O.a)(!1);var j=B.history,I=h(f(E,B.location),B.location),v=I?j.createHref(I):"",G=Object(W.a)({},D,{href:v,navigate:function(){var re=f(E,B.location),oe=m?j.replace:j.push;oe(re)}});return n!==d?G.ref=_||N:G.innerRef=N,Q.a.createElement(b,G)})});if(!1)var c,L;var S=function(_){return _},T=Q.a.forwardRef;typeof T=="undefined"&&(T=S);function R(){for(var x=arguments.length,_=new Array(x),o=0;o<x;o++)_[o]=arguments[o];return _.filter(function(b){return b}).join(" ")}var C=T(function(x,_){var o=x["aria-current"],b=o===void 0?"page":o,m=x.activeClassName,E=m===void 0?"active":m,N=x.activeStyle,D=x.className,B=x.exact,j=x.isActive,I=x.location,v=x.sensitive,G=x.strict,Y=x.style,re=x.to,oe=x.innerRef,we=Object(M.a)(x,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Q.a.createElement(le.e.Consumer,null,function(pe){pe||Object(O.a)(!1);var xe=I||pe.location,_e=h(f(re,xe),xe),Se=_e.pathname,ce=Se&&Se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=ce?Object(le.f)(xe.pathname,{path:ce,exact:B,sensitive:v,strict:G}):null,ie=!!(j?j(ue,xe):ue),de=ie?R(D,E):D,se=ie?Object(W.a)({},Y,{},N):Y,Oe=Object(W.a)({"aria-current":ie&&b||null,className:de,style:se,to:_e},we);return S!==T?Oe.ref=_||oe:Oe.innerRef=oe,Q.a.createElement(u,Oe)})});if(!1)var w},"5VLF":function(ct,Ye,ae){"use strict";var le,J;function P(Q,H,F){var z=function(W,M){return Q.js_beautify(W,M)};return z.js=Q.js_beautify,z.css=H.css_beautify,z.html=F.html_beautify,z.js_beautify=Q.js_beautify,z.css_beautify=H.css_beautify,z.html_beautify=F.html_beautify,z}!(le=[ae("6UM0"),ae("TXwP"),ae("psGv")],J=function(Q,H,F){return P(Q,H,F)}.apply(Ye,le),J!==void 0&&(ct.exports=J))},"6UM0":function(ct,Ye,ae){var le,J;(function(){var P;(function(){"use strict";var H=[function(M,O,g){var p=g(1).Beautifier,f=g(5).Options;function h(n,d){var l=new p(n,d);return l.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new f}},function(M,O,g){var p=g(2).Output,f=g(3).Token,h=g(4),n=g(5).Options,d=g(7).Tokenizer,l=g(7).line_starters,a=g(7).positionable_operators,u=g(7).TOKEN;function c(v,G){return G.indexOf(v)!==-1}function L(v){return v.replace(/^\s+/g,"")}function S(v){for(var G={},Y=0;Y<v.length;Y++)G[v[Y].replace(/-/g,"_")]=v[Y];return G}function T(v,G){return v&&v.type===u.RESERVED&&v.text===G}function R(v,G){return v&&v.type===u.RESERVED&&c(v.text,G)}var C=["case","return","do","if","throw","else","await","break","continue","async"],w=["before-newline","after-newline","preserve-newline"],x=S(w),_=[x.before_newline,x.preserve_newline],o={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function b(v,G){if(G.multiline_frame||G.mode===o.ForInitializer||G.mode===o.Conditional)return;v.remove_indent(G.start_line_index)}function m(v){v=v.replace(h.allLineBreaks,`
`);for(var G=[],Y=v.indexOf(`
`);Y!==-1;)G.push(v.substring(0,Y)),v=v.substring(Y+1),Y=v.indexOf(`
`);return v.length&&G.push(v),G}function E(v){return v===o.ArrayLiteral}function N(v){return c(v,[o.Expression,o.ForInitializer,o.Conditional])}function D(v,G){for(var Y=0;Y<v.length;Y++){var re=v[Y].trim();if(re.charAt(0)!==G)return!1}return!0}function B(v,G){for(var Y=0,re=v.length,oe;Y<re;Y++)if(oe=v[Y],oe&&oe.indexOf(G)!==0)return!1;return!0}function j(v,G){G=G||{},this._source_text=v||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new n(G)}j.prototype.create_flags=function(v,G){var Y=0;v&&(Y=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>Y&&(Y=v.line_indent_level));var re={mode:G,parent:v,last_token:v?v.last_token:new f(u.START_BLOCK,""),last_word:v?v.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Y,alignment:0,line_indent_level:v?v.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return re},j.prototype._reset=function(v){var G=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(o.BlockStatement);var Y=new d(v,this._options);return this._tokens=Y.tokenize(),v},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,G=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=`
`,G&&h.lineBreak.test(G||"")&&(Y=G.match(h.lineBreak)[0]));for(var re=this._tokens.next();re;)this.handle_token(re),this._last_last_text=this._flags.last_token.text,this._flags.last_token=re,re=this._tokens.next();return v=this._output.get_code(Y),v},j.prototype.handle_token=function(v,G){v.type===u.START_EXPR?this.handle_start_expr(v):v.type===u.END_EXPR?this.handle_end_expr(v):v.type===u.START_BLOCK?this.handle_start_block(v):v.type===u.END_BLOCK?this.handle_end_block(v):v.type===u.WORD?this.handle_word(v):v.type===u.RESERVED?this.handle_word(v):v.type===u.SEMICOLON?this.handle_semicolon(v):v.type===u.STRING?this.handle_string(v):v.type===u.EQUALS?this.handle_equals(v):v.type===u.OPERATOR?this.handle_operator(v):v.type===u.COMMA?this.handle_comma(v):v.type===u.BLOCK_COMMENT?this.handle_block_comment(v,G):v.type===u.COMMENT?this.handle_comment(v,G):v.type===u.DOT?this.handle_dot(v):v.type===u.EOF?this.handle_eof(v):v.type===u.UNKNOWN?this.handle_unknown(v,G):this.handle_unknown(v,G)},j.prototype.handle_whitespace_and_comments=function(v,G){var Y=v.newlines,re=this._options.keep_array_indentation&&E(this._flags.mode);if(v.comments_before)for(var oe=v.comments_before.next();oe;)this.handle_whitespace_and_comments(oe,G),this.handle_token(oe,G),oe=v.comments_before.next();if(re)for(var we=0;we<Y;we+=1)this.print_newline(we>0,G);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,G);for(var pe=1;pe<Y;pe+=1)this.print_newline(!0,G)}};var I=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(v,G){if(G=G===void 0?!1:G,this._output.just_added_newline())return;var Y=this._options.preserve_newlines&&v.newlines||G,re=c(this._flags.last_token.text,a)||c(v.text,a);if(re){var oe=c(this._flags.last_token.text,a)&&c(this._options.operator_position,_)||c(v.text,a);Y=Y&&oe}if(Y)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(R(this._flags.last_token,I))return;this._output.set_wrap_point()}},j.prototype.print_newline=function(v,G){if(!G&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Y=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&T(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||E(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},j.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===u.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===o.Statement&&b(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===o.ObjectLiteral&&this._flags.mode===o.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(v){var G=!1;return G=G||R(this._flags.last_token,["var","let","const"])&&v.type===u.WORD,G=G||T(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===o.ObjectLiteral&&this._flags.mode===o.Statement)&&R(this._flags.last_token,I)&&!v.newlines,G=G||T(this._flags.last_token,"else")&&!(T(v,"if")&&!v.comments_before),G=G||this._flags.last_token.type===u.END_EXPR&&(this._previous_flags.mode===o.ForInitializer||this._previous_flags.mode===o.Conditional),G=G||this._flags.last_token.type===u.WORD&&this._flags.mode===o.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==u.WORD&&v.type!==u.RESERVED,G=G||this._flags.mode===o.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"])),G?(this.set_mode(o.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,R(v,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var G=o.Expression;if(v.text==="["){if(this._flags.last_token.type===u.WORD||this._flags.last_token.text===")"){R(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=o.ArrayLiteral,E(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),c(this._flags.last_token.type,[u.START_EXPR,u.END_EXPR,u.WORD,u.OPERATOR,u.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===u.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=o.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=o.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(c(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===u.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var re=this._tokens.peek(-4);R(Y,["async","function"])||Y.text==="*"&&R(re,["async","function"])?this._output.space_before_token=!0:this._flags.mode===o.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(re.text==="{"||re.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(v);(this._flags.last_token.type===u.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===o.ObjectLiteral&&c(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===u.START_BLOCK?this.print_newline():(this._flags.last_token.type===u.END_EXPR||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===u.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(v){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&E(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===u.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(v),this.restore_mode(),b(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===o.Conditional&&(this._previous_flags.mode=o.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var G=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===u.END_EXPR?(this.set_mode(o.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(o.BlockStatement):Y&&(c(Y.text,[":",","])&&c(G.type,[u.STRING,u.WORD,u.RESERVED])||c(G.text,["get","set","..."])&&c(Y.type,[u.WORD,u.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(Y.text,[":",","])?this.set_mode(o.BlockStatement):this.set_mode(o.ObjectLiteral):this._flags.last_token.type===u.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(o.BlockStatement):c(this._flags.last_token.type,[u.EQUALS,u.START_EXPR,u.COMMA,u.OPERATOR])||R(this._flags.last_token,["return","throw","import","default"])?this.set_mode(o.ObjectLiteral):this.set_mode(o.BlockStatement),this._flags.last_token&&(R(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var re=!G.comments_before&&G.text==="}",oe=re&&this._flags.last_word==="function"&&this._flags.last_token.type===u.END_EXPR;if(this._options.brace_preserve_inline){var we=0,pe=null;this._flags.inline_frame=!0;do if(we+=1,pe=this._tokens.peek(we-1),pe.newlines){this._flags.inline_frame=!1;break}while(pe.type!==u.EOF&&!(pe.type===u.END_BLOCK&&pe.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==u.OPERATOR&&(oe||this._flags.last_token.type===u.EQUALS||R(this._flags.last_token,C)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(E(this._previous_flags.mode)&&(this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.COMMA)&&((this._flags.last_token.type===u.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==u.OPERATOR&&this._flags.last_token.type!==u.START_EXPR&&(this._flags.last_token.type===u.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!re&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===o.Statement;)this.restore_mode();var G=this._flags.last_token.type===u.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(E(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(v)},j.prototype.handle_word=function(v){if(v.type===u.RESERVED){if(c(v.text,["set","get"])&&this._flags.mode!==o.ObjectLiteral)v.type=u.WORD;else if(v.text==="import"&&c(this._tokens.peek().text,["(","."]))v.type=u.WORD;else if(c(v.text,["as","from"])&&!this._flags.import_block)v.type=u.WORD;else if(this._flags.mode===o.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(v.type=u.WORD)}}if(this.start_of_statement(v)?R(this._flags.last_token,["var","let","const"])&&v.type===u.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==u.EQUALS&&(this._options.preserve_newlines||!R(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(T(v,"while")){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===o.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&R(v,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v)),T(v,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===u.OPERATOR))&&(!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD?R(this._flags.last_token,["get","set","new","export"])||R(this._flags.last_token,I)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===u.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||E(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var Y="NONE";if(this._flags.last_token.type===u.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":R(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&this._flags.mode===o.BlockStatement?Y="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&N(this._flags.mode)?Y="SPACE":this._flags.last_token.type===u.STRING?Y="NEWLINE":this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===o.ObjectLiteral&&c(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===u.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===u.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),R(v,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),R(v,["else","catch","finally"]))if((!(this._flags.last_token.type===u.END_BLOCK&&this._previous_flags.mode===o.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var re=this._output.current_line;re.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?R(this._flags.last_token,C)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&R(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==u.END_EXPR?(this._flags.last_token.type!==u.START_EXPR||!R(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(v,"if")&&T(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):R(v,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&E(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Y==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===u.WORD||v.previous.type===u.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===u.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(v,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var G=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&T(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},j.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===u.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===u.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},j.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},j.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)):this._flags.mode===o.ObjectLiteral||this._flags.mode===o.Statement&&this._flags.parent.mode===o.ObjectLiteral?(this._flags.mode===o.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},j.prototype.handle_operator=function(v){var G=v.text==="*"&&(R(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[u.START_BLOCK,u.COMMA,u.END_BLOCK,u.SEMICOLON])),Y=c(v.text,["-","+"])&&(c(this._flags.last_token.type,[u.START_BLOCK,u.START_EXPR,u.EQUALS,u.OPERATOR])||c(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var re=!G;this.handle_whitespace_and_comments(v,re)}if(v.text==="*"&&this._flags.last_token.type===u.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(this._flags.last_token.type===u.OPERATOR&&c(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==u.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var oe=!0,we=!0,pe=!1;if(v.text===":"?this._flags.ternary_depth===0?oe=!1:(this._flags.ternary_depth-=1,pe=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!G&&this._options.preserve_newlines&&c(v.text,a)){var xe=v.text===":",_e=xe&&pe,Se=xe&&!pe;switch(this._options.operator_position){case x.before_newline:this._output.space_before_token=!Se,this.print_token(v),(!xe||_e)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case x.after_newline:this._output.space_before_token=!0,!xe||_e?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case x.preserve_newline:Se||this.allow_wrap_or_preserved_newline(v),oe=!(this._output.just_added_newline()||Se),this._output.space_before_token=oe,this.print_token(v),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(v),oe=!1;var ce=this._tokens.peek();we=ce&&c(ce.type,[u.WORD,u.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),oe=this._flags.last_token.type===u.START_BLOCK,we=!1;else if(c(v.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),oe=!1,we=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var ue=R(this._flags.last_token,C)&&v.newlines;ue&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(ue,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(oe=!0),this._flags.last_token.type===u.RESERVED?oe=!0:this._flags.last_token.type===u.END_EXPR?oe=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===u.OPERATOR&&(oe=c(v.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(v.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(we=!0)),(this._flags.mode===o.BlockStatement&&!this._flags.inline_frame||this._flags.mode===o.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||oe,this.print_token(v),this._output.space_before_token=we},j.prototype.handle_block_comment=function(v,G){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,G),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,G)},j.prototype.print_block_commment=function(v,G){var Y=m(v.text),re,oe=!1,we=!1,pe=v.whitespace_before,xe=pe.length;if(this.print_newline(!1,G),this.print_token_line_indentation(v),this._output.add_token(Y[0]),this.print_newline(!1,G),Y.length>1){for(Y=Y.slice(1),oe=D(Y,"*"),we=B(Y,pe),oe&&(this._flags.alignment=1),re=0;re<Y.length;re++)oe?(this.print_token_line_indentation(v),this._output.add_token(L(Y[re]))):we&&Y[re]?(this.print_token_line_indentation(v),this._output.add_token(Y[re].substring(xe))):(this._output.current_line.set_indent(-1),this._output.add_token(Y[re])),this.print_newline(!1,G);this._flags.alignment=0}},j.prototype.handle_comment=function(v,G){v.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,G)},j.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),R(this._flags.last_token,C)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(v,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(v)},j.prototype.handle_unknown=function(v,G){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,G)},j.prototype.handle_eof=function(v){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},M.exports.Beautifier=j},function(M){function O(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var f=new O(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},O.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},O.prototype.has_match=function(f){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(f))return!0;return!1},O.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(`
`);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},O.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,h){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var n=this.__base_string_length;return h=h||0,f<0&&(n=0),n+=f*this.__indent_size,n+=h,n},g.prototype.get_indent_string=function(f,h){var n=this.__base_string;return h=h||0,f<0&&(f=0,n=""),h+=f*this.__indent_size,this.__ensure_cache(h),n+=this.__cache[h],n},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,n="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,n=new Array(h+1).join(this.__indent_string)),f&&(n+=new Array(f+1).join(" ")),this.__cache.push(n)};function p(f,h){this.__indent_cache=new g(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join(`
`);return f!==`
`&&(n=n.replace(/[\n]/g,f)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var n=this.__lines.length-2;n>=0;){var d=this.__lines[n];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(n+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},M.exports.Output=p},function(M){function O(g,p,f,h){this.type=g,this.text=p,this.comments_before=null,this.newlines=f||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}M.exports.Token=O},function(M,O){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",h="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",n="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])*";O.identifier=new RegExp(n+d,"g"),O.identifierStart=new RegExp(n),O.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;O.newline=/[\n\r\u2028\u2029]/,O.lineBreak=new RegExp(`\r
|`+O.newline.source),O.allLineBreaks=new RegExp(O.lineBreak.source,"g")},function(M,O,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function h(n){p.call(this,n,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var a=0;a<l.length;a++)l[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",f),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}h.prototype=new p,M.exports.Options=h},function(M){function O(f,h){this.raw_options=g(f,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(f,h){var n=this.raw_options[f],d=h||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(d=n.concat()):typeof n=="string"&&(d=n.split(/[^a-zA-Z0-9_\/\-]+/)),d},O.prototype._get_boolean=function(f,h){var n=this.raw_options[f],d=n===void 0?!!h:!!n;return d},O.prototype._get_characters=function(f,h){var n=this.raw_options[f],d=h||"";return typeof n=="string"&&(d=n.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},O.prototype._get_number=function(f,h){var n=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(n,10);return isNaN(d)&&(d=h),d},O.prototype._get_selection=function(f,h,n){var d=this._get_selection_list(f,h,n);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return d[0]},O.prototype._get_selection_list=function(f,h,n){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[h[0]],!this._is_valid_selection(n,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,n);if(!this._is_valid_selection(d,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return d},O.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(n){return h.indexOf(n)===-1})};function g(f,h){var n={};f=p(f);var d;for(d in f)d!==h&&(n[d]=f[d]);if(h&&f[h])for(d in f[h])n[d]=f[h][d];return n}function p(f){var h={},n;for(n in f){var d=n.replace(/-/g,"_");h[d]=f[n]}return h}M.exports.Options=O,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},function(M,O,g){var p=g(8).InputScanner,f=g(9).Tokenizer,h=g(9).TOKEN,n=g(13).Directives,d=g(4),l=g(12).Pattern,a=g(14).TemplatablePattern;function u(D,B){return B.indexOf(D)!==-1}var c={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},L=new n(/\/\*/,/\*\//),S=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,T=/[0-9]/,R=/[^\d\.]/,C=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),w=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";w=w.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),w="\\?\\.(?!\\d) "+w,w=w.replace(/ /g,"|");var x=new RegExp(w),_="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),o=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),b=new RegExp("^(?:"+o.join("|")+")$"),m,E=function(D,B){f.call(this,D,B),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new l(this._input),I=new a(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(d.identifier).matching(d.identifierMatch),number:j.matching(S),punct:j.matching(x),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(d.lineBreak),shebang:j.starting_with(/#!/).until_after(d.lineBreak),xml:j.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};E.prototype=new f,E.prototype._is_comment=function(D){return D.type===c.COMMENT||D.type===c.BLOCK_COMMENT||D.type===c.UNKNOWN},E.prototype._is_opening=function(D){return D.type===c.START_BLOCK||D.type===c.START_EXPR},E.prototype._is_closing=function(D,B){return(D.type===c.END_BLOCK||D.type===c.END_EXPR)&&B&&(D.text==="]"&&B.text==="["||D.text===")"&&B.text==="("||D.text==="}"&&B.text==="{")},E.prototype._reset=function(){m=!1},E.prototype._get_next_token=function(D,B){var j=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(c.EOF,""):(j=j||this._read_non_javascript(I),j=j||this._read_string(I),j=j||this._read_word(D),j=j||this._read_singles(I),j=j||this._read_comment(I),j=j||this._read_regexp(I,D),j=j||this._read_xml(I,D),j=j||this._read_punctuation(),j=j||this._create_token(c.UNKNOWN,this._input.next()),j)},E.prototype._read_word=function(D){var B;if(B=this.__patterns.identifier.read(),B!=="")return B=B.replace(d.allLineBreaks,`
`),!(D.type===c.DOT||D.type===c.RESERVED&&(D.text==="set"||D.text==="get"))&&b.test(B)?(B==="in"||B==="of")&&(D.type===c.WORD||D.type===c.STRING)?this._create_token(c.OPERATOR,B):this._create_token(c.RESERVED,B):this._create_token(c.WORD,B);if(B=this.__patterns.number.read(),B!=="")return this._create_token(c.WORD,B)},E.prototype._read_singles=function(D){var B=null;return D==="("||D==="["?B=this._create_token(c.START_EXPR,D):D===")"||D==="]"?B=this._create_token(c.END_EXPR,D):D==="{"?B=this._create_token(c.START_BLOCK,D):D==="}"?B=this._create_token(c.END_BLOCK,D):D===";"?B=this._create_token(c.SEMICOLON,D):D==="."&&R.test(this._input.peek(1))?B=this._create_token(c.DOT,D):D===","&&(B=this._create_token(c.COMMA,D)),B&&this._input.next(),B},E.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(c.EQUALS,D):D==="?."?this._create_token(c.DOT,D):this._create_token(c.OPERATOR,D)},E.prototype._read_non_javascript=function(D){var B="";if(D==="#"){if(this._is_first_token()&&(B=this.__patterns.shebang.read(),B))return this._create_token(c.UNKNOWN,B.trim()+`
`);if(B=this.__patterns.include.read(),B)return this._create_token(c.UNKNOWN,B.trim()+`
`);D=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(T)){do D=this._input.next(),j+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,j)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(B=this.__patterns.html_comment_start.read(),B){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)B+=this._input.next();return m=!0,this._create_token(c.COMMENT,B)}}else if(m&&D==="-"&&(B=this.__patterns.html_comment_end.read(),B))return m=!1,this._create_token(c.COMMENT,B);return null},E.prototype._read_comment=function(D){var B=null;if(D==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var I=L.get_directives(j);I&&I.ignore==="start"&&(j+=L.readIgnored(this._input)),j=j.replace(d.allLineBreaks,`
`),B=this._create_token(c.BLOCK_COMMENT,j),B.directives=I}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),B=this._create_token(c.COMMENT,j))}return B},E.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var B=this._input.next();return this.has_char_escapes=!1,D==="`"?B+=this._read_string_recursive("`",!0,"${"):B+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(B=N(B)),this._input.peek()===D&&(B+=this._input.next()),B=B.replace(d.allLineBreaks,`
`),this._create_token(c.STRING,B)}return null},E.prototype._allow_regexp_or_xml=function(D){return D.type===c.RESERVED&&u(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===c.END_EXPR&&D.text===")"&&D.opened.previous.type===c.RESERVED&&u(D.opened.previous.text,["if","while","for"])||u(D.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},E.prototype._read_regexp=function(D,B){if(D==="/"&&this._allow_regexp_or_xml(B)){for(var j=this._input.next(),I=!1,v=!1;this._input.hasNext()&&(I||v||this._input.peek()!==D)&&!this._input.testChar(d.newline);)j+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===D&&(j+=this._input.next(),j+=this._input.read(d.identifier)),this._create_token(c.STRING,j)}return null},E.prototype._read_xml=function(D,B){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(B)){var j="",I=this.__patterns.xml.read_match();if(I){for(var v=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=v.indexOf("{")===0,Y=0;I;){var re=!!I[1],oe=I[2],we=!!I[I.length-1]||oe.slice(0,8)==="![CDATA[";if(!we&&(oe===v||G&&oe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(re?--Y:++Y),j+=I[0],Y<=0)break;I=this.__patterns.xml.read_match()}return I||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(d.allLineBreaks,`
`),this._create_token(c.STRING,j)}}return null};function N(D){for(var B="",j=0,I=new p(D),v=null;I.hasNext();)if(v=I.match(/([\s]|[^\\]|\\\\)+/g),v&&(B+=v[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")v=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")v=I.match(/u([0-9A-Fa-f]{4})/g);else{B+="\\",I.hasNext()&&(B+=I.next());continue}if(!v)return D;if(j=parseInt(v[1],16),j>126&&j<=255&&v[0].indexOf("x")===0)return D;if(j>=0&&j<32){B+="\\"+v[0];continue}else j===34||j===39||j===92?B+="\\"+String.fromCharCode(j):B+=String.fromCharCode(j)}return B}E.prototype._read_string_recursive=function(D,B,j){var I,v;D==="'"?v=this.__patterns.single_quote:D==='"'?v=this.__patterns.double_quote:D==="`"?v=this.__patterns.template_text:D==="}"&&(v=this.__patterns.template_expression);for(var G=v.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!B&&d.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Y+=this._input.next()):j&&(j==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),j===Y&&(D==="`"?Y+=this._read_string_recursive("}",B,"`"):Y+=this._read_string_recursive("`",B,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=v.read(),G+=Y}return G},M.exports.Tokenizer=E,M.exports.TOKEN=c,M.exports.positionable_operators=C.slice(),M.exports.line_starters=_.slice()},function(M){var O=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(O&&p.sticky)&&(h.index!==f&&(h=null)),h},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,h){var n="",d;return p&&(d=this.match(p),d&&(n+=d[0])),f&&(d||!p)&&(n+=this.readUntil(f,h)),n},g.prototype.readUntil=function(p,f){var h="",n=this.__position;p.lastIndex=this.__position;var d=p.exec(this.__input);return d?(n=d.index,f&&(n+=d[0].length)):n=this.__input_length,h=this.__input.substring(this.__position,n),this.__position=n,h},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var h=null,n="g";return f&&O&&(n="y"),typeof p=="string"&&p!==""?h=new RegExp(p,n):p&&(h=new RegExp(p.source,n)),h},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},function(M,O,g){var p=g(8).InputScanner,f=g(3).Token,h=g(10).TokenStream,n=g(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(a,u){this._input=new p(a),this._options=u||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new n(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var a,u=new f(d.START,""),c=null,L=[],S=new h;u.type!==d.EOF;){for(a=this._get_next_token(u,c);this._is_comment(a);)S.add(a),a=this._get_next_token(u,c);S.isEmpty()||(a.comments_before=S,S=new h),a.parent=c,this._is_opening(a)?(L.push(c),c=a):c&&this._is_closing(a,c)&&(a.opened=c,c.closed=a,c=L.pop(),a.parent=c),a.previous=u,u.next=a,this.__tokens.add(a),u=a}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(a,u){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(d.RAW,c):this._create_token(d.EOF,"")},l.prototype._is_comment=function(a){return!1},l.prototype._is_opening=function(a){return!1},l.prototype._is_closing=function(a,u){return!1},l.prototype._create_token=function(a,u){var c=new f(a,u,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},M.exports.Tokenizer=l,M.exports.TOKEN=d},function(M){function O(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}O.prototype.restart=function(){this.__position=0},O.prototype.isEmpty=function(){return this.__tokens_length===0},O.prototype.hasNext=function(){return this.__position<this.__tokens_length},O.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},O.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},O.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},M.exports.TokenStream=O},function(M,O,g){var p=g(12).Pattern;function f(h,n){p.call(this,h,n),n?this._line_regexp=this._input.get_regexp(n._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new p,f.prototype.__set_whitespace_patterns=function(h,n){h+="\\t ",n+="\\n\\r",this._match_pattern=this._input.get_regexp("["+h+n+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+n+"]")},f.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var h=this._input.read(this._match_pattern);if(h===" ")this.whitespace_before_token=" ";else if(h){var n=this.__split(this._newline_regexp,h);this.newline_count=n.length-1,this.whitespace_before_token=n[this.newline_count]}return h},f.prototype.matching=function(h,n){var d=this._create();return d.__set_whitespace_patterns(h,n),d._update(),d},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(h,n){h.lastIndex=0;for(var d=0,l=[],a=h.exec(n);a;)l.push(n.substring(d,a.index)),d=a.index+a[0].length,a=h.exec(n);return d<n.length?l.push(n.substring(d,n.length)):l.push(""),l},M.exports.WhitespacePattern=f},function(M){function O(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}O.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},O.prototype.read_match=function(){return this._input.match(this._match_pattern)},O.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},O.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},O.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},O.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},O.prototype._create=function(){return new O(this._input,this)},O.prototype._update=function(){},M.exports.Pattern=O},function(M){function O(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}O.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},O.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=O},function(M,O,g){var p=g(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function h(n,d){p.call(this,n,d),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var l=new p(n);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}h.prototype=new p,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(n){var d=this._create();return d._disabled[n]=!0,d._update(),d},h.prototype.read_options=function(n){var d=this._create();for(var l in f)d._disabled[l]=n.templating.indexOf(l)===-1;return d._update(),d},h.prototype.exclude=function(n){var d=this._create();return d._excluded[n]=!0,d._update(),d},h.prototype.read=function(){var n="";this._match_pattern?n=this._input.read(this._starting_pattern):n=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),n+=d,d=this._read_template();return this._until_after&&(n+=this._input.readUntilAfter(this._until_pattern)),n},h.prototype.__set_templated_pattern=function(){var n=[];this._disabled.php||n.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||n.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||n.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(n.push(this.__patterns.django._starting_pattern.source),n.push(this.__patterns.django_value._starting_pattern.source),n.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||n.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&n.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+n.join("|")+")")},h.prototype._read_template=function(){var n="",d=this._input.peek();if(d==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(n=n||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(n=n||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(n=n||this.__patterns.handlebars_comment.read(),n=n||this.__patterns.handlebars_unescaped.read(),n=n||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(n=n||this.__patterns.django_value.read()),this._excluded.django||(n=n||this.__patterns.django_comment.read(),n=n||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(n=n||this.__patterns.smarty_comment.read(),n=n||this.__patterns.smarty_literal.read(),n=n||this.__patterns.smarty.read()));return n},M.exports.TemplatablePattern=h}],F={};function z(M){var O=F[M];if(O!==void 0)return O.exports;var g=F[M]={exports:{}};return H[M](g,g.exports,z),g.exports}var W=z(0);P=W})();var Q=P;!(le=[],J=function(){return{js_beautify:Q}}.apply(Ye,le),J!==void 0&&(ct.exports=J))})()},"7Cbv":function(ct,Ye,ae){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function P(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(J)}var Q=/^(?:[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 H(f){return typeof f=="string"&&Q.test(f)}for(var F=H,z=[],W=0;W<256;++W)z.push((W+256).toString(16).substr(1));function M(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(z[f[h+0]]+z[f[h+1]]+z[f[h+2]]+z[f[h+3]]+"-"+z[f[h+4]]+z[f[h+5]]+"-"+z[f[h+6]]+z[f[h+7]]+"-"+z[f[h+8]]+z[f[h+9]]+"-"+z[f[h+10]]+z[f[h+11]]+z[f[h+12]]+z[f[h+13]]+z[f[h+14]]+z[f[h+15]]).toLowerCase();if(!F(n))throw TypeError("Stringified UUID is invalid");return n}var O=M;function g(f,h,n){f=f||{};var d=f.random||(f.rng||P)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,h){n=n||0;for(var l=0;l<16;++l)h[n+l]=d[l];return h}return O(d)}var p=Ye.a=g},"7ahc":function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return L});var le=ae("k1fw"),J=ae("0Owb"),P=ae("+L6B"),Q=ae("2/Rp"),H=ae("y8nQ"),F=ae("Vl3Y"),z=ae("tJVT"),W=ae("OaEy"),M=ae("2fM7"),O=ae("q1tI"),g=ae.n(O),p=ae("VrN/"),f=ae.n(p),h=ae("p77/"),n=ae.n(h),d=ae("c5Ni"),l=ae.n(d),a=M.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},c={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"]};Ye.b=function(S){var T=S.callback,R=S.onCancel,C=Object(O.useState)("python"),w=Object(z.a)(C,2),x=w[0],_=w[1];function o(m){_(c[m][1])}function b(m){T(m)}return g.a.createElement(F.a,Object(J.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(M.a,{onChange:o},Object.keys(c).map(function(m){return g.a.createElement(a,{key:m,value:m},c[m][0])}))),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(L,{mode:x})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(Q.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function L(S){var T=S.value,R=S.onChange,C=S.mode,w=S.options,x=w===void 0?{}:w,_=Object(O.useRef)(),o=Object(O.useState)(),b=Object(z.a)(o,2),m=b[0],E=b[1];return Object(O.useEffect)(function(){if(m){function N(D){var B=D.getValue();R&&R(B)}return m.on("change",N),function(){m.off("change",N)}}},[m,R]),Object(O.useEffect)(function(){m&&m.setOption("mode",C)},[m,C]),Object(O.useEffect)(function(){m&&((T!==m.getValue()||T==="")&&setTimeout(function(){m.setValue(T||" ")},300))},[m,T]),Object(O.useEffect)(function(){if(_.current&&!m){var N=f.a.fromTextArea(_.current,Object(le.a)({mode:C,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},x));E(N)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){"use strict";le.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J<le.modeInfo.length;J++){var P=le.modeInfo[J];P.mimes&&(P.mime=P.mimes[0])}le.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var H=0;H<le.modeInfo.length;H++){var F=le.modeInfo[H];if(F.mime==Q)return F;if(F.mimes){for(var z=0;z<F.mimes.length;z++)if(F.mimes[z]==Q)return F}}if(/\+xml$/.test(Q))return le.findModeByMIME("application/xml");if(/\+json$/.test(Q))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var H=0;H<le.modeInfo.length;H++){var F=le.modeInfo[H];if(F.ext){for(var z=0;z<F.ext.length;z++)if(F.ext[z]==Q)return F}}},le.findModeByFileName=function(Q){for(var H=0;H<le.modeInfo.length;H++){var F=le.modeInfo[H];if(F.file&&F.file.test(Q))return F}var z=Q.lastIndexOf("."),W=z>-1&&Q.substring(z+1,Q.length);if(W)return le.findModeByExtension(W)},le.findModeByName=function(Q){Q=Q.toLowerCase();for(var H=0;H<le.modeInfo.length;H++){var F=le.modeInfo[H];if(F.name.toLowerCase()==Q)return F;if(F.alias){for(var z=0;z<F.alias.length;z++)if(F.alias[z].toLowerCase()==Q)return F}}}})},"8hTe":function(ct,Ye,ae){ct.exports={button:"button___1wy9m"}},"9Bee":function(ct,Ye,ae){"use strict";var le=ae("DYRE"),J=ae("zeV3"),P=ae("+L6B"),Q=ae("2/Rp"),H=ae("k1fw"),F=ae("9og8"),z=ae("tJVT"),W=ae("WmNS"),M=ae.n(W),O=ae("q1tI"),g=ae.n(O),p=ae("vg9a"),f=ae("DlQD"),h=ae.n(f),n=ae("rUJ1");function d(X,y){var A=X.match(/^(\s+)(?:```)/);if(A===null)return y;var U=A[1];return y.split(`
`).map(function(q){var V=q.match(/^\s+/);if(V===null)return q;var ye=Object(z.a)(V,1),He=ye[0];return He.length>=U.length?q.slice(U.length):q}).join(`
`)}var l=[],a=["<ul>"],u=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){l.length=0,a=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function T(X,y,A,U){if(y>=X.length||X[y].level<=A)return y;var q=X[y];U.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),y++;var V=[];return y=T(X,y,q.level,V),V.length>0&&(U.push("<ul>"),V.forEach(function(ye){U.push(ye)}),U.push("</ul>")),U.push("</li>"),y=T(X,y,A,U),y}function R(){return T(l,0,0,a),a.push("</ul>"),a.join("")}var C={heading:function(y){var A=c.exec(y);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(y){var A=this.rules.block.fences.exec(y);if(A){var U=A[0],q=d(U,A[3]||""),V=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(V)>=0){var ye=_(),He=q;q=ye,o[ye]={type:"block",expression:He}}return{type:"code",raw:U,lang:V,text:q}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,_=function(){return"__special_katext_id_".concat(x++,"__")},o={};function b(){return o}function m(){x=0,o={}}function E(X){return X=X.replace(w,function(y,A){var U=_();return o[U]={type:"inline",expression:A},U}),X}var N=u.listitem;u.listitem=function(X){return N(E(X))};var D=u.paragraph;u.paragraph=function(X){return D(E(X))};var B=u.tablecell;u.tablecell=function(X,y){return B(E(X),y)},u.code=function(X,y,A){var U=(y||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(y,'">').concat(A?X:Object(n.escape)(X,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(A?X:Object(n.escape)(X,!0))+"</code></pre>"},u.heading=function(X,y,A){var U=this.options.headerPrefix+A.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:U,level:y,text:X}),"<h"+y+' id="'+U+'">'+X+"</h"+y+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:C,renderer:u});var j=h.a,I=ae("SJMd"),v=ae("ulZh"),G=ae.n(v),Y=ae("m3rI"),re=ae("Oy/b"),oe=ae("p5ED"),we=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 pe=function(X,y){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,U){A.__proto__=U}||function(A,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(A[q]=U[q])})(X,y)};function xe(X,y){function A(){this.constructor=X}pe(X,y),X.prototype=y===null?Object.create(y):(A.prototype=y.prototype,new A)}function _e(X,y,A,U){return new(A||(A=Promise))(function(q,V){function ye(gt){try{et(U.next(gt))}catch(Ge){V(Ge)}}function He(gt){try{et(U.throw(gt))}catch(Ge){V(Ge)}}function et(gt){var Ge;gt.done?q(gt.value):(Ge=gt.value,Ge instanceof A?Ge:new A(function(_t){_t(Ge)})).then(ye,He)}et((U=U.apply(X,y||[])).next())})}function Se(X,y){var A,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function He(et){return function(gt){return function(Ge){if(A)throw new TypeError("Generator is already executing.");for(;ye;)try{if(A=1,U&&(q=2&Ge[0]?U.return:Ge[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Ge[1])).done)return q;switch(U=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,U=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<q[1]){ye.label=q[1],q=Ge;break}if(q&&ye.label<q[2]){ye.label=q[2],ye.ops.push(Ge);break}q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=y.call(X,ye)}catch(_t){Ge=[6,_t],U=0}finally{A=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,gt])}}}function ce(){for(var X=0,y=0,A=arguments.length;y<A;y++)X+=arguments[y].length;var U=Array(X),q=0;for(y=0;y<A;y++)for(var V=arguments[y],ye=0,He=V.length;ye<He;ye++,q++)U[q]=V[ye];return U}var ue=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(y,A){for(var U=0,q=A;U<q.length;U++){var V=q[U],ye=V[0],He=V[1];y.setAttribute(ye,He)}},X.createRect=function(y,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",A.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(y,A,U,q,V){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",y.toString()),ye.setAttribute("y1",A.toString()),ye.setAttribute("x2",U.toString()),ye.setAttribute("y2",q.toString()),V&&X.setAttributes(ye,V),ye},X.createPolygon=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",y),A&&X.setAttributes(U,A),U},X.createCircle=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(y/2).toString()),U.setAttribute("cy",(y/2).toString()),U.setAttribute("r",y.toString()),A&&X.setAttributes(U,A),U},X.createEllipse=function(y,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(A/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&X.setAttributes(A,y),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(y,A,U,q,V,ye,He){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(et,[["id",y],["orient",A],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",ye.toString()]]),et.appendChild(He),et},X.createText=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),y&&X.setAttributes(A,y),A},X.createTSpan=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=y,A&&X.setAttributes(U,A),U},X.createImage=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&X.setAttributes(A,y),A},X.createPoint=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=y,U.y=A,U},X.createPath=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",y),A&&X.setAttributes(U,A),U},X}(),ie=function(){function X(){}return X.addKey=function(y){X.key=y},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),de=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(y,A,U){var q=this;return new Promise(function(V){var ye=U!==void 0?U:document.createElement("canvas");y===null&&(q.markersOnly=!0,q.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",A.width.baseVal.valueAsString),He.setAttribute("height",A.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+A.viewBox.baseVal.width.toString()+" "+A.viewBox.baseVal.height.toString()),He.innerHTML=A.innerHTML,q.naturalSize===!0?(He.width.baseVal.value=y.naturalWidth,He.height.baseVal.value=y.naturalHeight):q.width!==void 0&&q.height!==void 0&&(He.width.baseVal.value=q.width,He.height.baseVal.value=q.height),ye.width=He.width.baseVal.value,ye.height=He.height.baseVal.value;var et=He.outerHTML,gt=ye.getContext("2d");q.markersOnly!==!0&&gt.drawImage(y,0,0,ye.width,ye.height);var Ge=window.URL,_t=new Image(ye.width,ye.height);_t.setAttribute("crossOrigin","anonymous");var jt=new Blob([et],{type:"image/svg+xml"}),$t=Ge.createObjectURL(jt);_t.onload=function(){gt.drawImage(_t,0,0),Ge.revokeObjectURL($t);var Pi=ye.toDataURL(q.imageType,q.imageQuality);V(Pi)},_t.src=$t})},X}(),se=function(){},Oe=function(){function X(y){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},X.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new ke("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Te("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Te("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),ke=function(X,y){this.selector=X,this.style=y},Te=function(X,y){this.localName=X,this.style=y},Ae=function(){function X(y,A,U,q,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=y,this.displayMode=A,this.markerItems=U,this.uiStyleSettings=q,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(y){var A=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(V){var ye=document.createElement("div");ye.className=""+A.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",V.typeName),ye.innerHTML=V.icon,ye.addEventListener("click",function(){A.markerToolbarButtonClicked(ye,V)}),A.buttons.push(ye),A.markerButtons.push(ye)}),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 q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<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(q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},X.prototype.addButtonClickListener=function(y){this.buttonClickListeners.push(y)},X.prototype.removeButtonClickListener=function(y){this.buttonClickListeners.indexOf(y)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(y),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var y=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var A=0;A<this.markerButtons.length;A++)A<y||A===y&&this.markerButtons.length-1===y?this.markerButtonBlock.appendChild(this.markerButtons[A]):(A===y&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[A]))}},X.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},X.prototype.resetButtonStyles=function(){var y=this;this.buttons.forEach(function(A){A.className=A.className.replace(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name,"").trim(),A.className=A.className.replace(y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:y.toolbarActiveButtonStyleColorsClass.name,"").trim(),A.className+=" "+(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(y,A,U){var q=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=A,V.setAttribute("data-action",U),V.addEventListener("click",function(){q.actionToolbarButtonClicked(V,U)}),U){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}y.appendChild(V),this.buttons.push(V)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Te("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 Te("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Te("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Te("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 Te("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Te("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},X.prototype.markerToolbarButtonClicked=function(y,A){this.setActiveButton(y),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",A)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(y,A){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",A)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(y){this.resetButtonStyles(),y.className=y.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),y.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(y){var A=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===y});A&&this.setActiveButton(A)},X.prototype.setCurrentMarker=function(y){var A=this;this.currentMarker=y,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){A.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},X}(),Le=function(){function X(y,A,U,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=y,this.displayMode=A,this.uiStyleSettings=U,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var y;this.toolboxStyleClass=this.styles.addClass(new Te("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 Te("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Te("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Te("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Te("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 Te("toolbox-panel-row_colors",`
background-color: `+((y=this.uiStyleSettings.toolboxBackgroundColor)!==null&&y!==void 0?y:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Te("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
padding: `+A+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},X.prototype.show=function(y){var A;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolboxStyleClass.name+" "+((A=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(y){var A,U,q=this;this.panels=y,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((A=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var ye;V.uiStyleSettings=q.uiStyleSettings;var He=document.createElement("div");He.className=q.toolboxButtonStyleClass.name+" "+((ye=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:q.toolboxButtonStyleColorsClass.name),He.innerHTML=V.icon,He.title=V.title,He.addEventListener("click",function(){q.panelButtonClick(V)}),q.panelButtons.push(He),q.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(y){var A=this,U=-1;if(y!==this.activePanel){U=this.panels.indexOf(y),this.panelRow.innerHTML="";var q=y.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),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=y}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){A.displayMode==="inline"?A.panelRow.style.display="none":A.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,ye){var He,et;V.className=A.toolboxButtonStyleClass.name+" "+(ye===U?""+((He=A.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:A.toolboxActiveButtonStyleColorsClass.name):""+((et=A.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&et!==void 0?et:A.toolboxButtonStyleColorsClass.name))})},X}(),Be=function(X,y){this.title=X,this.icon=y},Fe=function(X){function y(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=U,ye.currentColor=q,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(q){var V=A.getColorBox(q);U.appendChild(V),A.colorBoxes.push(V)}),U},y.prototype.getColorBox=function(A){var U=this,q=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-q,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=V-2+"px",ye.style.height=V-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(V+2)/2+"px",ye.style.borderColor=A===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){U.setCurrentColor(A,ye)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=V-2+"px",He.style.height=V-2+"px",He.style.backgroundColor=A,He.style.borderRadius=V/2+"px",A==="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>`),ye.appendChild(He),ye},y.prototype.setCurrentColor=function(A,U){var q=this;this.currentColor=A,this.colorBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(A)},y}(Be),De=function(){function X(y,A,U){this._state="new",this._isSelected=!1,this._container=y,this._overlayContainer=A,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(y){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(y,A){},X.prototype.dblClick=function(y,A){},X.prototype.manipulate=function(y){},X.prototype.pointerUp=function(y){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(y){this.container.childNodes.length>0?this.container.insertBefore(y,this.container.childNodes[0]):this.container.appendChild(y)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(y){this._state=y.state,this.notes=y.notes},X.prototype.scale=function(y,A){},X.prototype.colorChanged=function(y){this.onColorChanged&&this.onColorChanged(y),this.stateChanged()},X.prototype.fillColorChanged=function(y){this.onFillColorChanged&&this.onFillColorChanged(y),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var y=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),y.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(y)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),Ne=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(y){return this.topLeft.ownsTarget(y)?this.topLeft:this.topCenter.ownsTarget(y)?this.topCenter:this.topRight.ownsTarget(y)?this.topRight:this.centerLeft.ownsTarget(y)?this.centerLeft:this.centerRight.ownsTarget(y)?this.centerRight:this.bottomLeft.ownsTarget(y)?this.bottomLeft:this.bottomCenter.ownsTarget(y)?this.bottomCenter:this.bottomRight.ownsTarget(y)?this.bottomRight:void 0},X}(),Xe=function(){function X(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},X}(),Ze=function(){function X(){}return X.toITransformMatrix=function(y){return{a:y.a,b:y.b,c:y.c,d:y.d,e:y.e,f:y.f}},X.toSVGMatrix=function(y,A){return y.a=A.a,y.b=A.b,y.c=A.c,y.d=A.d,y.e=A.e,y.f=A.f,y},X}(),Je=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(ue.createTransform()),V.setupControlBox(),V}return xe(y,X),Object.defineProperty(y.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"visual",{get:function(){return this._visual},set:function(A){this._visual=A;var U=ue.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!!(this.controlGrips.findGripByVisual(A)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(A))},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.left=A.x,this.top=A.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(A);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},y.prototype.pointerUp=function(A){var U=this.state;X.prototype.pointerUp.call(this,A),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(A),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},y.prototype.moveVisual=function(A){this.visual.style.transform="translate("+A.x+"px, "+A.y+"px)"},y.prototype.manipulate=function(A){var U=this.unrotatePoint(A);this.state==="creating"?this.resize(A):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(A)},y.prototype.resize=function(A){var U=this.manipulationStartLeft,q=this.manipulationStartWidth,V=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+A.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+A.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+A.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+A.y-this.manipulationStartY}q>=0?(this.left=U,this.width=q):(this.left=U+q,this.width=-q),ye>=0?(this.top=V,this.height=ye):(this.top=V+ye,this.height=-ye),this.setSize()},y.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},y.prototype.rotate=function(A){if(Math.abs(A.x-this.centerX)>.1){var U=Math.sign(A.x-this.centerX);this.rotationAngle=180*Math.atan((A.y-this.centerY)/(A.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},y.prototype.applyRotation=function(){var A=this.container.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(A,0)},y.prototype.rotatePoint=function(A){if(this.rotationAngle===0)return A;var U=this.container.getCTM(),q=ue.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},y.prototype.unrotatePoint=function(A){if(this.rotationAngle===0)return A;var U=this.container.getCTM();U=U.inverse();var q=ue.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},y.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var A=ue.createTransform();A.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(A),this.container.appendChild(this.controlBox),this.controlRect=ue.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ue.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ne,this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){var A=this.controlBox.transform.baseVal.getItem(0);A.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(A,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()},y.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()},y.prototype.createGrip=function(){var A=new Xe;return A.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(A.visual),A},y.prototype.positionGrips=function(){var A=this.controlGrips.topLeft.GRIP_SIZE,U=-A/2,q=U,V=(this.width+this.CB_DISTANCE)/2-A/2,ye=(this.height+this.CB_DISTANCE)/2-A/2,He=this.height+this.CB_DISTANCE-A/2,et=this.width+this.CB_DISTANCE-A/2;this.positionGrip(this.controlGrips.topLeft.visual,U,q),this.positionGrip(this.controlGrips.topCenter.visual,V,q),this.positionGrip(this.controlGrips.topRight.visual,et,q),this.positionGrip(this.controlGrips.centerLeft.visual,U,ye),this.positionGrip(this.controlGrips.centerRight.visual,et,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,U,He),this.positionGrip(this.controlGrips.bottomCenter.visual,V,He),this.positionGrip(this.controlGrips.bottomRight.visual,et,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,q-3*this.CB_DISTANCE)},y.prototype.positionGrip=function(A,U,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(U,q),A.transform.baseVal.replaceItem(V,0)},y.prototype.hideControlBox=function(){this.controlBox.style.display="none"},y.prototype.showControlBox=function(){this.controlBox.style.display=""},y.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ze.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ze.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U);var q=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:q.x*A,y:q.y*U});this.left=V.x,this.top=V.y,this.width=this.width*A,this.height=this.height*U,this.adjustControlBox()},y}(De),$e=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},y.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},y.prototype.setSize=function(){X.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(A){X.prototype.pointerUp.call(this,A),this.setSize()},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},y.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){var U=A;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.setSize()},y.title="Rectangle marker",y}(Je),lt=function(X){function y(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=U,ye.currentWidth=q,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentWidth?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentWidth(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=q.toString(),ye.style.marginRight="5px",V.appendChild(ye);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var et=document.createElement("hr");et.style.minWidth="20px",et.style.border="0px",et.style.borderTop=q+"px solid "+A.uiStyleSettings.toolboxColor,et.style.flexGrow="2",He.appendChild(et),V.appendChild(He),A.widthBoxes.push(V)}),U},y.prototype.setCurrentWidth=function(A,U){var q=this;this.currentWidth=A,this.widthBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},y}(Be),tt=function(X){function y(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ye.styles=[],ye.styleBoxes=[],ye.styles=U,ye.currentStyle=q,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.styles.length-5+"%",V.style.borderColor=q===A.currentStyle?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentStyle(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+A.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
</svg>`;ye.innerHTML=He,V.appendChild(ye),A.styleBoxes.push(V)}),U},y.prototype.setCurrentStyle=function(A,U){var q=this;this.currentStyle=A,this.styleBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},y}(Be),it=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new lt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return xe(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="FrameMarker",y.title="Frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',y}($e),Ue=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},dt=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return xe(y,X),y.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!(!this.grip1.ownsTarget(A)&&!this.grip2.ownsTarget(A))},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.manipulationStartX=A.x,this.manipulationStartY=A.y,this.state==="new"&&(this.x1=A.x,this.y1=A.y,this.x2=A.x,this.y2=A.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(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},y.prototype.pointerUp=function(A){var U=this.state;X.prototype.pointerUp.call(this,A),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(A),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},y.prototype.adjustVisual=function(){},y.prototype.manipulate=function(A){this.state==="creating"?this.resize(A):this.state==="move"?(this.x1=this.manipulationStartX1+A.x-this.manipulationStartX,this.y1=this.manipulationStartY1+A.y-this.manipulationStartY,this.x2=this.manipulationStartX2+A.x-this.manipulationStartX,this.y2=this.manipulationStartY2+A.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(A)},y.prototype.resize=function(A){switch(this.activeGrip){case this.grip1:this.x1=A.x,this.y1=A.y;break;case this.grip2:case void 0:this.x2=A.x,this.y2=A.y}this.adjustVisual(),this.adjustControlBox()},y.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){this.positionGrips()},y.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},y.prototype.createGrip=function(){var A=new Xe;return A.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(A.visual),A},y.prototype.positionGrips=function(){var A=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-A/2,this.y1-A/2),this.positionGrip(this.grip2.visual,this.x2-A/2,this.y2-A/2)},y.prototype.positionGrip=function(A,U,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(U,q),A.transform.baseVal.replaceItem(V,0)},y.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.x1=this.x1*A,this.y1=this.y1*U,this.x2=this.x2*A,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},y}(De),rt=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new lt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorLine&&A!==this.visibleLine)},y.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},y.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},y.typeName="LineMarker",y.title="Line marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',y}(dt),Me=function(X){function y(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ye.fonts=[],ye.fontBoxes=[],ye.fonts=U,ye.currentFont=q,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(q){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.fonts.length-5+"%",V.style.borderColor=q===A.currentFont?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentFont(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=q,ye.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",ye.appendChild(He),V.appendChild(ye),A.fontBoxes.push(V)}),U},y.prototype.setCurrentFont=function(A,U){var q=this;this.currentFont=A,this.fontBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},y}(Be),ze=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=q.defaultColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return xe(y,X),y.prototype.ownsTarget=function(A){if(X.prototype.ownsTarget.call(this,A)||A===this.visual||A===this.textElement||A===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(q){q===A&&(U=!0)}),U},y.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.isMoved=!1,this.pointerDownPoint=A,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.renderText=function(){var A=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(U){A.textElement.appendChild(ue.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},y.prototype.getTextScale=function(){var A=this.textElement.getBBox(),U=1;if(A.width>0&&A.height>0){var q=(1*this.width-this.width*this.padding*2/100)/A.width,V=(1*this.height-this.height*this.padding*2/100)/A.height;U=Math.min(q,V)}return U},y.prototype.getTextPosition=function(A){var U=this.textElement.getBBox(),q=0,V=0;return U.width>0&&U.height>0&&(q=(this.width-U.width*A)/2,V=this.height/2-U.height*A/2),{x:q,y:V}},y.prototype.sizeText=function(){var A=this.textElement.getBBox(),U=this.getTextScale(),q=this.getTextPosition(U);q.y-=A.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(A.x-this.pointerDownPoint.x)>5||Math.abs(A.y-this.pointerDownPoint.y)>5)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.isMoved=!0,this.setSize(),this.sizeText()},y.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},y.prototype.pointerUp=function(A){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,A),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},y.prototype.showTextEditor=function(){var A=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(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(A.textEditor.style.fontSize);A.textEditor.clientWidth>=Number.parseInt(A.textEditor.style.maxWidth)&&U>.9;)U-=.1,A.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var q=U.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){A.textEditDivClicked(A.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},y.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var A=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),V={x:q.width*A,y:q.height*A};U.x-=V.x/2,U.y-=V.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*A,12)+"px",this.textElement.style.display="none"}},y.prototype.textEditDivClicked=function(A){this.text=A.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},y.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},y.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},y.prototype.dblClick=function(A,U){X.prototype.dblClick.call(this,A,U),this.showTextEditor()},y.prototype.setColor=function(A){this.textElement&&ue.setAttributes(this.textElement,[["fill",A]]),this.color=A,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(A)},y.prototype.setFont=function(A){this.textElement&&ue.setAttributes(this.textElement,[["font-family",A]]),this.fontFamily=A,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},y.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},y.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var U=A;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.setSize(),this.sizeText(),this.positionTextEditor()},y.typeName="TextMarker",y.title="Text marker",y.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>',y}(Je),Ce=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=q.defaultColor,V.lineWidth=q.defaultStrokeWidth,V.pixelRatio=q.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new lt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.drawingImage)},y.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var A=ue.createTransform();this.visual.transform.baseVal.appendItem(A),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,U){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(A.x,A.y),this.drawing=!0):X.prototype.pointerDown.call(this,A,U)},y.prototype.manipulate=function(A){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(A.x,A.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(A){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,A)},y.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)},y.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},y.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},y.prototype.finishCreation=function(){for(var A=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=U[0],V=U[1],ye=U[2],He=U[3],et=!1,gt=0;gt<this.canvasElement.height;gt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)A.data[gt*this.canvasElement.width*4+4*Ge+3]>0&&(et=!0,gt<V&&(V=gt),Ge<q&&(q=Ge),gt>He&&(He=gt),Ge>ye&&(ye=Ge));if(et){this.left=q/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(ye-q)/this.pixelRatio,this.height=(He-V)/this.pixelRatio;var _t=document.createElement("canvas");_t.width=ye-q,_t.height=He-V,_t.getContext("2d").putImageData(this.canvasContext.getImageData(q,V,ye-q,He-V),0,0),this.drawingImgUrl=_t.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},y.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},y.prototype.setColor=function(A){this.color=A,this.colorChanged(A)},y.prototype.setLineWidth=function(A){this.lineWidth=A},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){this.createVisual(),X.prototype.restoreState.call(this,A),this.drawingImgUrl=A.drawingImgUrl,this.setDrawingImage()},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.setDrawingImage()},y.typeName="FreehandMarker",y.title="Freehand marker",y.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>',y}(Je),ve=function(X){function y(A,U,q){var V=X.call(this,A,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=U,V.setCurrentType=V.setCurrentType.bind(V),V}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var q=function(He){var et="both";switch(He){case 0:et="both";break;case 1:et="start";break;case 2:et="end";break;case 3:et="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=et===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){A.setCurrentType(et,gt)}),U.appendChild(gt),et==="both"||et==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",gt.appendChild(Ge)}var _t=document.createElement("div");_t.style.display="flex",_t.style.alignItems="center",_t.style.minHeight="20px",_t.style.flexGrow="2";var jt=document.createElement("hr");if(jt.style.minWidth="20px",jt.style.border="0px",jt.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),jt.style.flexGrow="2",_t.appendChild(jt),gt.appendChild(_t),et==="both"||et==="end"){var $t=document.createElement("div");$t.style.display="flex",$t.style.alignItems="center",$t.style.minHeight="20px",$t.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,$t.style.marginRight="5px",gt.appendChild($t)}V.typeBoxes.push(gt)},V=this,ye=0;ye<4;ye++)q(ye);return U},y.prototype.setCurrentType=function(A,U){var q=this;this.currentType=A,this.typeBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},y}(Be),Ee=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new ve("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.arrow1&&A!==this.arrow2)},y.prototype.getArrowPoints=function(A,U){var q=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return A-q/2+","+(U+V/2)+" "+A+","+(U-V/2)+" "+(A+q/2)+","+(U+V/2)},y.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(A,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},y.prototype.setArrowType=function(A){this.arrowType=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},y.typeName="ArrowMarker",y.title="Arrow marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',y}(rt),te=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor=q.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",q.defaultColorSet,q.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return xe(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="CoverMarker",y.title="Cover marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',y}($e),ne=function(X){function y(A,U,q,V){var ye=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ye.opacities=[],ye.opacityBoxes=[],ye.opacities=U,ye.currentOpacity=q,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return xe(y,X),y.prototype.getUi=function(){var A=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentOpacity?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentOpacity(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=100*q+"%",V.appendChild(ye),A.opacityBoxes.push(V)}),U},y.prototype.setCurrentOpacity=function(A,U){var q=this;this.currentOpacity=A,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},y}(Be),he=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=q.defaultHighlightColor,V.strokeWidth=0,V.opacity=q.defaultHighlightOpacity,V.fillPanel=new Fe("Color",q.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new ne("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return xe(y,X),y.prototype.setOpacity=function(A){this.opacity=A,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="HighlightMarker",y.title="Highlight marker",y.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>',y}(te),me='<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>',be=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=q.defaultStrokeColor,V.bgColor=q.defaultFillColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",q.defaultColorSet,V.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",q.defaultColorSet,V.bgColor,me),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new Xe,V.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return xe(y,X),y.prototype.ownsTarget=function(A){return X.prototype.ownsTarget.call(this,A)||this.tipGrip.ownsTarget(A)||this.tip===A},y.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},y.prototype.pointerDown=function(A,U){this.state==="new"&&X.prototype.pointerDown.call(this,A,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,A,U)},y.prototype.pointerUp=function(A){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,A);else{var U=this.state==="creating";X.prototype.pointerUp.call(this,A),this.setTipPoints(U),this.positionTip()}},y.prototype.manipulate=function(A){if(this.tipMoving){var U=this.unrotatePoint(A);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,A)},y.prototype.setBgColor=function(A){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",A]]),ue.setAttributes(this.tip,[["fill",A]])),this.bgColor=A,this.fillColorChanged(A)},y.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},y.prototype.setTipPoints=function(A){A===void 0&&(A=!1);var U=Math.min(this.height/2,15),q=this.height/5;A&&(this.tipPosition={x:U+q/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+q,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-q},this.tipBase2Position={x:this.width,y:this.height-U}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-q})},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.positionTip()},y.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var A=this.tipGrip.visual.transform.baseVal.getItem(0);A.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(A,0)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},y.prototype.getState=function(){var A=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var U=A;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,X.prototype.restoreState.call(this,A),this.createTip(),this.setTipPoints()},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.tipPosition={x:this.tipPosition.x*A,y:this.tipPosition.y*U},this.positionTip()},y.typeName="CalloutMarker",y.title="Callout marker",y.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>',y}(ze),Pe=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.fillColor=q.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",ce(q.defaultColorSet,["transparent"]),q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",ce(q.defaultColorSet,["transparent"]),V.fillColor,me),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new lt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new ne("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},y.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},y.prototype.setSize=function(){X.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},y.prototype.pointerUp=function(A){X.prototype.pointerUp.call(this,A),this.setSize()},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},y.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(A),this.stateChanged()},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.setOpacity=function(A){this.opacity=A,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var U=A;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,U){X.prototype.scale.call(this,A,U),this.setSize()},y.typeName="EllipseMarker",y.title="Ellipse marker",y.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>',y}(Je),We=function(X){function y(A,U,q){return X.call(this,A,U,q)||this}return xe(y,X),Object.defineProperty(y.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.tip1&&A!==this.tip2)},y.prototype.createTips=function(){this.tip1=ue.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip2)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(A,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A),this.createTips(),this.adjustVisual()},y.typeName="MeasurementMarker",y.title="Measurement marker",y.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>',y}(rt),st=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokePanel.colors=q.defaultColorSet,V.fillColor="transparent",V}return xe(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="EllipseFrameMarker",y.title="Ellipse frame marker",y.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>',y}(Pe),ft=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(y){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(y)||(this.undoStack.push(y),JSON.stringify(this.lastRedoStep)!==JSON.stringify(y)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(y){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=y)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var y=this.undoStack.pop();return y!==void 0&&this.redoStack.push(y),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),pt=function(X){function y(A,U,q){var V=X.call(this,A,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new lt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return xe(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorCurve&&A!==this.visibleCurve&&!this.curveGrip.ownsTarget(A))},y.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},y.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,U){X.prototype.pointerDown.call(this,A,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=A.x,this.curveY=A.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},y.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},y.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},y.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var A=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-A/2,this.curveY-A/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()))},y.prototype.manipulate=function(A){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+A.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+A.y-this.manipulationStartY),X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){this.activeGrip===this.curveGrip&&(this.curveX=A.x,this.curveY=A.y),X.prototype.resize.call(this,A),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual()},y.prototype.scale=function(A,U){this.curveX=this.curveX*A,this.curveY=this.curveY*U,X.prototype.scale.call(this,A,U)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var U=A;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},y.typeName="CurveMarker",y.title="Curve marker",y.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>',y}(dt),Ct=function(){function X(y,A){A===void 0&&(A=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=y,this.cancelable=A}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),xt=function(X){function y(A,U,q){var V=X.call(this,A,!1)||this;return V.dataUrl=U,V.state=q,V}return xe(y,X),y}(Ct),ut=function(X){function y(A,U,q){q===void 0&&(q=!1);var V=X.call(this,A,q)||this;return V.marker=U,V}return xe(y,X),y}(Ct),Ut=function(){function X(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return X.prototype.addEventListener=function(y,A){this[y].push(A)},X.prototype.removeEventListener=function(y,A){var U=this[y].indexOf(A);U>-1&&this[y].splice(U,1)},X}(),Mt=function(){function X(y){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ue,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 Ut,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Oe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=y,this.targetRoot=document.body,this.width=y.clientWidth,this.height=y.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[it,Ce,Ee,ze,st,Pe,he,be,We,te,rt,pt]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[it,Ce,Ee,ze,Pe,he,be]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[it,Ce,Ee,ze,he]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(y){var A=this;this._availableMarkerTypes.splice(0),y.forEach(function(U){if(typeof U=="string"){var q=A.ALL_MARKER_TYPES.find(function(V){return V.typeName===U});q!==void 0&&A._availableMarkerTypes.push(q)}else A._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(y){this._zoomLevel=y,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),ie.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var y=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(A){return A(new Ct(y))})},X.prototype.render=function(){return _e(this,void 0,void 0,function(){var y;return Se(this,function(A){switch(A.label){case 0:return this.setCurrentMarker(),(y=new de).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.markersOnly=this.renderMarkersOnly,y.width=this.renderWidth,y.height=this.renderHeight,[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return A.sent(),[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,A.sent()]}})})},X.prototype.close=function(y){var A=this;if(y===void 0&&(y=!1),this.isOpen){var U=!1;y||this.eventListeners.beforeclose.forEach(function(q){var V=new Ct(A,!0);q(V),V.defaultPrevented&&(U=!0)}),U||(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(q){return q(new Ct(A))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var y,A=[],U=0;U<arguments.length;U++)A[U]=arguments[U];(y=this._availableMarkerTypes).push.apply(y,A)},X.prototype.addRenderEventListener=function(y){this.addEventListener("render",function(A){y(A.dataUrl,A.state)})},X.prototype.removeRenderEventListener=function(y){},X.prototype.addCloseEventListener=function(y){this.addEventListener("close",function(){y()})},X.prototype.removeCloseEventListener=function(y){},X.prototype.setupResizeObserver=function(){var y=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return y.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var y=1*this.target.clientWidth/this.target.clientHeight,A=this.editorCanvas.clientWidth/y>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*y:this.editorCanvas.clientWidth,U=A<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/y;this.resize(A,U)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(y,A){this._isResizing=!0;var U=y/this.imageWidth,q=A/this.imageHeight;this.imageWidth=Math.round(y),this.imageHeight=Math.round(A),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(U,q),this._isResizing=!1},X.prototype.scaleMarkers=function(y,A){var U,q=this;this._currentMarker&&this._currentMarker instanceof ze?this._currentMarker.scale(y,A):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==q._currentMarker&&V.scale(y,A)}),U!==void 0&&this.setCurrentMarker(U)},X.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},X.prototype.setTopLeft=function(){var y=this.editingTarget.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=y.left-A.left,this.top=y.top-A.top},X.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},X.prototype.addDefs=function(){for(var y,A=[],U=0;U<arguments.length;U++)A[U]=arguments[U];this.defs=ue.createDefs(),this.addDefsToImage(),(y=this.defs).append.apply(y,A)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},X.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var y=document.createElement("a");y.href="https://markerjs.com/",y.target="_blank",y.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>',y.title="Powered by marker.js",y.style.display="grid",y.style.alignItems="center",y.style.justifyItems="center",y.style.padding="3px",y.style.width="20px",y.style.height="20px",this.logoUI.appendChild(y),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},X.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"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 Ae(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 Le(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(y){this.markerImage.removeChild(y.container),this.markers.indexOf(y)>-1&&this.markers.splice(this.markers.indexOf(y),1),y.dispose()},X.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},X.prototype.toolbarButtonClicked=function(y,A){if(y==="marker"&&A!==void 0)this.createNewMarker(A);else if(y==="action")switch(A){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},X.prototype.deleteSelectedMarker=function(){var y=this;if(this._currentMarker!==void 0){var A=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var V=new ut(y,y._currentMarker,!0);q(V),V.defaultPrevented&&(A=!0)}),!A){var U=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(q){return q(new ut(y,U))})}}},X.prototype.clear=function(){var y=this,A=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var He=new ut(y,void 0,!0);ye(He),He.defaultPrevented&&(A=!0)}),!A)){this.setCurrentMarker();for(var U=function(ye){var He=q.markers[ye];q.setCurrentMarker(q.markers[ye]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(et){return et(new ut(y,He))})},q=this,V=this.markers.length-1;V>=0;V--)U(V);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var y;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=(y=this._currentMarker.notes)!==null&&y!==void 0?y:"",this.overlayContainer.appendChild(this.notesArea))},X.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var y=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var A=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===A.width&&U.height===A.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(A),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Ct(y))})}else this.undoRedoManager.replaceLastUndoStep(A),this.eventListeners.statechange.forEach(function(V){return V(new Ct(y))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var y=this,A=this.undoRedoManager.undo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new Ct(y))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var y=this,A=this.undoRedoManager.redo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new Ct(y))}))},X.prototype.stepZoom=function(){var y=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=y<this.zoomSteps.length-1?this.zoomSteps[y+1]:this.zoomSteps[0]},X.prototype.panTo=function(y){this.contentDiv.scrollBy({left:this.prevPanPoint.x-y.x,top:this.prevPanPoint.y-y.y}),this.prevPanPoint=y},X.prototype.startRenderAndClose=function(){return _e(this,void 0,void 0,function(){var y,A,U=this;return Se(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return y=q.sent(),A=this.getState(),this.eventListeners.render.forEach(function(V){return V(new xt(U,y,A))}),this.close(!0),[2]}})})},X.prototype.getState=function(y){y===!0&&this.setCurrentMarker();var A={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return A.markers.push(U.getState())}),A},X.prototype.restoreState=function(y){var A=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);y.markers.forEach(function(U){var q=A._availableMarkerTypes.find(function(ye){return ye.typeName===U.typeName});if(q!==void 0){var V=A.addNewMarker(q);V.restoreState(U),A.markers.push(V)}}),y.width&&y.height&&(y.width!==this.imageWidth||y.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/y.width,this.imageHeight/y.height),this.eventListeners.restorestate.forEach(function(U){return U(new Ct(A))})},X.prototype.addNewMarker=function(y){var A=ue.createGroup();return this.markerImage.appendChild(A),new y(A,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(y){var A,U=this;(A=typeof y=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===y}):y)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(A),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(A.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new ut(U,U._currentMarker))}))},X.prototype.markerCreated=function(y){var A=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(y),this.setCurrentMarker(y),y instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new ut(A,A._currentMarker))})},X.prototype.colorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=y,this.settings.defaultStrokeColor=y)},X.prototype.fillColorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=y)},X.prototype.markerStateChanged=function(y){var A=this;this.eventListeners.markerchange.forEach(function(U){return U(new ut(A,y))})},X.prototype.setCurrentMarker=function(y){var A=this;this._currentMarker!==y&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new ut(A,A._currentMarker))})),this._currentMarker=y,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(U){return U(new ut(A,A._currentMarker))}))},X.prototype.onPointerDown=function(y){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||y.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var A=this.markers.find(function(U){return U.ownsTarget(y.target)});A!==void 0?(this.setCurrentMarker(A),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:y.clientX,y:y.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY))},X.prototype.onDblClick=function(y){if(this._isFocused||this.focus(),this.mode==="select"){var A=this.markers.find(function(U){return U.ownsTarget(y.target)});A!==void 0&&A!==this._currentMarker&&this.setCurrentMarker(A),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(y){this.touchPoints!==1&&y.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||y.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(y.clientX,y.clientY)):this.zoomLevel>1&&this.panTo({x:y.clientX,y:y.clientY}))},X.prototype.onPointerUp=function(y){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(y.clientX,y.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(y){this._currentMarker===void 0||this.notesArea!==void 0||y.key!=="Delete"&&y.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(y,A){var U=this.markerImage.getBoundingClientRect();return{x:(y-U.left)/this.zoomLevel,y:(A-U.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},X.prototype.addLicenseKey=function(y){ie.addKey(y)},X.prototype.addEventListener=function(y,A){this.eventListeners.addEventListener(y,A)},X.prototype.removeEventListener=function(y,A){this.eventListeners.removeEventListener(y,A)},X.prototype.renderState=function(y){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(y),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var y=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(A){return A(new Ct(y))}))},X.prototype.blur=function(){var y=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(A){return A(new Ct(y))}))},X.instanceCounter=0,X}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Jt=function(X,y){return(Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,U){A.__proto__=U}||function(A,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(A[q]=U[q])})(X,y)};function Yt(X,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function A(){this.constructor=X}Jt(X,y),X.prototype=y===null?Object.create(y):(A.prototype=y.prototype,new A)}function Rt(X,y,A,U){return new(A||(A=Promise))(function(q,V){function ye(gt){try{et(U.next(gt))}catch(Ge){V(Ge)}}function He(gt){try{et(U.throw(gt))}catch(Ge){V(Ge)}}function et(gt){var Ge;gt.done?q(gt.value):(Ge=gt.value,Ge instanceof A?Ge:new A(function(_t){_t(Ge)})).then(ye,He)}et((U=U.apply(X,y||[])).next())})}function Ti(X,y){var A,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function He(et){return function(gt){return function(Ge){if(A)throw new TypeError("Generator is already executing.");for(;ye;)try{if(A=1,U&&(q=2&Ge[0]?U.return:Ge[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Ge[1])).done)return q;switch(U=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return ye.label++,{value:Ge[1],done:!1};case 5:ye.label++,U=Ge[1],Ge=[0];continue;case 7:Ge=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ye=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){ye.label=Ge[1];break}if(Ge[0]===6&&ye.label<q[1]){ye.label=q[1],q=Ge;break}if(q&&ye.label<q[2]){ye.label=q[2],ye.ops.push(Ge);break}q[2]&&ye.ops.pop(),ye.trys.pop();continue}Ge=y.call(X,ye)}catch(_t){Ge=[6,_t],U=0}finally{A=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,gt])}}}var Ui=function(){function X(){}return X.addKey=function(y){X.key=y},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),qe=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(y,A){for(var U=0,q=A;U<q.length;U++){var V=q[U],ye=V[0],He=V[1];y.setAttribute(ye,He)}},X.createRect=function(y,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",A.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(y,A,U,q,V){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",y.toString()),ye.setAttribute("y1",A.toString()),ye.setAttribute("x2",U.toString()),ye.setAttribute("y2",q.toString()),V&&X.setAttributes(ye,V),ye},X.createPolygon=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",y),A&&X.setAttributes(U,A),U},X.createCircle=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(y/2).toString()),U.setAttribute("cy",(y/2).toString()),U.setAttribute("r",y.toString()),A&&X.setAttributes(U,A),U},X.createEllipse=function(y,A,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(A/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&X.setAttributes(A,y),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(y,A,U,q,V,ye,He){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(et,[["id",y],["orient",A],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",ye.toString()]]),et.appendChild(He),et},X.createText=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),y&&X.setAttributes(A,y),A},X.createTSpan=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=y,A&&X.setAttributes(U,A),U},X.createImage=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&X.setAttributes(A,y),A},X.createPoint=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=y,U.y=A,U},X.createPath=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",y),A&&X.setAttributes(U,A),U},X.createElement=function(y,A){var U=document.createElementNS("http://www.w3.org/2000/svg",y);return A&&X.setAttributes(U,A),U},X.getHollowRectanglePath=function(y,A,U,q,V,ye,He,et){return"M"+y+","+A+"V"+(A+q)+"H"+(y+U)+"V"+A+"H"+V+"V"+ye+"H"+(V+He)+"V"+(ye+et)+"H"+V+"V"+A+"Z"},X}(),wt=function(){function X(y){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},X.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Ot("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ot("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Ot("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Lt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Lt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Ot=function(X,y){this.selector=X,this.style=y},Lt=function(X,y){this.localName=X,this.style=y},qt=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(y){y.className=this.blockClassName,y.buttonClassName=this.buttonClassName,y.buttonColorsClassName=this.buttonColorsClassName,y.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(y)},X.prototype.addElementBlock=function(y){y.className===void 0&&(y.className=this.blockClassName),this.blocks.push(y)},X.prototype.getUI=function(){var y=document.createElement("div");return y.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,y.style.display=this.display,this.blocks.forEach(function(A){return y.appendChild(A.getUI())}),y},X}(),qi=function(){function X(){}return X.prototype.getUI=function(){var y=document.createElement("div");if(y.className=this.className,this.minWidth!==void 0&&(y.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":y.style.justifyContent="flex-start";break;case"center":y.style.justifyContent="center";break;case"end":y.style.justifyContent="flex-end"}return y.style.whiteSpace="nowrap",y},X}(),er=function(X){function y(){var A=X!==null&&X.apply(this,arguments)||this;return A.buttons=[],A}return Yt(y,X),y.prototype.addButton=function(A){A.className=this.buttonClassName,A.colorsClassName=this.buttonColorsClassName,A.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(A)},y.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.buttons.forEach(function(U){return A.appendChild(U.getUI())}),A},y}(qi),Bt=function(){function X(y,A){this._isActive=!1,this._isHidden=!1,this._icon=y,this.title=A,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(y){this._icon=y,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(y){this._isActive=y,this.adjustClassName()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){var y=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 y.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},X.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,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),mt=function(X){function y(){var A=X!==null&&X.apply(this,arguments)||this;return A.elements=[],A}return Yt(y,X),y.prototype.addElement=function(A){this.elements.push(A)},y.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.elements.forEach(function(U){return A.appendChild(U)}),A},y}(qi),Gi=function(){function X(y,A){this.horizontal=y,this.vertical=A}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(y){return y/this.ratio},X.prototype.getHorizontalLength=function(y){return y*this.ratio},X}(),tr=function(){function X(){}return X.getIcon=function(y,A){if(y>0&&A>0){var U=new Gi(y,A),q=U.ratio>=1?20:U.getHorizontalLength(20),V=U.ratio<1?20:U.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var He=qe.createDefs();ye.appendChild(He);var et=qe.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(et);var gt=qe.createPath(qe.getHollowRectanglePath((24-q)/2,(24-V)/2,q,V,(24-q)/2+2,(24-V)/2+2,q-4,V-4));ye.appendChild(gt);var Ge=qe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(qe.createTSpan(y+":"+A)),ye.appendChild(Ge);var _t=Ge.getBBox();qe.setAttributes(Ge,[["x",((24-_t.width)/2).toString()],["y",((24-_t.height)/2-_t.y).toString()]]);var jt=qe.createPath(qe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(_t.width))/2,(24-Math.ceil(_t.height))/2,Math.ceil(_t.width),Math.ceil(_t.height)));return et.appendChild(jt),qe.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.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>'},X}(),vi=function(X){function y(A,U,q){var V=X.call(this,A,U)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=q,V}return Yt(y,X),y.prototype.setupDropdown=function(){var A=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=A.className,U.colorsClassName=A.colorsClassName,A.dropdownBlock.appendChild(U.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},y.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},y.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},y.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},y.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},y.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},y}(Bt),kt=function(){function X(y,A){this.GRIP_SIZE=10,this.color=y,this.fillColor=A,this.visual=qe.createGroup(),this.visual.appendChild(qe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(qe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},X.prototype.setCenter=function(y,A){this.visual.childNodes.forEach(function(U){return qe.setAttributes(U,[["cx",y.toString()],["cy",A.toString()]])})},X}(),Bi=function(){function X(y,A,U,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=y,this.canvasHeight=A,this.margin=U,this.container=q,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(X.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(y){this._aspectRatio=y,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.gridContainer&&qe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(y){this._zoomFactor=y,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var y=this;this.cropShadeElement=qe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=qe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var A=0;A<this.numberOfGridLines;A++)this.horizontalGridLines.push(qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(U){return y.gridContainer.appendChild(U)}),this.verticalGridLines.forEach(function(U){return y.gridContainer.appendChild(U)}),this.cropRectElement=qe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(y){this.cropRect=y;var A=Object.assign({},this.cropRect);this.zoomFactor!==1&&(A.width=this.cropRect.width*this.zoomFactor,A.height=this.cropRect.height*this.zoomFactor,A.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-A.width/2,A.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-A.height/2),qe.setAttributes(this.cropRectElement,[["x",A.x.toString()],["y",A.y.toString()],["width",A.width.toString()],["height",A.height.toString()]]);var U=A.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,ye){var He=A.y+U*(ye+1);qe.setAttributes(V,[["x1",""+A.x],["y1",""+He],["x2",""+(A.x+A.width)],["y2",""+He]])});var q=A.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,ye){var He=A.x+q*(ye+1);qe.setAttributes(V,[["x1",""+He],["y1",""+A.y],["x2",""+He],["y2",""+(A.y+A.height)]])}),qe.setAttributes(this.cropShadeElement,[["d",qe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,A.x,A.y,A.width,A.height)]]),this.topLeftGrip.setCenter(A.x,A.y),this.topRightGrip.setCenter(A.x+A.width,A.y),this.bottomLeftGrip.setCenter(A.x,A.y+A.height),this.bottomRightGrip.setCenter(A.x+A.width,A.y+A.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.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)},X.prototype.clientToLocalCoordinates=function(y,A){var U=this.container.getBoundingClientRect();return{x:y-U.left+this.margin,y:A-U.top+this.margin}},X.prototype.onPointerDown=function(y){this.container.setPointerCapture(y.pointerId),this.previousPoint=this.clientToLocalCoordinates(y.clientX,y.clientY),this.cropRectElement===y.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(y.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(y.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(y.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(y.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(y){if(this.isMoving)this.move(this.clientToLocalCoordinates(y.clientX,y.clientY));else if(this.activeGrip){var A=this.clientToLocalCoordinates(y.clientX,y.clientY);this.resize(A)}y.preventDefault()},X.prototype.onPointerUp=function(y){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(y.pointerId)},X.prototype.move=function(y){var A=y.x-this.previousPoint.x,U=y.y-this.previousPoint.y;this.zoomFactor!==1&&(A=-A/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+A),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=y},X.prototype.resize=function(y){var A=Object.assign({},this.cropRect),U=y.x-this.previousPoint.x,q=y.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:A.x+U<this.margin&&(U=this.margin-A.x),A.x+=U,A.width=this.cropRect.x+this.cropRect.width-A.x;break;case this.bottomRightGrip:case this.topRightGrip:A.width+U>this.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-A.width),A.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(A.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),A.height=this.aspectRatio.getVerticalLength(A.width)):(A.y+=q,A.height=this.cropRect.y+this.cropRect.height-A.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?A.height=this.aspectRatio.getVerticalLength(A.width):A.height+=q}A.width<10&&(A.x=this.cropRect.x,A.width=10),A.height<10&&(A.y=this.cropRect.y,A.height=10),this.previousPoint=y,A.x>=this.margin&&A.y>=this.margin&&A.x-this.margin+A.width<=this.canvasWidth&&A.y-this.margin+A.height<=this.canvasHeight&&(this.cropRect=A,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var y=this.cropRect.x+this.cropRect.width/2,A=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=U:this.cropRect.height=q,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=y-this.cropRect.width/2,this.cropRect.y=A-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)}},X.prototype.getRescaledRect=function(y,A,U,q,V,ye){var He=U/y,et=q/A;return{x:(V.x-ye)*He+ye,y:(V.y-ye)*et+ye,width:V.width*He,height:V.height*et}},X.prototype.scaleCanvas=function(y,A){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,y,A,this.cropRect,this.margin);this.canvasWidth=y,this.canvasHeight=A,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},X}(),Vi=function(){function X(y){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=y,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(X.prototype,"angle",{get:function(){return this._angle},set:function(y){this._angle=y,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.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},X.prototype.onPointerDown=function(y){this.controlContainer.setPointerCapture(y.pointerId),this.isDragging=!0,this.previousPoint={x:y.clientX,y:y.clientY}},X.prototype.onPointerMove=function(y){this.isDragging&&(this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.previousPoint.x=y.clientX)},X.prototype.onPointerUp=function(y){this.isDragging&&this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(y.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var y=this.angleLabelText.getBBox();qe.setAttributes(this.angleLabelElement,[["x",((this.width-y.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var y=this.scaleShape.transform.baseVal.getItem(0);y.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(y,0)}},X.prototype.getVisual=function(){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("xmlns","http://www.w3.org/2000/svg"),y.setAttribute("width",this.width+"px"),y.setAttribute("height",this.height+"px"),y.setAttribute("viewBox","0 0 "+this.width+" "+this.height),y.style.flexShrink="0",document.body.appendChild(y);for(var A="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var q=U%5==0?this.height/3:this.height/6;A+="h4v"+-q+"h1v"+q}A+="v1H0Z",this.scaleShape=qe.createPath(A);var V=qe.createTransform();this.scaleShape.transform.baseVal.appendItem(V),y.appendChild(this.scaleShape),this.angleLabelElement=qe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=qe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=qe.createTSpan("");return ye.innerHTML="&deg;",this.angleLabelElement.appendChild(ye),y.appendChild(this.angleLabelElement),document.body.removeChild(y),y},X}(),fr=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(y,A,U,q,V,ye,He){var et=this;return new Promise(function(gt){var Ge=document.createElement("canvas");Ge.width=y.width.baseVal.value-2*q,Ge.height=y.height.baseVal.value-2*q;var _t=1,jt=1;et.naturalSize===!0?(_t=A.naturalWidth/(y.width.baseVal.value-2*q)/ye,jt=A.naturalHeight/(y.height.baseVal.value-2*q)/He,Ge.width=A.naturalWidth/ye,Ge.height=A.naturalHeight/He):et.width!==void 0&&et.height!==void 0&&(_t=et.width/U.width,jt=et.height/U.height,Ge.width*=_t,Ge.height*=jt);var $t=Ge.getContext("2d");$t.translate(Ge.width/2,Ge.height/2),$t.rotate(V*Math.PI/180),$t.scale(ye,He),$t.translate(-Ge.width/2,-Ge.height/2),$t.drawImage(A,0,0,Ge.width,Ge.height);var Pi=document.createElement("canvas");Pi.width=U.width*_t,Pi.height=U.height*jt,Pi.getContext("2d").putImageData($t.getImageData((U.x-q)*_t,(U.y-q)*jt,U.width*_t,U.height*jt),0,0),gt(Pi.toDataURL(et.imageType,et.imageQuality))})},X}(),Ve=function(){function X(y){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=X.instanceCounter++,this.styles=new wt(this.instanceNo),this.target=y,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(y){this._zoomToCropEnabled=y,y?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(y){this._gridLines=y,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(y){this._rotationAngle=y,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"aspectRatio",{get:function(){var y;return(y=this._aspectRatio)!==null&&y!==void 0?y:this.aspectRatios[0]},set:function(y){this._aspectRatio=y},enumerable:!1,configurable:!0}),X.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},X.prototype.show=function(){this.showUI(),this.open()},X.prototype.close=function(y){y===void 0&&(y=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),y||this.closeEventListeners.forEach(function(A){return A()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(y){this.renderEventListeners.push(y)},X.prototype.removeRenderEventListener=function(y){this.renderEventListeners.indexOf(y)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(y),1)},X.prototype.addCloseEventListener=function(y){this.closeEventListeners.push(y)},X.prototype.removeCloseEventListener=function(y){this.closeEventListeners.indexOf(y)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(y),1)},X.prototype.setupResizeObserver=function(){var y=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.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))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var y=1*this.target.clientWidth/this.target.clientHeight,A=this.contentDiv.clientWidth/y>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*y:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=A+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/y;this.resize(A,U)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.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",qe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(y,A){this.imageWidth=Math.round(y),this.imageHeight=Math.round(A),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()},X.prototype.setEditingTarget=function(){var y=document.createElement("canvas");y.width=this.target.naturalWidth,y.height=this.target.naturalHeight,y.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var A=y.toDataURL();qe.setAttributes(this.editingTarget,[["href",A]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var y=this.target.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=y.left-A.left-this.CANVAS_MARGIN,this.top=y.top-A.top-this.CANVAS_MARGIN},X.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=qe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=qe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=qe.createGroup(),this.editingTargetRotationScaleContainer=qe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var y=qe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(y);var A=qe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(A),this.editingTargetContainer=qe.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)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=qe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Bi(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()},X.prototype.zoomToCrop=function(){if(this.cropRect){var y=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,A=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=y+"px "+A+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-y+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-A+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.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)},X.prototype.cropRectChanged=function(y){this.cropRect=y,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},X.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.prototype.showUI=function(){switch(this.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 y=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,A=this.target.offsetTop>y+this.CANVAS_MARGIN?this.target.offsetTop-(y+this.CANVAS_MARGIN):0;this.coverDiv.style.top=A+"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},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.prototype.addTopToolbar=function(){var y=this;this.topToolbar=new qt,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 A=new er;A.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(A);var U=[];this.aspectRatios.forEach(function(jt){var $t=new Bt(tr.getIcon(jt.horizontal,jt.vertical),jt.horizontal===0&&jt.vertical===0?"FREE":jt.horizontal+":"+jt.vertical);$t.onClick=function(){return y.ratioButtonClicked(jt)},U.push($t)}),this.aspectRatioButton=new vi(tr.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,A.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Bt('<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");q.isActive=this.isGridVisible,q.onClick=function(){y.isGridVisible=!y.isGridVisible,q.isActive=y.isGridVisible},A.addButton(q);var V=new Bt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(V.isActive=this.zoomToCropEnabled,V.onClick=function(){y.zoomToCropEnabled=!y.zoomToCropEnabled,V.isActive=y.zoomToCropEnabled},A.addButton(V),!Ui.isLicensed){var ye=new mt;this.topToolbar.addElementBlock(ye);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var et=document.createElement("a");et.style.color="currentColor",et.href="https://markerjs.com/products/cropro",et.target="_blank",et.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(et),ye.addElement(He)}var gt=new er;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Ge=new Bt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,gt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var _t=new Bt('<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");_t.onClick=this.close,gt.addButton(_t),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(_t.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var y=this;this.bottomToolbar=new qt,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 A=new er;A.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(A);var U=new Bt('<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");U.onClick=this.rotateLeftButtonClicked,A.addButton(U);var q=new Bt('<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");q.onClick=this.rotateRightButtonClicked,A.addButton(q);var V=new mt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Vi("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(gt){y.rotateBy(gt),y.straightener.angle=y.rotationAngle},V.addElement(this.straightener.getUI());var ye=new er;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var He=new Bt('<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,ye.addButton(He);var et=new Bt('<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");et.onClick=this.flipVerticallyButtonClicked,ye.addButton(et)},X.prototype.ratioButtonClicked=function(y){this.aspectRatio=y,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Gi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(y){if(y){var A=this.cropLayer.getRescaledRect(y.width,y.height,this.imageWidth,this.imageHeight,y.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(A),this.cropRectChanged(A),this.flippedHorizontally=y.flippedHorizontally,this.flippedVertically=y.flippedVertically,this.applyFlip(),this.rotationAngle=y.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(y,A){var U=this.cropImage.getBoundingClientRect();return{x:y-U.left,y:A-U.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var y=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=y+"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()},X.prototype.rotateLeftButtonClicked=function(){var y=this.rotationAngle-90;this.rotationAngle%90!=0&&(y+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(y)},X.prototype.rotateRightButtonClicked=function(){var y=this.rotationAngle+90;this.rotationAngle%90!=0&&(y-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(y)},X.prototype.rotateTo=function(y){y=(y=y>180?y-360:y)<=-180?y+360:y,this.rotationAngle=y,this.applyRotation()},X.prototype.rotateBy=function(y){this.rotateTo((this.rotationAngle+y)%360)},X.prototype.applyRotation=function(){var y=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var A=this.editingTargetRotationContainer.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(A,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=y},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Rt(this,void 0,void 0,function(){var y,A;return Ti(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return y=U.sent(),A=this.getState(),this.renderEventListeners.forEach(function(q){return q(y,A)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Rt(this,void 0,void 0,function(){var y;return Ti(this,function(A){switch(A.label){case 0:return(y=new fr).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.width=this.renderWidth,y.height=this.renderHeight,this.unzoomFromCrop(),qe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,y.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 A.sent(),[4,y.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,A.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Lt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var y=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Lt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*y)+`px;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Lt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},X.instanceCounter=0,X}(),Tt=ae("8hTe"),pr=ae.n(Tt),mr=/<pre[^>]*>/g;function gr(X){var y=document.createElement("div");return y.innerHTML=X,y.childNodes.length===0?"":y.childNodes[0].nodeValue}var vr=Ye.a=function(X){var y=X.value,A=y===void 0?"":y,U=X.edit,q=U===void 0?!1:U,V=X.className,ye=X.showTextOnly,He=X.showLines,et=X.replaces,gt=X.zoomImg,Ge=X.hasMask,_t=X.style,jt=_t===void 0?{}:_t,$t=X.stylesPrev,Pi=$t===void 0?{}:$t,yi=String(A),_i=Object(O.useRef)(),Xi=Object(O.useRef)(),Ir=Object(O.useState)(""),li=Object(z.a)(Ir,2),ji=li[0],or=li[1],lr=Object(O.useState)("office"),Mi=Object(z.a)(lr,2),kr=Mi[0],yr=Mi[1],zr=function(){var Ht=new Ve(Xi.current);Ht.displayMode="popup",Ht.addRenderEventListener(function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:return _i.current.style.display="none",ui.next=3,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri}});case 3:zt=ui.sent,zt!=null&&zt.id&&et(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),Ht.show()},Kr=function(){var Ht=new Mt(Xi.current);Ht.settings.displayMode="popup",Ht.addEventListener("render",function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:if(_i.current.style.display="none",!Xi.current){ui.next=6;break}return ui.next=4,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri.dataUrl}});case 4:zt=ui.sent,zt!=null&&zt.id&&et(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),Ht.show(),window.markerArea=Ht},Yi=Object(O.useMemo)(function(){_i.current&&(_i.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ht=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;yi=yi.replace(ti,"("+Y.a.API_SERVER+"/api/attachments/").replace(Ht,'"'+Y.a.API_SERVER+"/api/attachments/").replace(pi,'"'+Y.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(ir){}var Dt=j(yi),ri=b();if(yi.match(/\[TOC\]/)&&(Dt=Dt.replace("<p>[TOC]</p>",R()),L()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ir,ui){var wi=ri[ui],Vr=wi.type,Er=wi.expression;return Object(re.renderToString)(gr(Er)||"",{displayMode:Vr==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ye){var zt=document.createElement("div");return zt.innerHTML=Dt,zt.innerText}return setTimeout(function(){return dn()},500),Dt},[yi]),zi=Object(O.useRef)();S.WebkitLineClamp=He,He&&(jt=Object(H.a)(Object(H.a)({},jt),S));function _r(ti){var Ht=ti.target;if(Ht.tagName.toUpperCase()==="IMG"){if(gt){var pi=Ht.getAttribute("src");or(pi),yr("image")}}else if(Ht.tagName.toUpperCase()==="A"){var Dt=Ht.getAttribute("href");if(Dt.indexOf("office")>-1)ti.preventDefault(),or(Dt),yr("office");else if(Dt.indexOf("application/pdf")>-1)ti.preventDefault(),or(Dt),yr("pdf");else if(Dt.indexOf("text/html")>-1)ti.preventDefault(),or(Dt),yr("html");else if(Dt.startsWith("#")){ti.preventDefault();var ri=document.getElementById(Dt.replace("#",""));ri&&ri.scrollIntoView(!0)}}}var dn=function(){var Ht,pi=(Ht=zi.current)===null||Ht===void 0?void 0:Ht.querySelectorAll("video");pi==null||pi.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var ri=new G.a;ri.loadSource(Dt.src),ri.attachMedia(Dt)}}})};Object(O.useEffect)(function(){if(zi.current&&Yi&&(Yi.match(mr)&&window.PR.prettyPrint()),zi.current)return zi.current.addEventListener("click",_r),function(){zi.current.removeEventListener("click",_r),m(),L()}},[Yi,zi.current,_r]);var br=function(Ht){if(!q)return;Ht.target.nodeName==="IMG"?(_i.current.style.zIndex=1,_i.current.style.display="flex",_i.current.style.width=Ht.target.clientWidth+"px",_i.current.style.height=Ht.target.clientHeight+"px",_i.current.style.top=Ht.target.offsetTop+"px",_i.current.style.left=Ht.target.offsetLeft+"px",Xi.current.src=Ht.target.getAttribute("src")):_i.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:zi,style:Object(H.a)({},jt),className:"".concat(V||""," markdown-body ").concat(pr.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:Yi}}),g.a.createElement("div",{ref:_i,className:pr.a.button},g.a.createElement(J.a,null,g.a.createElement(Q.a,{onClick:function(){return zr()}},"\u88C1\u526A"),g.a.createElement(Q.a,{onClick:function(){return Kr()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Xi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(oe.a,{close:!0,data:ji,type:ji!=null&&ji.length?kr:"",style:Object(H.a)({},Pi),onClose:function(){return or("")}}))}},"9VGf":function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return P});var le=ae("q1tI"),J=ae.n(le);function P(Q,H){var F=Object(le.useRef)();Object(le.useEffect)(function(){F.current=Q}),Object(le.useEffect)(function(){function z(){F.current()}if(H!==null){var W=setInterval(z,H);return function(){return clearInterval(W)}}},[H])}},BU3w:function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return F});var le=ae("MNnm"),J="rc-util-key";function P(z){if(z.attachTo)return z.attachTo;var W=document.querySelector("head");return W||document.body}function Q(z){var W,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var O=document.createElement("style");if((W=M.csp)===null||W===void 0?void 0:W.nonce){var g;O.nonce=(g=M.csp)===null||g===void 0?void 0:g.nonce}O.innerHTML=z;var p=P(M),f=p.firstChild;return M.prepend&&p.prepend?p.prepend(O):M.prepend&&f?p.insertBefore(O,f):p.appendChild(O),O}var H=new Map;function F(z,W){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=P(M);if(!H.has(O)){var g=Q("",M),p=g.parentNode;H.set(O,p),p.removeChild(g)}var f=Array.from(H.get(O).children).find(function(a){return a.tagName==="STYLE"&&a[J]===W});if(f){var h,n;if(((h=M.csp)===null||h===void 0?void 0:h.nonce)&&f.nonce!==((n=M.csp)===null||n===void 0?void 0:n.nonce)){var d;f.nonce=(d=M.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==z&&(f.innerHTML=z),f}var l=Q(z,M);return l[J]=W,l}},Bd2K:function(ct,Ye,ae){(function(le){le(ae("VrN/"),ae("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(M,O,g){if(g!=le.Init&&g&&M.removeKeyMap("autoCloseTags"),!O)return;var p={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(p["'/'"]=function(f){return F(f)}),(typeof O!="object"||O.whenOpening!==!1)&&(p["'>'"]=function(f){return Q(f)}),M.addKeyMap(p)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["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 Q(M){if(M.getOption("disableInput"))return le.Pass;for(var O=M.listSelections(),g=[],p=M.getOption("autoCloseTags"),f=0;f<O.length;f++){if(!O[f].empty())return le.Pass;var h=O[f].head,n=M.getTokenAt(h),d=le.innerMode(M.getMode(),n.state),l=d.state,a=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(l),u=a&&a.name;if(!u)return le.Pass;var c=d.mode.configuration=="html",L=typeof p=="object"&&p.dontCloseTags||c&&J,S=typeof p=="object"&&p.indentTags||c&&P;n.end>h.ch&&(u=u.slice(0,u.length-n.end+h.ch));var T=u.toLowerCase();if(!u||n.type=="string"&&(n.end!=h.ch||!/[\"\']/.test(n.string.charAt(n.string.length-1))||n.string.length==1)||n.type=="tag"&&a.close||n.string.indexOf("/")==h.ch-n.start-1||L&&z(L,T)>-1||W(M,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(l)||[],u,h,!0))return le.Pass;var R=typeof p=="object"&&p.emptyTags;if(R&&z(R,u)>-1){g[f]={text:"/>",newPos:le.Pos(h.line,h.ch+2)};continue}var C=S&&z(S,T)>-1;g[f]={indent:C,text:">"+(C?`
`:"")+"</"+u+">",newPos:C?le.Pos(h.line+1,0):le.Pos(h.line,h.ch+1)}}for(var w=typeof p=="object"&&p.dontIndentOnAutoClose,f=O.length-1;f>=0;f--){var x=g[f];M.replaceRange(x.text,O[f].head,O[f].anchor,"+insert");var _=M.listSelections().slice(0);_[f]={head:x.newPos,anchor:x.newPos},M.setSelections(_),!w&&x.indent&&(M.indentLine(x.newPos.line,null,!0),M.indentLine(x.newPos.line+1,null,!0))}}function H(M,O){for(var g=M.listSelections(),p=[],f=O?"/":"</",h=M.getOption("autoCloseTags"),n=typeof h=="object"&&h.dontIndentOnSlash,d=0;d<g.length;d++){if(!g[d].empty())return le.Pass;var l=g[d].head,a=M.getTokenAt(l),u=le.innerMode(M.getMode(),a.state),c=u.state;if(O&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=l.ch-1))return le.Pass;var L,S=u.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(S&&u.mode.name=="javascript")L=f+"script";else if(S&&u.mode.name=="css")L=f+"style";else{var T=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(c);if(!T||T.length&&W(M,T,T[T.length-1],l))return le.Pass;L=f+T[T.length-1]}M.getLine(l.line).charAt(a.end)!=">"&&(L+=">"),p[d]=L}if(M.replaceSelections(p),g=M.listSelections(),!n)for(var d=0;d<g.length;d++)(d==g.length-1||g[d].head.line<g[d+1].head.line)&&M.indentLine(g[d].head.line)}function F(M){return M.getOption("disableInput")?le.Pass:H(M,!0)}le.commands.closeTag=function(M){return H(M)};function z(M,O){if(M.indexOf)return M.indexOf(O);for(var g=0,p=M.length;g<p;++g)if(M[g]==O)return g;return-1}function W(M,O,g,p,f){if(!le.scanForClosingTag)return!1;var h=Math.min(M.lastLine()+1,p.line+500),n=le.scanForClosingTag(M,p,null,h);if(!n||n.tag!=g)return!1;for(var d=f?1:0,l=O.length-1;l>=0&&O[l]==g;l--)++d;p=n.to;for(var l=1;l<d;l++){var a=le.scanForClosingTag(M,p,null,h);if(!a||a.tag!=g)return!1;p=a.to}return!0}})},BjJ7:function(ct,Ye,ae){"use strict";ae.d(Ye,"d",function(){return J}),ae.d(Ye,"c",function(){return P}),ae.d(Ye,"e",function(){return Q}),ae.d(Ye,"b",function(){return H}),ae.d(Ye,"a",function(){return z});var le=ae("m3rI");function J(W){var M=!0;if(W.length>0){for(var O=0;O<W.length;O++)if(W[O].compile_success==0||!W[O].compile_success){M=!1;break}}else M=!1;return M}function P(W){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],g=0;g<W.length;g++){var p=W[g],f=M?"".concat(M,"/").concat(p.name):"".concat(p.name);O.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return O}function Q(W,M,O){for(var g=0;g<W.length;g++){var p=W[g];if(p.key===M){p.children=O;break}p.children&&Q(p.children,M,O)}return W}function H(W,M,O){var g;return function(){var p=this,f=arguments,h=function(){g=null,O||W.apply(p,f)},n=O&&!g;clearTimeout(g),g=setTimeout(h,M),n&&W.apply(p,f)}}var F=!0,z=le.a.API_SERVER},"C+DQ":function(ct,Ye,ae){},DlQD:function(ct,Ye,ae){(function(le,J){ct.exports=J()})(this,function(){"use strict";function le(Ce,ve){for(var Ee=0;Ee<ve.length;Ee++){var te=ve[Ee];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(Ce,te.key,te)}}function J(Ce,ve,Ee){return ve&&le(Ce.prototype,ve),Ee&&le(Ce,Ee),Ce}function P(Ce,ve){if(!Ce)return;if(typeof Ce=="string")return Q(Ce,ve);var Ee=Object.prototype.toString.call(Ce).slice(8,-1);if(Ee==="Object"&&Ce.constructor&&(Ee=Ce.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(Ce);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return Q(Ce,ve)}function Q(Ce,ve){(ve==null||ve>Ce.length)&&(ve=Ce.length);for(var Ee=0,te=new Array(ve);Ee<ve;Ee++)te[Ee]=Ce[Ee];return te}function H(Ce,ve){var Ee;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(Ee=P(Ce))||ve&&Ce&&typeof Ce.length=="number"){Ee&&(Ce=Ee);var te=0;return function(){return te>=Ce.length?{done:!0}:{done:!1,value:Ce[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return Ee=Ce[Symbol.iterator](),Ee.next.bind(Ee)}function F(Ce,ve){return ve={exports:{}},Ce(ve,ve.exports),ve.exports}var z=F(function(Ce){function ve(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Ee(te){Ce.exports.defaults=te}Ce.exports={defaults:ve(),getDefaults:ve,changeDefaults:Ee}}),W=z.defaults,M=z.getDefaults,O=z.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},d=function(ve){return n[ve]};function l(Ce,ve){if(ve){if(g.test(Ce))return Ce.replace(p,d)}else if(f.test(Ce))return Ce.replace(h,d);return Ce}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(Ce){return Ce.replace(a,function(ve,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var c=/(^|[^\[])\^/g;function L(Ce,ve){Ce=Ce.source||Ce,ve=ve||"";var Ee={replace:function(ne,he){return he=he.source||he,he=he.replace(c,"$1"),Ce=Ce.replace(ne,he),Ee},getRegex:function(){return new RegExp(Ce,ve)}};return Ee}var S=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ce,ve,Ee){if(Ce){var te;try{te=decodeURIComponent(u(Ee)).replace(S,"").toLowerCase()}catch(ne){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ve&&!T.test(Ee)&&(Ee=o(ve,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(ne){return null}return Ee}var C={},w=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Ce,ve){C[" "+Ce]||(w.test(Ce)?C[" "+Ce]=Ce+"/":C[" "+Ce]=N(Ce,"/",!0)),Ce=C[" "+Ce];var Ee=Ce.indexOf(":")===-1;return ve.substring(0,2)==="//"?Ee?ve:Ce.replace(x,"$1")+ve:ve.charAt(0)==="/"?Ee?ve:Ce.replace(_,"$1")+ve:Ce+ve}var b={exec:function(){}};function m(Ce){for(var ve=1,Ee,te;ve<arguments.length;ve++){Ee=arguments[ve];for(te in Ee)Object.prototype.hasOwnProperty.call(Ee,te)&&(Ce[te]=Ee[te])}return Ce}function E(Ce,ve){var Ee=Ce.replace(/\|/g,function(he,me,be){for(var Pe=!1,We=me;--We>=0&&be[We]==="\\";)Pe=!Pe;return Pe?"|":" |"}),te=Ee.split(/ \|/),ne=0;if(te.length>ve)te.splice(ve);else for(;te.length<ve;)te.push("");for(;ne<te.length;ne++)te[ne]=te[ne].trim().replace(/\\\|/g,"|");return te}function N(Ce,ve,Ee){var te=Ce.length;if(te===0)return"";for(var ne=0;ne<te;){var he=Ce.charAt(te-ne-1);if(he===ve&&!Ee)ne++;else if(he!==ve&&Ee)ne++;else break}return Ce.substr(0,te-ne)}function D(Ce,ve){if(Ce.indexOf(ve[1])===-1)return-1;for(var Ee=Ce.length,te=0,ne=0;ne<Ee;ne++)if(Ce[ne]==="\\")ne++;else if(Ce[ne]===ve[0])te++;else if(Ce[ne]===ve[1]&&(te--,te<0))return ne;return-1}function B(Ce){Ce&&Ce.sanitize&&!Ce.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var j={escape:l,unescape:u,edit:L,cleanUrl:R,resolveUrl:o,noopTest:b,merge:m,splitCells:E,rtrim:N,findClosingBracket:D,checkSanitizeDeprecation:B},I=z.defaults,v=j.rtrim,G=j.splitCells,Y=j.escape,re=j.findClosingBracket;function oe(Ce,ve,Ee){var te=ve.href,ne=ve.title?Y(ve.title):null,he=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:te,title:ne,text:he}:{type:"image",raw:Ee,href:te,title:ne,text:Y(he)}}function we(Ce,ve){var Ee=Ce.match(/^(\s+)(?:```)/);if(Ee===null)return ve;var te=Ee[1];return ve.split(`
`).map(function(ne){var he=ne.match(/^\s+/);if(he===null)return ne;var me=he[0];return me.length>=te.length?ne.slice(te.length):ne}).join(`
`)}var pe=function(){function Ce(Ee){this.options=Ee||I}var ve=Ce.prototype;return ve.space=function(te){var ne=this.rules.block.newline.exec(te);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ve.code=function(te,ne){var he=this.rules.block.code.exec(te);if(he){var me=ne[ne.length-1];if(me&&me.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var be=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?be:v(be,`
`)}}},ve.fences=function(te){var ne=this.rules.block.fences.exec(te);if(ne){var he=ne[0],me=we(he,ne[3]||"");return{type:"code",raw:he,lang:ne[2]?ne[2].trim():ne[2],text:me}}},ve.heading=function(te){var ne=this.rules.block.heading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ve.nptable=function(te){var ne=this.rules.block.nptable.exec(te);if(ne){var he={type:"table",header:G(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(he.header.length===he.align.length){var me=he.align.length,be;for(be=0;be<me;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(me=he.cells.length,be=0;be<me;be++)he.cells[be]=G(he.cells[be],he.header.length);return he}}},ve.hr=function(te){var ne=this.rules.block.hr.exec(te);if(ne)return{type:"hr",raw:ne[0]}},ve.blockquote=function(te){var ne=this.rules.block.blockquote.exec(te);if(ne){var he=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:he}}},ve.list=function(te){var ne=this.rules.block.list.exec(te);if(ne){for(var he=ne[0],me=ne[2],be=me.length>1,Pe=me[me.length-1]===")",We={type:"list",raw:he,ordered:be,start:be?+me.slice(0,-1):"",loose:!1,items:[]},st=ne[0].match(this.rules.block.item),ft=!1,pt,Ct,xt,ut,Ut,Mt,Jt,Yt=st.length,Rt=0;Rt<Yt;Rt++)pt=st[Rt],he=pt,Ct=pt.length,pt=pt.replace(/^ *([*+-]|\d+[.)]) */,""),~pt.indexOf(`
`)&&(Ct-=pt.length,pt=this.options.pedantic?pt.replace(/^ {1,4}/gm,""):pt.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),Rt!==Yt-1&&(xt=this.rules.block.bullet.exec(st[Rt+1])[0],(be?xt.length===1||!Pe&&xt[xt.length-1]===")":xt.length>1||this.options.smartLists&&xt!==me)&&(ut=st.slice(Rt+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-ut.length),Rt=Yt-1)),Ut=ft||/\n\n(?!\s*$)/.test(pt),Rt!==Yt-1&&(ft=pt.charAt(pt.length-1)===`
`,Ut||(Ut=ft)),Ut&&(We.loose=!0),Mt=/^\[[ xX]\] /.test(pt),Jt=void 0,Mt&&(Jt=pt[1]!==" ",pt=pt.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:he,task:Mt,checked:Jt,loose:Ut,text:pt});return We}},ve.html=function(te){var ne=this.rules.block.html.exec(te);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]):Y(ne[0]):ne[0]}},ve.def=function(te){var ne=this.rules.block.def.exec(te);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var he=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ne[0],href:ne[2],title:ne[3]}}},ve.table=function(te){var ne=this.rules.block.table.exec(te);if(ne){var he={type:"table",header:G(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(he.header.length===he.align.length){he.raw=ne[0];var me=he.align.length,be;for(be=0;be<me;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(me=he.cells.length,be=0;be<me;be++)he.cells[be]=G(he.cells[be].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},ve.lheading=function(te){var ne=this.rules.block.lheading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ve.paragraph=function(te){var ne=this.rules.block.paragraph.exec(te);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ve.text=function(te,ne){var he=this.rules.block.text.exec(te);if(he){var me=ne[ne.length-1];return me&&me.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},ve.escape=function(te){var ne=this.rules.inline.escape.exec(te);if(ne)return{type:"escape",raw:ne[0],text:Y(ne[1])}},ve.tag=function(te,ne,he){var me=this.rules.inline.tag.exec(te);if(me)return!ne&&/^<a /i.test(me[0])?ne=!0:ne&&/^<\/a>/i.test(me[0])&&(ne=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:ne,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]}},ve.link=function(te){var ne=this.rules.inline.link.exec(te);if(ne){var he=re(ne[2],"()");if(he>-1){var me=ne[0].indexOf("!")===0?5:4,be=me+ne[1].length+he;ne[2]=ne[2].substring(0,he),ne[0]=ne[0].substring(0,be).trim(),ne[3]=""}var Pe=ne[2],We="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);st?(Pe=st[1],We=st[3]):We=""}else We=ne[3]?ne[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=oe(ne,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ne[0]);return ft}},ve.reflink=function(te,ne){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var me=(he[2]||he[1]).replace(/\s+/g," ");if(me=ne[me.toLowerCase()],!me||!me.href){var be=he[0].charAt(0);return{type:"text",raw:be,text:be}}var Pe=oe(he,me,he[0]);return Pe}},ve.strong=function(te,ne,he){he===void 0&&(he="");var me=this.rules.inline.strong.start.exec(te);if(me&&(!me[1]||me[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*te.length);var be=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Pe;(me=be.exec(ne))!=null;)if(Pe=this.rules.inline.strong.middle.exec(ne.slice(0,me.index+3)),Pe)return{type:"strong",raw:te.slice(0,Pe[0].length),text:te.slice(2,Pe[0].length-2)}}},ve.em=function(te,ne,he){he===void 0&&(he="");var me=this.rules.inline.em.start.exec(te);if(me&&(!me[1]||me[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*te.length);var be=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Pe;(me=be.exec(ne))!=null;)if(Pe=this.rules.inline.em.middle.exec(ne.slice(0,me.index+2)),Pe)return{type:"em",raw:te.slice(0,Pe[0].length),text:te.slice(1,Pe[0].length-1)}}},ve.codespan=function(te){var ne=this.rules.inline.code.exec(te);if(ne){var he=ne[2].replace(/\n/g," "),me=/[^ ]/.test(he),be=he.startsWith(" ")&&he.endsWith(" ");return me&&be&&(he=he.substring(1,he.length-1)),he=Y(he,!0),{type:"codespan",raw:ne[0],text:he}}},ve.br=function(te){var ne=this.rules.inline.br.exec(te);if(ne)return{type:"br",raw:ne[0]}},ve.del=function(te){var ne=this.rules.inline.del.exec(te);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ve.autolink=function(te,ne){var he=this.rules.inline.autolink.exec(te);if(he){var me,be;return he[2]==="@"?(me=Y(this.options.mangle?ne(he[1]):he[1]),be="mailto:"+me):(me=Y(he[1]),be=me),{type:"link",raw:he[0],text:me,href:be,tokens:[{type:"text",raw:me,text:me}]}}},ve.url=function(te,ne){var he;if(he=this.rules.inline.url.exec(te)){var me,be;if(he[2]==="@")me=Y(this.options.mangle?ne(he[0]):he[0]),be="mailto:"+me;else{var Pe;do Pe=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Pe!==he[0]);me=Y(he[0]),he[1]==="www."?be="http://"+me:be=me}return{type:"link",raw:he[0],text:me,href:be,tokens:[{type:"text",raw:me,text:me}]}}},ve.inlineText=function(te,ne,he){var me=this.rules.inline.text.exec(te);if(me){var be;return ne?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]:be=Y(this.options.smartypants?he(me[0]):me[0]),{type:"text",raw:me[0],text:be}}},Ce}(),xe=j.noopTest,_e=j.edit,Se=j.merge,ce={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:xe,table:xe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=_e(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=_e(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=_e(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=_e(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=_e(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=_e(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=Se({},ce),ce.gfm=Se({},ce.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*|$)"}),ce.gfm.nptable=_e(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=_e(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=Se({},ce.normal,{html:_e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._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:xe,paragraph:_e(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:xe,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:xe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=_e(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=_e(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=_e(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=_e(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=_e(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=_e(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=_e(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=_e(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=_e(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=_e(ue._blockSkip,"g").getRegex(),ue.overlapSkip=_e(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ue.autolink=_e(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=_e(ue.tag).replace("comment",ce._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=_e(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=_e(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=_e(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Se({},ue),ue.pedantic=Se({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:_e(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:_e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Se({},ue.normal,{escape:_e(ue.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=_e(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Se({},ue.gfm,{br:_e(ue.br).replace("{2,}","*").getRegex(),text:_e(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ie={block:ce,inline:ue},de=z.defaults,se=ie.block,Oe=ie.inline;function ke(Ce){return Ce.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Te(Ce){var ve="",Ee,te,ne=Ce.length;for(Ee=0;Ee<ne;Ee++)te=Ce.charCodeAt(Ee),Math.random()>.5&&(te="x"+te.toString(16)),ve+="&#"+te+";";return ve}var Ae=function(){function Ce(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||de,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:se.normal,inline:Oe.normal};this.options.pedantic?(te.block=se.pedantic,te.inline=Oe.pedantic):this.options.gfm&&(te.block=se.gfm,this.options.breaks?te.inline=Oe.breaks:te.inline=Oe.gfm),this.tokenizer.rules=te}Ce.lex=function(te,ne){var he=new Ce(ne);return he.lex(te)};var ve=Ce.prototype;return ve.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(te,ne,he){ne===void 0&&(ne=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var me,be,Pe,We;te;){if(me=this.tokenizer.space(te)){te=te.substring(me.raw.length),me.type&&ne.push(me);continue}if(me=this.tokenizer.code(te,ne)){te=te.substring(me.raw.length),me.type?ne.push(me):(We=ne[ne.length-1],We.raw+=`
`+me.raw,We.text+=`
`+me.text);continue}if(me=this.tokenizer.fences(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.heading(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.nptable(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.hr(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.blockquote(te)){te=te.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],he),ne.push(me);continue}if(me=this.tokenizer.list(te)){for(te=te.substring(me.raw.length),Pe=me.items.length,be=0;be<Pe;be++)me.items[be].tokens=this.blockTokens(me.items[be].text,[],!1);ne.push(me);continue}if(me=this.tokenizer.html(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(he&&(me=this.tokenizer.def(te))){te=te.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.lheading(te)){te=te.substring(me.raw.length),ne.push(me);continue}if(he&&(me=this.tokenizer.paragraph(te))){te=te.substring(me.raw.length),ne.push(me);continue}if(me=this.tokenizer.text(te,ne)){te=te.substring(me.raw.length),me.type?ne.push(me):(We=ne[ne.length-1],We.raw+=`
`+me.raw,We.text+=`
`+me.text);continue}if(te){var st="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return ne},ve.inline=function(te){var ne,he,me,be,Pe,We,st=te.length;for(ne=0;ne<st;ne++){We=te[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:[]},be=We.header.length,he=0;he<be;he++)We.tokens.header[he]=[],this.inlineTokens(We.header[he],We.tokens.header[he]);for(be=We.cells.length,he=0;he<be;he++)for(Pe=We.cells[he],We.tokens.cells[he]=[],me=0;me<Pe.length;me++)We.tokens.cells[he][me]=[],this.inlineTokens(Pe[me],We.tokens.cells[he][me]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(be=We.items.length,he=0;he<be;he++)this.inline(We.items[he].tokens);break}}}return te},ve.inlineTokens=function(te,ne,he,me,be){ne===void 0&&(ne=[]),he===void 0&&(he=!1),me===void 0&&(me=!1),be===void 0&&(be="");var Pe,We=te,st;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ft.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Pe=this.tokenizer.escape(te)){te=te.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.tag(te,he,me)){te=te.substring(Pe.raw.length),he=Pe.inLink,me=Pe.inRawBlock,ne.push(Pe);continue}if(Pe=this.tokenizer.link(te)){te=te.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,me)),ne.push(Pe);continue}if(Pe=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,me)),ne.push(Pe);continue}if(Pe=this.tokenizer.strong(te,We,be)){te=te.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,me),ne.push(Pe);continue}if(Pe=this.tokenizer.em(te,We,be)){te=te.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,me),ne.push(Pe);continue}if(Pe=this.tokenizer.codespan(te)){te=te.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.br(te)){te=te.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.del(te)){te=te.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],he,me),ne.push(Pe);continue}if(Pe=this.tokenizer.autolink(te,Te)){te=te.substring(Pe.raw.length),ne.push(Pe);continue}if(!he&&(Pe=this.tokenizer.url(te,Te))){te=te.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.inlineText(te,me,ke)){te=te.substring(Pe.raw.length),be=Pe.raw.slice(-1),ne.push(Pe);continue}if(te){var pt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return ne},J(Ce,null,[{key:"rules",get:function(){return{block:se,inline:Oe}}}]),Ce}(),Le=z.defaults,Be=j.cleanUrl,Fe=j.escape,De=function(){function Ce(Ee){this.options=Ee||Le}var ve=Ce.prototype;return ve.code=function(te,ne,he){var me=(ne||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(te,me);be!=null&&be!==te&&(he=!0,te=be)}return me?'<pre><code class="'+this.options.langPrefix+Fe(me,!0)+'">'+(he?te:Fe(te,!0))+`</code></pre>
`:"<pre><code>"+(he?te:Fe(te,!0))+`</code></pre>
`},ve.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},ve.html=function(te){return te},ve.heading=function(te,ne,he,me){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+me.slug(he)+'">'+te+"</h"+ne+`>
`:"<h"+ne+">"+te+"</h"+ne+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(te,ne,he){var me=ne?"ol":"ul",be=ne&&he!==1?' start="'+he+'"':"";return"<"+me+be+`>
`+te+"</"+me+`>
`},ve.listitem=function(te){return"<li>"+te+`</li>
`},ve.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(te){return"<p>"+te+`</p>
`},ve.table=function(te,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ne+`</table>
`},ve.tablerow=function(te){return`<tr>
`+te+`</tr>
`},ve.tablecell=function(te,ne){var he=ne.header?"th":"td",me=ne.align?"<"+he+' align="'+ne.align+'">':"<"+he+">";return me+te+"</"+he+`>
`},ve.strong=function(te){return"<strong>"+te+"</strong>"},ve.em=function(te){return"<em>"+te+"</em>"},ve.codespan=function(te){return"<code>"+te+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(te){return"<del>"+te+"</del>"},ve.link=function(te,ne,he){if(te=Be(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var me='<a href="'+Fe(te)+'"';return ne&&(me+=' title="'+ne+'"'),me+=">"+he+"</a>",me},ve.image=function(te,ne,he){if(te=Be(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var me='<img src="'+te+'" alt="'+he+'"';return ne&&(me+=' title="'+ne+'"'),me+=this.options.xhtml?"/>":">",me},ve.text=function(te){return te},Ce}(),Ne=function(){function Ce(){}var ve=Ce.prototype;return ve.strong=function(te){return te},ve.em=function(te){return te},ve.codespan=function(te){return te},ve.del=function(te){return te},ve.html=function(te){return te},ve.text=function(te){return te},ve.link=function(te,ne,he){return""+he},ve.image=function(te,ne,he){return""+he},ve.br=function(){return""},Ce}(),Xe=function(){function Ce(){this.seen={}}var ve=Ce.prototype;return ve.slug=function(te){var ne=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var he=ne;do this.seen[he]++,ne=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},Ce}(),Ze=z.defaults,Je=j.unescape,$e=function(){function Ce(Ee){this.options=Ee||Ze,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new Xe}Ce.parse=function(te,ne){var he=new Ce(ne);return he.parse(te)};var ve=Ce.prototype;return ve.parse=function(te,ne){ne===void 0&&(ne=!0);var he="",me,be,Pe,We,st,ft,pt,Ct,xt,ut,Ut,Mt,Jt,Yt,Rt,Ti,Ui,qe,wt=te.length;for(me=0;me<wt;me++){ut=te[me];switch(ut.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(ut.tokens),ut.depth,Je(this.parseInline(ut.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(ut.text,ut.lang,ut.escaped);continue}case"table":{for(Ct="",pt="",We=ut.header.length,be=0;be<We;be++)pt+=this.renderer.tablecell(this.parseInline(ut.tokens.header[be]),{header:!0,align:ut.align[be]});for(Ct+=this.renderer.tablerow(pt),xt="",We=ut.cells.length,be=0;be<We;be++){for(ft=ut.tokens.cells[be],pt="",st=ft.length,Pe=0;Pe<st;Pe++)pt+=this.renderer.tablecell(this.parseInline(ft[Pe]),{header:!1,align:ut.align[Pe]});xt+=this.renderer.tablerow(pt)}he+=this.renderer.table(Ct,xt);continue}case"blockquote":{xt=this.parse(ut.tokens),he+=this.renderer.blockquote(xt);continue}case"list":{for(Ut=ut.ordered,Mt=ut.start,Jt=ut.loose,We=ut.items.length,xt="",be=0;be<We;be++)Rt=ut.items[be],Ti=Rt.checked,Ui=Rt.task,Yt="",Rt.task&&(qe=this.renderer.checkbox(Ti),Jt?Rt.tokens.length>0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=qe+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=qe+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:qe}):Yt+=qe),Yt+=this.parse(Rt.tokens,Jt),xt+=this.renderer.listitem(Yt,Ui,Ti);he+=this.renderer.list(xt,Ut,Mt);continue}case"html":{he+=this.renderer.html(ut.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(ut.tokens));continue}case"text":{for(xt=ut.tokens?this.parseInline(ut.tokens):ut.text;me+1<wt&&te[me+1].type==="text";)ut=te[++me],xt+=`
`+(ut.tokens?this.parseInline(ut.tokens):ut.text);he+=ne?this.renderer.paragraph(xt):xt;continue}default:{var Ot='Token with "'+ut.type+'" type was not found.';if(this.options.silent){console.error(Ot);return}else throw new Error(Ot)}}}return he},ve.parseInline=function(te,ne){ne=ne||this.renderer;var he="",me,be,Pe=te.length;for(me=0;me<Pe;me++){be=te[me];switch(be.type){case"escape":{he+=ne.text(be.text);break}case"html":{he+=ne.html(be.text);break}case"link":{he+=ne.link(be.href,be.title,this.parseInline(be.tokens,ne));break}case"image":{he+=ne.image(be.href,be.title,be.text);break}case"strong":{he+=ne.strong(this.parseInline(be.tokens,ne));break}case"em":{he+=ne.em(this.parseInline(be.tokens,ne));break}case"codespan":{he+=ne.codespan(be.text);break}case"br":{he+=ne.br();break}case"del":{he+=ne.del(this.parseInline(be.tokens,ne));break}case"text":{he+=ne.text(be.text);break}default:{var We='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return he},Ce}(),lt=j.merge,tt=j.checkSanitizeDeprecation,it=j.escape,Ue=z.getDefaults,dt=z.changeDefaults,rt=z.defaults;function Me(Ce,ve,Ee){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof ve=="function"&&(Ee=ve,ve=null),ve=lt({},Me.defaults,ve||{}),tt(ve),Ee){var te=ve.highlight,ne;try{ne=Ae.lex(Ce,ve)}catch(Pe){return Ee(Pe)}var he=function(We){var st;if(!We)try{st=$e.parse(ne,ve)}catch(ft){We=ft}return ve.highlight=te,We?Ee(We):Ee(null,st)};if(!te||te.length<3)return he();if(delete ve.highlight,!ne.length)return he();var me=0;Me.walkTokens(ne,function(Pe){Pe.type==="code"&&(me++,setTimeout(function(){te(Pe.text,Pe.lang,function(We,st){if(We)return he(We);st!=null&&st!==Pe.text&&(Pe.text=st,Pe.escaped=!0),me--,me===0&&he()})},0))}),me===0&&he();return}try{var be=Ae.lex(Ce,ve);return ve.walkTokens&&Me.walkTokens(be,ve.walkTokens),$e.parse(be,ve)}catch(Pe){if(Pe.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+it(Pe.message+"",!0)+"</pre>";throw Pe}}Me.options=Me.setOptions=function(Ce){return lt(Me.defaults,Ce),dt(Me.defaults),Me},Me.getDefaults=Ue,Me.defaults=rt,Me.use=function(Ce){var ve=lt({},Ce);if(Ce.renderer&&function(){var te=Me.defaults.renderer||new De,ne=function(be){var Pe=te[be];te[be]=function(){for(var We=arguments.length,st=new Array(We),ft=0;ft<We;ft++)st[ft]=arguments[ft];var pt=Ce.renderer[be].apply(te,st);return pt===!1&&(pt=Pe.apply(te,st)),pt}};for(var he in Ce.renderer)ne(he);ve.renderer=te}(),Ce.tokenizer&&function(){var te=Me.defaults.tokenizer||new pe,ne=function(be){var Pe=te[be];te[be]=function(){for(var We=arguments.length,st=new Array(We),ft=0;ft<We;ft++)st[ft]=arguments[ft];var pt=Ce.tokenizer[be].apply(te,st);return pt===!1&&(pt=Pe.apply(te,st)),pt}};for(var he in Ce.tokenizer)ne(he);ve.tokenizer=te}(),Ce.walkTokens){var Ee=Me.defaults.walkTokens;ve.walkTokens=function(te){Ce.walkTokens(te),Ee&&Ee(te)}}Me.setOptions(ve)},Me.walkTokens=function(Ce,ve){for(var Ee=H(Ce),te;!(te=Ee()).done;){var ne=te.value;ve(ne);switch(ne.type){case"table":{for(var he=H(ne.tokens.header),me;!(me=he()).done;){var be=me.value;Me.walkTokens(be,ve)}for(var Pe=H(ne.tokens.cells),We;!(We=Pe()).done;)for(var st=We.value,ft=H(st),pt;!(pt=ft()).done;){var Ct=pt.value;Me.walkTokens(Ct,ve)}break}case"list":{Me.walkTokens(ne.items,ve);break}default:ne.tokens&&Me.walkTokens(ne.tokens,ve)}}},Me.Parser=$e,Me.parser=$e.parse,Me.Renderer=De,Me.TextRenderer=Ne,Me.Lexer=Ae,Me.lexer=Ae.lex,Me.Tokenizer=pe,Me.Slugger=Xe,Me.parse=Me;var ze=Me;return ze})},ELLl:function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=le.Pos;le.defineOption("autoCloseBrackets",!1,function(n,d,l){l&&l!=le.Init&&(n.removeKeyMap(H),n.state.closeBrackets=null),d&&(F(Q(d,"pairs")),n.state.closeBrackets=d,n.addKeyMap(H))});function Q(n,d){return d=="pairs"&&typeof n=="string"?n:typeof n=="object"&&n[d]!=null?n[d]:J[d]}var H={Backspace:M,Enter:O};function F(n){for(var d=0;d<n.length;d++){var l=n.charAt(d),a="'"+l+"'";H[a]||(H[a]=z(l))}}F(J.pairs+"`");function z(n){return function(d){return p(d,n)}}function W(n){var d=n.state.closeBrackets;if(!d||d.override)return d;var l=n.getModeAt(n.getCursor());return l.closeBrackets||d}function M(n){var d=W(n);if(!d||n.getOption("disableInput"))return le.Pass;for(var l=Q(d,"pairs"),a=n.listSelections(),u=0;u<a.length;u++){if(!a[u].empty())return le.Pass;var c=f(n,a[u].head);if(!c||l.indexOf(c)%2!=0)return le.Pass}for(var u=a.length-1;u>=0;u--){var L=a[u].head;n.replaceRange("",P(L.line,L.ch-1),P(L.line,L.ch+1),"+delete")}}function O(n){var d=W(n),l=d&&Q(d,"explode");if(!l||n.getOption("disableInput"))return le.Pass;for(var a=n.listSelections(),u=0;u<a.length;u++){if(!a[u].empty())return le.Pass;var c=f(n,a[u].head);if(!c||l.indexOf(c)%2!=0)return le.Pass}n.operation(function(){var L=n.lineSeparator()||`
`;n.replaceSelection(L+L,null),n.execCommand("goCharLeft"),a=n.listSelections();for(var S=0;S<a.length;S++){var T=a[S].head.line;n.indentLine(T,null,!0),n.indentLine(T+1,null,!0)}})}function g(n){var d=le.cmpPos(n.anchor,n.head)>0;return{anchor:new P(n.anchor.line,n.anchor.ch+(d?-1:1)),head:new P(n.head.line,n.head.ch+(d?1:-1))}}function p(n,d){var l=W(n);if(!l||n.getOption("disableInput"))return le.Pass;var a=Q(l,"pairs"),u=a.indexOf(d);if(u==-1)return le.Pass;for(var c=Q(l,"closeBefore"),L=Q(l,"triples"),S=a.charAt(u+1)==d,T=n.listSelections(),R=u%2==0,C,w=0;w<T.length;w++){var x=T[w],_=x.head,o,b=n.getRange(_,P(_.line,_.ch+1));if(R&&!x.empty())o="surround";else if((S||!R)&&b==d)S&&h(n,_)?o="both":L.indexOf(d)>=0&&n.getRange(_,P(_.line,_.ch+3))==d+d+d?o="skipThree":o="skip";else if(S&&_.ch>1&&L.indexOf(d)>=0&&n.getRange(P(_.line,_.ch-2),_)==d+d){if(_.ch>2&&/\bstring/.test(n.getTokenTypeAt(P(_.line,_.ch-2))))return le.Pass;o="addFour"}else if(S){var m=_.ch==0?" ":n.getRange(P(_.line,_.ch-1),_);if(!le.isWordChar(b)&&m!=d&&!le.isWordChar(m))o="both";else return le.Pass}else if(R&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))o="both";else return le.Pass;if(!C)C=o;else if(C!=o)return le.Pass}var E=u%2?a.charAt(u-1):d,N=u%2?d:a.charAt(u+1);n.operation(function(){if(C=="skip")n.execCommand("goCharRight");else if(C=="skipThree")for(var D=0;D<3;D++)n.execCommand("goCharRight");else if(C=="surround"){for(var B=n.getSelections(),D=0;D<B.length;D++)B[D]=E+B[D]+N;n.replaceSelections(B,"around"),B=n.listSelections().slice();for(var D=0;D<B.length;D++)B[D]=g(B[D]);n.setSelections(B)}else C=="both"?(n.replaceSelection(E+N,null),n.triggerElectric(E+N),n.execCommand("goCharLeft")):C=="addFour"&&(n.replaceSelection(E+E+E+E,"before"),n.execCommand("goCharRight"))})}function f(n,d){var l=n.getRange(P(d.line,d.ch-1),P(d.line,d.ch+1));return l.length==2?l:null}function h(n,d){var l=n.getTokenAt(P(d.line,d.ch+1));return/\bstring/.test(l.type)&&l.start==d.ch&&(d.ch==0||!/\bstring/.test(n.getTokenTypeAt(d)))}})},GfqC:function(ct,Ye,ae){"use strict";var le=ae("q1tI"),J=ae.n(le),P=ae("TSYQ"),Q=ae.n(P);function H(j,I){var v="cannot "+j.method+" "+j.action+" "+I.status+"'",G=new Error(v);return G.status=I.status,G.method=j.method,G.url=j.action,G}function F(j){var I=j.responseText||j.response;if(!I)return I;try{return JSON.parse(I)}catch(v){return I}}function z(j){var I=new XMLHttpRequest;j.onProgress&&I.upload&&(I.upload.onprogress=function(re){re.total>0&&(re.percent=re.loaded/re.total*100),j.onProgress(re)});var v=new FormData;j.data&&Object.keys(j.data).forEach(function(Y){var re=j.data[Y];if(Array.isArray(re)){re.forEach(function(oe){v.append(Y+"[]",oe)});return}v.append(Y,j.data[Y])}),j.file instanceof Blob?v.append(j.filename,j.file,j.file.name):v.append(j.filename,j.file),I.onerror=function(re){j.onError(re)},I.onload=function(){return I.status<200||I.status>=300?j.onError(H(j,I),F(I)):j.onSuccess(F(I),I)},I.open(j.method,j.action,!0),j.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var G=j.headers||{};return G["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(Y){G[Y]!==null&&I.setRequestHeader(Y,G[Y])}),I.send(v),{abort:function(){I.abort()}}}var W=+new Date,M=0;function O(){return"rc-upload-"+W+"-"+ ++M}function g(j,I){return j.indexOf(I,j.length-I.length)!==-1}var p=function(j,I){if(j&&I){var v=Array.isArray(I)?I:I.split(","),G=j.name||"",Y=j.type||"",re=Y.replace(/\/.*$/,"");return v.some(function(oe){var we=oe.trim();return we.charAt(0)==="."?g(G.toLowerCase(),we.toLowerCase()):/\/\*$/.test(we)?re===we.replace(/\/.*$/,""):Y===we})}return!0};function f(j,I){var v=j.createReader(),G=[];function Y(){v.readEntries(function(re){var oe=Array.prototype.slice.apply(re);G=G.concat(oe);var we=!oe.length;we?I(G):Y()})}Y()}var h=function(I,v,G){var Y=function re(oe,we){we=we||"",oe.isFile?oe.file(function(pe){G(pe)&&(oe.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),v([pe]))}):oe.isDirectory&&f(oe,function(pe){pe.forEach(function(xe){re(xe,""+we+oe.name+"/")})})};I.forEach(function(re){Y(re.webkitGetAsEntry())})},n=h,d=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var v=arguments[I];for(var G in v)Object.prototype.hasOwnProperty.call(v,G)&&(j[G]=v[G])}return j},l=function(){function j(I,v){var G=[],Y=!0,re=!1,oe=void 0;try{for(var we=I[Symbol.iterator](),pe;!(Y=(pe=we.next()).done)&&!(G.push(pe.value),v&&G.length===v);Y=!0);}catch(xe){re=!0,oe=xe}finally{try{!Y&&we.return&&we.return()}finally{if(re)throw oe}}return G}return function(I,v){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return j(I,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function j(I,v){for(var G=0;G<v.length;G++){var Y=v[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,v,G){return v&&j(I.prototype,v),G&&j(I,G),I}}();function u(j,I,v){return I in j?Object.defineProperty(j,I,{value:v,enumerable:!0,configurable:!0,writable:!0}):j[I]=v,j}function c(j,I){var v={};for(var G in j){if(I.indexOf(G)>=0)continue;if(!Object.prototype.hasOwnProperty.call(j,G))continue;v[G]=j[G]}return v}function L(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function S(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function T(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}var R=function(I){return Object.keys(I).reduce(function(v,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(v[G]=I[G]),v},{})},C=function(j){T(I,j);function I(){var v,G,Y,re;L(this,I);for(var oe=arguments.length,we=Array(oe),pe=0;pe<oe;pe++)we[pe]=arguments[pe];return re=(G=(Y=S(this,(v=I.__proto__||Object.getPrototypeOf(I)).call.apply(v,[this].concat(we))),Y),Y.state={uid:O()},Y.reqs={},Y.onChange=function(xe){var _e=xe.target.files;Y.uploadFiles(_e),Y.reset()},Y.onClick=function(xe){var _e=Y.fileInput;if(!_e)return;var Se=Y.props,ce=Se.children,ue=Se.onClick;ce&&ce.type==="button"&&(_e.parentNode.focus(),_e.parentNode.querySelector("button").blur()),_e.click(),ue&&ue(xe)},Y.onKeyDown=function(xe){xe.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(xe){var _e=Y.props.multiple;if(xe.preventDefault(),xe.type==="dragover")return;if(Y.props.directory)n(Array.prototype.slice.call(xe.dataTransfer.items),Y.uploadFiles,function(ce){return p(ce,Y.props.accept)});else{var Se=Array.prototype.slice.call(xe.dataTransfer.files).filter(function(ce){return p(ce,Y.props.accept)});_e===!1&&(Se=Se.slice(0,1)),Y.uploadFiles(Se)}},Y.uploadFiles=function(xe){var _e=Array.prototype.slice.call(xe);_e.map(function(Se){return Se.uid=O(),Se}).forEach(function(Se){Y.upload(Se,_e)})},Y.saveFileInput=function(xe){Y.fileInput=xe},G),S(Y,re)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(G,Y){var re=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return re.post(G)},0);var we=oe.beforeUpload(G,Y);we&&we.then?we.then(function(pe){var xe=Object.prototype.toString.call(pe);return xe==="[object File]"||xe==="[object Blob]"?re.post(pe):re.post(G)}).catch(function(pe){console.log(pe)}):we!==!1&&setTimeout(function(){return re.post(G)},0);return}},{key:"post",value:function(G){var Y=this;if(!this._isMounted)return;var re=this.props,oe=re.onStart,we=re.onProgress,pe=re.transformFile,xe=pe===void 0?function(_e){return _e}:pe;new Promise(function(_e){var Se=re.action;return typeof Se=="function"&&(Se=Se(G)),_e(Se)}).then(function(_e){var Se=G.uid,ce=re.customRequest||z,ue=Promise.resolve(xe(G)).then(function(ie){var de=re.data;return typeof de=="function"&&(de=de(ie)),Promise.all([ie,de])}).catch(function(ie){console.error(ie)});ue.then(function(ie){var de=l(ie,2),se=de[0],Oe=de[1],ke={action:_e,filename:re.name,data:Oe,file:se,headers:re.headers,withCredentials:re.withCredentials,method:re.method||"post",onProgress:we?function(Te){we(Te,G)}:null,onSuccess:function(Ae,Le){delete Y.reqs[Se],re.onSuccess(Ae,G,Le)},onError:function(Ae,Le){delete Y.reqs[Se],re.onError(Ae,Le,G)}};oe(G),Y.reqs[Se]=ce(ke)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function(G){var Y=this.reqs;if(G){var re=G;G&&G.uid&&(re=G.uid),Y[re]&&Y[re].abort&&Y[re].abort(),delete Y[re]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var G,Y=this.props,re=Y.component,oe=Y.prefixCls,we=Y.className,pe=Y.disabled,xe=Y.id,_e=Y.style,Se=Y.multiple,ce=Y.accept,ue=Y.children,ie=Y.directory,de=Y.openFileDialogOnClick,se=Y.onMouseEnter,Oe=Y.onMouseLeave,ke=c(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Te=Q()((G={},u(G,oe,!0),u(G,oe+"-disabled",pe),u(G,we,we),G)),Ae=pe?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:Oe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(re,d({},Ae,{className:Te,role:"button",style:_e}),J.a.createElement("input",d({},R(ke),{id:xe,type:"file",ref:this.saveFileInput,onClick:function(Be){return Be.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ce,directory:ie?"directory":null,webkitdirectory:ie?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),ue)}}]),I}(le.Component),w=C,x=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var v=arguments[I];for(var G in v)Object.prototype.hasOwnProperty.call(v,G)&&(j[G]=v[G])}return j},_=function(){function j(I,v){for(var G=0;G<v.length;G++){var Y=v[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,v,G){return v&&j(I.prototype,v),G&&j(I,G),I}}();function o(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function b(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function m(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}function E(){}var N=function(j){m(I,j);function I(){var v,G,Y,re;o(this,I);for(var oe=arguments.length,we=Array(oe),pe=0;pe<oe;pe++)we[pe]=arguments[pe];return re=(G=(Y=b(this,(v=I.__proto__||Object.getPrototypeOf(I)).call.apply(v,[this].concat(we))),Y),Y.saveUploader=function(xe){Y.uploader=xe},G),b(Y,re)}return _(I,[{key:"abort",value:function(G){this.uploader.abort(G)}},{key:"render",value:function(){return J.a.createElement(w,x({},this.props,{ref:this.saveUploader}))}}]),I}(le.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 D=N,B=Ye.a=D},HmJG:function(ct,Ye,ae){},LdHM:function(ct,Ye,ae){"use strict";ae.d(Ye,"b",function(){return c}),ae.d(Ye,"a",function(){return S});var le=ae("1OyB"),J=ae("vuIU"),P=ae("Ji7U"),Q=ae("LK+K"),H=ae("q1tI"),F=ae("rePB"),z=ae("Ff2n"),W=ae("ODXe"),M=ae("4IlW"),O=ae("bX4T"),g=ae("YrtM"),p=ae("TSYQ"),f=ae.n(p),h=ae("+nKL"),n=ae("8OUc"),d=function(G,Y){var re=G.prefixCls,oe=G.id,we=G.flattenOptions,pe=G.childrenAsData,xe=G.values,_e=G.searchValue,Se=G.multiple,ce=G.defaultActiveFirstOption,ue=G.height,ie=G.itemHeight,de=G.notFoundContent,se=G.open,Oe=G.menuItemSelectedIcon,ke=G.virtual,Te=G.onSelect,Ae=G.onToggleOpen,Le=G.onActiveValue,Be=G.onScroll,Fe=G.onMouseEnter,De="".concat(re,"-item"),Ne=Object(g.a)(function(){return we},[se,we],function(ze,Ce){return Ce[0]&&ze[1]!==Ce[1]}),Xe=H.useRef(null),Ze=function(Ce){Ce.preventDefault()},Je=function(Ce){Xe.current&&Xe.current.scrollTo({index:Ce})},$e=function(Ce){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ee=Ne.length,te=0;te<Ee;te+=1){var ne=(Ce+te*ve+Ee)%Ee,he=Ne[ne],me=he.group,be=he.data;if(!me&&!be.disabled)return ne}return-1},lt=H.useState(function(){return $e(0)}),tt=Object(W.a)(lt,2),it=tt[0],Ue=tt[1],dt=function(Ce){Ue(Ce);var ve=Ne[Ce];if(!ve){Le(null,-1);return}Le(ve.data.value,Ce)};H.useEffect(function(){dt(ce!==!1?$e(0):-1)},[Ne.length,_e]),H.useEffect(function(){var ze=setTimeout(function(){if(!Se&&se&&xe.size===1){var Ce=Array.from(xe)[0],ve=Ne.findIndex(function(Ee){var te=Ee.data;return te.value===Ce});dt(ve),Je(ve)}});return function(){return clearTimeout(ze)}},[se]);var rt=function(Ce){Ce!==void 0&&Te(Ce,{selected:!xe.has(Ce)}),Se||Ae(!1)};if(H.useImperativeHandle(Y,function(){return{onKeyDown:function(Ce){var ve=Ce.which;switch(ve){case M.a.UP:case M.a.DOWN:{var Ee=0;if(ve===M.a.UP?Ee=-1:ve===M.a.DOWN&&(Ee=1),Ee!==0){var te=$e(it+Ee,Ee);Je(te),dt(te)}break}case M.a.ENTER:{var ne=Ne[it];ne&&!ne.data.disabled?rt(ne.data.value):rt(void 0),se&&Ce.preventDefault();break}case M.a.ESC:Ae(!1)}},onKeyUp:function(){},scrollTo:function(Ce){Je(Ce)}}}),Ne.length===0)return H.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ze},de);function Me(ze){var Ce=Ne[ze];if(!Ce)return null;var ve=Ce.data||{},Ee=ve.value,te=ve.label,ne=ve.children,he=Object(O.a)(ve,!0),me=pe?ne:te;return Ce?H.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},he,{key:ze,role:"option",id:"".concat(oe,"_list_").concat(ze),"aria-selected":xe.has(Ee)}),Ee):null}return H.createElement(H.Fragment,null,H.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Me(it-1),Me(it),Me(it+1)),H.createElement(h.a,{itemKey:"key",ref:Xe,data:Ne,height:ue,itemHeight:ie,fullHeight:!1,onMouseDown:Ze,onScroll:Be,virtual:ke,onMouseEnter:Fe},function(ze,Ce){var ve,Ee=ze.group,te=ze.groupOption,ne=ze.data,he=ne.label,me=ne.key;if(Ee)return H.createElement("div",{className:f()(De,"".concat(De,"-group"))},he!==void 0?he:me);var be=ne.disabled,Pe=ne.value,We=ne.title,st=ne.children,ft=ne.style,pt=ne.className,Ct=Object(z.a)(ne,["disabled","value","title","children","style","className"]),xt=xe.has(Pe),ut="".concat(De,"-option"),Ut=f()(De,ut,pt,(ve={},Object(F.a)(ve,"".concat(ut,"-grouped"),te),Object(F.a)(ve,"".concat(ut,"-active"),it===Ce&&!be),Object(F.a)(ve,"".concat(ut,"-disabled"),be),Object(F.a)(ve,"".concat(ut,"-selected"),xt),ve)),Mt=pe?st:he,Jt=!Oe||typeof Oe=="function"||xt;return H.createElement("div",Object.assign({},Ct,{"aria-selected":xt,className:Ut,title:We,onMouseMove:function(){if(it===Ce||be)return;dt(Ce)},onClick:function(){be||rt(Pe)},style:ft}),H.createElement("div",{className:"".concat(ut,"-content")},Mt||Pe),H.isValidElement(Oe)||xt,Jt&&H.createElement(n.a,{className:"".concat(De,"-option-state"),customizeIcon:Oe,customizeIconProps:{isSelected:xt}},xt?"\u2713":null))}))},l=H.forwardRef(d);l.displayName="OptionList";var a=l,u=function(){return null};u.isSelectOption=!0;var c=u,L=function(){return null};L.isSelectOptGroup=!0;var S=L,T=ae("VTBJ"),R=ae("Zm9Q");function C(v){var G=v.key,Y=v.props,re=Y.children,oe=Y.value,we=Object(z.a)(Y,["children","value"]);return Object(T.a)({key:G,value:oe!==void 0?oe:G,children:re},we)}function w(v){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(v).map(function(Y,re){if(!H.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,we=Y.key,pe=Y.props,xe=pe.children,_e=Object(z.a)(pe,["children"]);return G||!oe?C(Y):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(we===null?re:we,"__"),label:we},_e),{},{options:w(xe)})}).filter(function(Y){return Y})}var x=ae("2Qr1"),_=ae("qNPg"),o=ae("U8pU"),b=ae("Kwbf"),m=ae("WKfj");function E(v){var G=v.mode,Y=v.options,re=v.children,oe=v.backfill,we=v.allowClear,pe=v.placeholder,xe=v.getInputElement,_e=v.showSearch,Se=v.onSearch,ce=v.defaultOpen,ue=v.autoFocus,ie=v.labelInValue,de=v.value,se=v.inputValue,Oe=v.optionLabelProp,ke=G==="multiple"||G==="tags",Te=_e!==void 0?_e:ke||G==="combobox",Ae=Y||w(re);if(Object(b.a)(G!=="tags"||Ae.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var Le=Ae.some(function(De){return De.options?De.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(b.a)(!Le,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(G!=="combobox"||!Oe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(G==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(b.a)(G==="combobox"||!xe,"`getInputElement` only work with `combobox` mode."),Object(b.b)(G!=="combobox"||!xe||!we||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!Te&&G!=="combobox"&&G!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ce||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var Be=Object(m.d)(de);Object(b.a)(!ie||Be.every(function(De){return Object(o.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!ke||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var Fe=null;Object(R.a)(re).some(function(De){if(!H.isValidElement(De)||!De.type)return!1;var Ne=De.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var Xe=Object(R.a)(De.props.children).every(function(Ze){return!H.isValidElement(Ze)||!De.type||Ze.type.isSelectOption?!0:(Fe=Ze.type,!1)});return!Xe}return Fe=Ne,!0}),Fe&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(b.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,D=Object(_.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:w,flattenOptions:x.d,getLabeledValue:x.e,filterOptions:x.b,isValueDisabled:x.g,findValueOption:x.c,warningProps:N,fillOptionsWithMissingValue:x.a}),B=function(v){Object(P.a)(Y,v);var G=Object(Q.a)(Y);function Y(){var re;return Object(le.a)(this,Y),re=G.apply(this,arguments),re.selectRef=H.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(J.a)(Y,[{key:"render",value:function(){return H.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(H.Component);B.Option=c,B.OptGroup=S;var j=B,I=Ye.c=j},M8RZ:function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return M});var le=ae("fWQN"),J=ae("mtLc"),P=ae("yKVA"),Q=ae("879j"),H=ae("q1tI"),F=ae.n(H),z=ae("i8i4"),W=ae.n(z),M=function(O){Object(P.a)(p,O);var g=Object(Q.a)(p);function p(f){var h;Object(le.a)(this,p),h=g.call(this,f);var n=window.document;return h.node=n.createElement("div"),n.body.appendChild(h.node),h}return Object(J.a)(p,[{key:"render",value:function(){var h=this.props.children;return Object(z.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(F.a.Component)},Ot1p:function(ct,Ye,ae){"use strict";var le=ae("2qtc"),J=ae("kLXV"),P=ae("rAM+"),Q=ae("miYZ"),H=ae("tsqr"),F=ae("9og8"),z=ae("tJVT"),W=ae("jrin"),M=ae("WmNS"),O=ae.n(M),g=ae("q1tI"),p=ae.n(g),f=ae("VrN/"),h=ae.n(f),n=ae("bdgK"),d=ae("p77/"),l=ae("Bd2K"),a=ae("ELLl"),u=ae("19Vz"),c=ae("lZu9"),L=ae("+NIl"),S=ae("kSUc"),T=ae("9Bee"),R=function(be){var Pe=be.value,We=Pe===void 0?"":Pe,st=be.className,ft=be.showTextOnly,pt=be.showLines,Ct=be.style,xt=Ct===void 0?{}:Ct,ut=Object(g.useMemo)(function(){return""},[We]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:ut}}))},C=ae("0Owb"),w=ae("dejd"),x=ae("C+DQ"),_=ae("1vsH"),o=ae("m3rI"),b=[{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 m(be){var Pe=be.onActionCallback,We=be.title,st=be.icon,ft=be.actionName,pt=be.className,Ct=pt===void 0?"":pt,xt=be.children;function ut(){Pe(ft)}return p.a.createElement("a",{title:We,className:Ct,onClick:ut},p.a.createElement("i",{className:"md-iconfont ".concat(st)}),xt)}var E=function(be){var Pe=be.watch,We=be.showNullButton,st=be.onActionCallback,ft=be.fullScreen,pt=be.insertTemp,Ct=be.hidetoolBar,xt=be.uuid,ut=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.F)("_educoder_session"),"&key=").concat(xt,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var Ut=[].concat(b,[{title:"".concat(Pe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Pe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ut.map(function(Mt,Jt){return p.a.createElement("li",{key:Jt},Mt.actionName?p.a.createElement(m,Object(C.a)({},Mt,{onActionCallback:st})):p.a.createElement("span",{className:"v-line"}))}),We?p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,pt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(pt),onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(m,{icon:"".concat(ft?"icon-shrink":"icon-enlarge"),title:ft?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:st})))},N=ae("M8RZ"),D=ae("+L6B"),B=ae("2/Rp"),j=ae("y8nQ"),I=ae("Vl3Y"),v=ae("5NDa"),G=ae("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},re=function(be){var Pe=be.callback,We=be.onCancel;function st(ft){Pe(ft)}return p.a.createElement(I.a,Object(C.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:st}),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(G.a,null)),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(G.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},oe=ae("7ahc"),we=ae("HmJG"),pe=ae("BjJ7"),xe=I.a.useForm,_e={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},ce=function(be){var Pe=be.callback,We=be.onCancel,st=xe(),ft=Object(z.a)(st,1),pt=ft[0];function Ct(Ut){Pe(Ut)}function xt(Ut,Mt){if(Ut.status===-1){H.b.error(Ut.message);return}pt.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:Mt.type})}function ut(Ut){var Mt=Ut.target.files[0];ie(Mt,xt)}return p.a.createElement(I.a,Object(C.a)({form:pt},Se,{className:"upload-image-panel",onFinish:Ct}),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(G.a,{style:_e})),p.a.createElement(ue,{onFileChange:ut}))),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(G.a,{style:{width:264}})),p.a.createElement(I.a.Item,{style:{textAlign:"right"}},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))};function ue(be){var Pe=be.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Pe}))}function ie(be,Pe){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var We=new FormData;We.append("editormd-image-file",be),We.append("file_param_name","editormd-image-file"),We.append("byxhr","true");var st=new window.XMLHttpRequest;st.withCredentials=!0,st.addEventListener("load",function(ft){Pe(JSON.parse(ft.target.responseText),be)},!1),st.addEventListener("error",function(ft){console.error(ft)},!1),st.open("POST","".concat(pe.a,"/api/attachments.json")),st.send(We)}var de=ae("giR+"),se=ae("fyUT"),Oe=ae("7Kak"),ke=ae("9yH6"),Te=ke.a.Group,Ae={margin:"0 8px"},Le=function(be){var Pe=be.callback,We=be.onCancel;function st(ft){Pe(ft)}return p.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:st},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Ae},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Ae},"\u884C\u6570"),p.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(se.a,null)),p.a.createElement("span",{style:Ae},"\u5217\u6570"),p.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(se.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Ae},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(I.a.Item,{name:"align"},p.a.createElement(Te,null,p.a.createElement(ke.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ke.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ke.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ke.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},Be=ae("ErOA"),Fe=ae("7Cbv"),De="link",Ne="upload-image",Xe="code-block",Ze="add-table",Je="------------",$e={default:Je,left:":".concat(Je),center:":".concat(Je,":"),right:"".concat(Je,":")},lt=ae("9VGf"),tt,it;function Ue(){}var dt=0,rt=1e4,Me="\u2581",ze=`
**\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 Ce(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ee=ve?"Cmd":"Ctrl",te=["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"],ne=(tt={},Object(W.a)(tt,Ee+"-B","bold"),Object(W.a)(tt,Ee+"-I","italic"),tt),he=(it={},Object(W.a)(it,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(it,Xe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(it,Ne,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(it,Ze,"\u6DFB\u52A0\u8868\u683C"),it),me=Ye.a=function(be){var Pe=be.defaultValue,We=Pe===void 0?"":Pe,st=be.onChange,ft=be.width,pt=ft===void 0?"100%":ft,Ct=be.height,xt=Ct===void 0?400:Ct,ut=be.miniToolbar,Ut=ut===void 0?!1:ut,Mt=be.isFocus,Jt=Mt===void 0?!1:Mt,Yt=be.watch,Rt=be.insertTemp,Ti=be.mode,Ui=Ti===void 0?"markdown":Ti,qe=be.id,wt=qe===void 0?"markdown-editor-id":qe,Ot=be.showResizeBar,Lt=Ot===void 0?!1:Ot,qt=be.noStorage,qi=qt===void 0?!1:qt,er=be.showNullButton,Bt=er===void 0?!1:er,mt=be.hidetoolBar,Gi=mt===void 0?!1:mt,tr=be.fullScreen,vi=tr===void 0?!1:tr,kt=be.onBlur,Bi=be.onCMBeforeChange,Vi=be.onFullScreen,fr=be.className,Ve=fr===void 0?"":fr,Tt=be.disablePaste,pr=Tt===void 0?!1:Tt,mr=be.placeholder,gr=mr===void 0?"":mr,vr=be.values,X=vr===void 0?"":vr,y=Object(g.useState)(null),A=Object(z.a)(y,2),U=A[0],q=A[1],V=Object(g.useState)(We),ye=Object(z.a)(V,2),He=ye[0],et=ye[1],gt=Object(g.useState)(Yt),Ge=Object(z.a)(gt,2),_t=Ge[0],jt=Ge[1],$t=Object(g.useState)(vi),Pi=Object(z.a)($t,2),yi=Pi[0],_i=Pi[1],Xi=Object(g.useState)(""),Ir=Object(z.a)(Xi,2),li=Ir[0],ji=Ir[1],or=Object(g.useState)(0),lr=Object(z.a)(or,2),Mi=lr[0],kr=lr[1],yr=Object(g.useState)(xt),zr=Object(z.a)(yr,2),Kr=zr[0],Yi=zr[1],zi=Object(g.useState)(!1),_r=Object(z.a)(zi,2),dn=_r[0],br=_r[1],ti=Object(g.useRef)(Object(Fe.a)()),Ht=Object(g.useRef)(!1),pi=Object(g.useRef)(),Dt=Object(g.useRef)(),ri=Object(g.useRef)(),zt=Object(g.useRef)(),ir=Object(g.useRef)(),ui=function(){var vt=Object(F.a)(O.a.mark(function St(){var bt,It;return O.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(Be.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:It=Vt.sent,It!=null&&(bt=It.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",U,Dt),It.attachments.map(function(Nt){Nt.content_type.indexOf("image")>-1?U.replaceSelection("![,](/api/attachments/".concat(Nt.id,"?type=").concat(Nt.content_type,")")):Nt.content_type.indexOf("video")>-1?U.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Nt.content_type.indexOf("pdf")>-1?U.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):U.replaceSelection("[".concat(Nt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}));case 4:case"end":return Vt.stop()}},St)}));return function(){return vt.apply(this,arguments)}}();Object(g.useEffect)(function(){et(X),U==null||U.setValue(X)},[X]),Object(g.useEffect)(function(){Vi==null||Vi(yi)},[yi]),Object(g.useEffect)(function(){if(Dt.current){var vt=h.a.fromTextArea(Dt.current,{mode:Ui,lineNumbers:!Ut,lineWrapping:!0,value:We,autoCloseTags:!0,autoCloseBrackets:!0});Jt&&vt.focus();function St(bt,It){if(pr){It.preventDefault();return}var Ft=It.clipboardData;if(Ft){var Vt=Ft.types.toString(),Nt=Ft.items;if(Vt==="Files"||Ft.types.indexOf("Files")>-1){if(It.preventDefault(),Ui=="stex")return;try{var si,Ai=Nt[1];((si=Nt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ai=Nt[0]);var Pt=Ai.getAsFile(),ur=Pt.name.split(".").pop();ie(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):te.includes(ur)?vt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):vt.replaceSelection("[".concat(Pt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){H.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return vt.on("paste",St),vt.on("dragleave",function(bt,It){ri.current.classList.remove("mouse-hover-md")}),vt.on("dragover",function(bt,It){ri.current.classList.add("mouse-hover-md")}),vt.on("drop",function(bt,It){ri.current.classList.add("mouse-hover-md");var Ft;if(Ft=It.dataTransfer.files,Ft.length>0){It.preventDefault(),It.stopPropagation();for(var Vt=function(Ai){var Pt=Ft[Ai],ur=Pt.name.split(".").pop();ie(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):te.includes(ur)?vt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):vt.replaceSelection("[".concat(Pt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},Nt=0;Nt<Ft.length;Nt++)Vt(Nt)}}),q(vt),function(){vt.off("paste",St)}}},[]);var wi=Object(g.useCallback)(function(){if(ri.current)try{}catch(vt){console.log(vt,"---- to set md editor body height")}},[Kr,ri,yi]);Object(g.useEffect)(function(){function vt(){var bt=new n.default(function(It){var Ft=Object(P.a)(It),Vt;try{for(Ft.s();!(Vt=Ft.n()).done;){var Nt=Vt.value;(Nt.target.offsetHeight>0||Nt.target.offsetWidth>0)&&(wi(),U.setSize("100%","100%"),U.refresh())}}catch(si){Ft.e(si)}finally{Ft.f()}});return bt.observe(Dt.current.parentElement),bt}if(U){var St=vt();return function(){St.unobserve(Dt.current.parentElement)}}},[U,wi]),Object(g.useEffect)(function(){if(U){for(var vt=[],St=function(){var Nt=It[bt];Ft=Object(z.a)(Nt,2);var si=Ft[0],Ai=Ft[1],Pt=Object(W.a)({},si,function(){Vr(Ai)});vt.push(Pt),U.addKeyMap(Pt)},bt=0,It=Object.entries(ne);bt<It.length;bt++){var Ft;St()}return pi.current=setInterval(function(){Ht.current&&ui()},4e3),function(){clearInterval(pi.current);var Vt=Object(P.a)(vt),Nt;try{for(Vt.s();!(Nt=Vt.n()).done;){var si=Nt.value;U.removeKeyMap(si)}}catch(Ai){Vt.e(Ai)}finally{Vt.f()}}}},[U]),Object(g.useEffect)(function(){vi!==yi&&_i(vi)},[vi]),Object(lt.a)(function(){if(!qi&&Mi>0){var vt=new Date().getTime(),St=window.sessionStorage.getItem(wt);vt>=Mi+rt&&(!St||St!==He)&&(window.sessionStorage.setItem(wt,He),br(!0))}},rt),Object(g.useEffect)(function(){jt(Yt)},[U,Yt]),Object(g.useEffect)(function(){U&&(Jt&&U.focus())},[U,Jt]),Object(g.useEffect)(function(){if(_t&&U){var vt=U.getScrollerElement();function St(bt){var It=bt.target;if(ir.current){var Ft=It.scrollTop/It.scrollHeight;ir.current.scrollTop=ir.current.scrollHeight*Ft}}return vt.addEventListener("scroll",St),function(){vt.removeEventListener("scroll",St)}}},[U,_t]),Object(g.useEffect)(function(){if(U&&Bi){function vt(St,bt){Bi(St,bt)}return U.on("beforeChange",vt),function(){U.off("beforeChange",vt)}}},[U,Bi]),Object(g.useEffect)(function(){if(U&&kt){function vt(){kt(U.getValue())}return U.on("blur",vt),function(){U.off("blur",vt)}}},[U,kt]),Object(g.useEffect)(function(){if(U){function vt(St){var bt=St.getValue();et(bt),kr(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),st&&st(bt)}return U.on("change",vt),function(){U.off("change",vt)}}},[U,st]),Object(g.useEffect)(function(){U&&(We==null?(U.setValue(""),et("")):We!==U.getValue()&&(U.setValue(We),et(We),U.setCursor(U.lineCount(),0)))},[U,We]);var Vr=Object(g.useCallback)(function(vt){var St=U.getCursor(),bt=U.getSelection(),It=bt.split(`
`);switch(vt){case"bold":return U.replaceSelection("**"+bt+"**"),bt===""&&U.setCursor(St.line,St.ch+2),U.focus();case"italic":return U.replaceSelection("*"+bt+"*"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"code":return U.replaceSelection("`"+bt+"`"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+bt+"$$`"),bt===""&&U.setCursor(St.line,St.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+bt+"\n```"),U.setCursor(St.line+1,bt.length+1),U.focus();case"line-break":return U.replaceSelection(`<br/>
`),U.focus();case"list-ul":return bt===""?U.replaceSelection("- "+bt):U.replaceSelection(It.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(`
`)),U.focus();case"list-ol":return bt===""?U.replaceSelection("1. "+bt):U.replaceSelection(It.map(function(Ft,Vt){return Ft===""?"":"".concat(Vt+1,". ").concat(Ft)}).join(`
`)),U.focus();case"add-null-ch":return bt===""&&U.setCursor(St.line,St.ch+1),U.replaceSelection(Me),U.focus();case"inster-template-1":return bt===""&&U.setCursor(St.line,St.ch),U.replaceSelection(ze),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return jt(!_t),U.focus();case"trigger-full-screen":return _i(!yi),U.focus();case De:ji(De);return;case Xe:ji(Xe);return;case Ne:ji(Ne);return;case Ze:ji(Ze);return;default:throw new Error}},[U,_t,yi]),Er=Object(g.useCallback)(function(vt){ji("");switch(li){case De:var St=vt.title,bt=vt.link;return U.replaceSelection("[".concat(St,"](").concat(bt,")")),U.focus();case Xe:var It=vt.language,Ft=vt.content;return U.replaceSelection(["```"+It,Ft,"```"].join(`
`)),U.focus();case Ne:var Vt=vt.src,Nt=vt.alt;return Nt?U.replaceSelection("![ ".concat(Nt," ]( ").concat(Vt,' "').concat(Nt,'" )')):U.replaceSelection("![,](".concat(Vt,")")),U.focus();case Ze:for(var si=vt.row,Ai=vt.col,Pt=vt.align,ur=`
`,Wt=0;Wt<si;Wt++){for(var Oi=[],bi=[],Ki=0;Ki<Ai;Ki++)Wt===1&&bi.push($e[Pt]),Oi.push(" ");Wt===1&&(ur+="| ".concat(bi.join(" | "),` |
`)),ur+="| ".concat(Oi.join(Ai===1?"":" | "),` |
`)}return U.replaceSelection(ur+`
`),U.focus();default:throw new Error}},[U,li]),cn=Object(g.useMemo)(function(){switch(li){case De:return p.a.createElement(re,{callback:Er,onCancel:xr});case Xe:return p.a.createElement(oe.b,{callback:Er,onCancel:xr});case Ne:return p.a.createElement(ce,{callback:Er,onCancel:xr});case Ze:return p.a.createElement(Le,{callback:Er,onCancel:xr});default:return null}},[li]);function xr(){ji("")}Object(g.useEffect)(function(){if(zt.current){var vt=zt.current,St=!1,bt=0;function It(Nt){St=!0,bt=Nt.pageY}function Ft(){St=!1}function Vt(Nt){if(St){var si=Nt.pageY-bt;si<0&&(si=0),si>300&&(si=300);var Ai=xt+si+"px";Yi(Ai)}}return vt.addEventListener("mousedown",It),document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",Ft),function(){vt.removeEventListener("mousedown",It),document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",Ft)}}},[U,zt]),Object(g.useEffect)(function(){Yi(xt)},[xt]);var rr=Ce(pt),fn=Ce(Kr),$i={width:rr,height:fn},pn=Object(g.useMemo)(function(){if(Mi){var vt=new Date(Mi),St=vt.getHours(),bt=vt.getMinutes(),It=vt.getSeconds();return St=St<10?"0"+St:St,bt=bt<10?"0"+bt:bt,It=It<10?"0"+It:It,"".concat(St,":").concat(bt,":").concat(It)}return 0},[Mi]);function jn(){window.sessionStorage.removeItem(wt),br(!1),kr(0)}function Dr(){br(!1),kr(0),U.setValue(window.sessionStorage.getItem(wt))}function ua(vt,St){var bt=U.getValue();bt=bt.replace(vt,St),et(bt),U==null||U.setValue(bt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ri},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(_t?"on-preview":""," ").concat(Ut?"mini":""," ").concat(yi?"full-screen":""),style:$i},p.a.createElement(E,{insertTemp:Rt,watch:_t,fullScreen:yi,showNullButton:Bt,onActionCallback:Vr,hidetoolBar:Gi,uuid:ti.current,setOpenPhones:function(){Ht.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Dt,placeholder:gr})),_t?p.a.createElement("div",{ref:ir,className:"preview-container"},Ui==="stex"&&p.a.createElement(R,{value:He}),Ui!=="stex"&&p.a.createElement(T.a,{edit:!0,value:He,replaces:ua})):null))),Lt?p.a.createElement("a",{ref:zt,className:"editor-resize"}):null,p.a.createElement(N.a,null,he[li]?p.a.createElement(J.a,{centered:!0,title:he[li],visible:!0,onCancel:xr,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(ct,Ye){/**
* @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,le,J,P=!1,Q,H;window.PR_SHOULD_USE_CONTINUATION=!0;var F,z;(function(){var W=window,M=["break,continue,do,else,for,if,return,while"],O=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[g,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],n="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",d=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[M,"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"],u=[M,"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"],c=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[p,h,f,d,l,a,u,c],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",R="kwd",C="com",w="typ",x="lit",_="pun",o="pln",b="tag",m="dec",E="src",N="atn",D="atv",B="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Te){for(var Ae=0,Le=!1,Be=!1,Fe=0,De=Te.length;Fe<De;++Fe){var Ne=Te[Fe];if(Ne.ignoreCase)Be=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Le=!0,Be=!1;break}}var Xe={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(it){var Ue=it.charCodeAt(0);if(Ue!==92)return Ue;var dt=it.charAt(1);return Ue=Xe[dt],Ue||("0"<=dt&&dt<="7"?parseInt(it.substring(1),8):dt==="u"||dt==="x"?parseInt(it.substring(2),16):it.charCodeAt(1))}function Je(it){if(it<32)return(it<16?"\\x0":"\\x")+it.toString(16);var Ue=String.fromCharCode(it);return Ue==="\\"||Ue==="-"||Ue==="]"||Ue==="^"?"\\"+Ue:Ue}function $e(it){var Ue=it.substring(1,it.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")),dt=[],rt=Ue[0]==="^",Me=["["];rt&&Me.push("^");for(var ze=rt?1:0,Ce=Ue.length;ze<Ce;++ze){var ve=Ue[ze];if(/\\[bdsw]/i.test(ve))Me.push(ve);else{var Ee=Ze(ve),te;ze+2<Ce&&Ue[ze+1]==="-"?(te=Ze(Ue[ze+2]),ze+=2):te=Ee,dt.push([Ee,te]),te<65||Ee>122||(te<65||Ee>90||dt.push([Math.max(65,Ee)|32,Math.min(te,90)|32]),te<97||Ee>122||dt.push([Math.max(97,Ee)&~32,Math.min(te,122)&~32]))}}dt.sort(function(be,Pe){return be[0]-Pe[0]||Pe[1]-be[1]});for(var ne=[],he=[],ze=0;ze<dt.length;++ze){var me=dt[ze];me[0]<=he[1]+1?he[1]=Math.max(he[1],me[1]):ne.push(he=me)}for(var ze=0;ze<ne.length;++ze){var me=ne[ze];Me.push(Je(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&Me.push("-"),Me.push(Je(me[1])))}return Me.push("]"),Me.join("")}function lt(it){for(var Ue=it.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")),dt=Ue.length,rt=[],Me=0,ze=0;Me<dt;++Me){var Ce=Ue[Me];if(Ce==="(")++ze;else if(Ce.charAt(0)==="\\"){var ve=+Ce.substring(1);ve&&(ve<=ze?rt[ve]=-1:Ue[Me]=Je(ve))}}for(var Me=1;Me<rt.length;++Me)rt[Me]===-1&&(rt[Me]=++Ae);for(var Me=0,ze=0;Me<dt;++Me){var Ce=Ue[Me];if(Ce==="(")++ze,rt[ze]||(Ue[Me]="(?:");else if(Ce.charAt(0)==="\\"){var ve=+Ce.substring(1);ve&&ve<=ze&&(Ue[Me]="\\"+rt[ve])}}for(var Me=0;Me<dt;++Me)Ue[Me]==="^"&&Ue[Me+1]!=="^"&&(Ue[Me]="");if(it.ignoreCase&&Le)for(var Me=0;Me<dt;++Me){var Ce=Ue[Me],Ee=Ce.charAt(0);Ce.length>=2&&Ee==="["?Ue[Me]=$e(Ce):Ee!=="\\"&&(Ue[Me]=Ce.replace(/[a-zA-Z]/g,function(he){var me=he.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Ue.join("")}for(var tt=[],Fe=0,De=Te.length;Fe<De;++Fe){var Ne=Te[Fe];if(Ne.global||Ne.multiline)throw new Error(""+Ne);tt.push("(?:"+lt(Ne)+")")}return new RegExp(tt.join("|"),Be?"gi":"g")}function v(Te,Ae){var Le=/(?:^|\s)nocode(?:\s|$)/,Be=[],Fe=0,De=[],Ne=0;function Xe(Ze){var Je=Ze.nodeType;if(Je==1){if(Le.test(Ze.className))return;for(var $e=Ze.firstChild;$e;$e=$e.nextSibling)Xe($e);var lt=Ze.nodeName.toLowerCase();(lt==="br"||lt==="li")&&(Be[Ne]=`
`,De[Ne<<1]=Fe++,De[Ne++<<1|1]=Ze)}else if(Je==3||Je==4){var tt=Ze.nodeValue;tt.length&&(Ae?tt=tt.replace(/\r\n?/g,`
`):tt=tt.replace(/[ \t\r\n]+/g," "),Be[Ne]=tt,De[Ne<<1]=Fe,Fe+=tt.length,De[Ne++<<1|1]=Ze)}}return Xe(Te),{sourceCode:Be.join("").replace(/\n$/,""),spans:De}}function G(Te,Ae,Le,Be,Fe){if(!Le)return;var De={sourceNode:Te,pre:1,langExtension:null,numberLines:null,sourceCode:Le,spans:null,basePos:Ae,decorations:null};Be(De),Fe.push.apply(Fe,De.decorations)}var Y=/\S/;function re(Te){for(var Ae=void 0,Le=Te.firstChild;Le;Le=Le.nextSibling){var Be=Le.nodeType;Ae=Be===1?Ae?Te:Le:Be===3&&Y.test(Le.nodeValue)?Te:Ae}return Ae===Te?void 0:Ae}function oe(Te,Ae){var Le={},Be;(function(){for(var Ne=Te.concat(Ae),Xe=[],Ze={},Je=0,$e=Ne.length;Je<$e;++Je){var lt=Ne[Je],tt=lt[3];if(tt)for(var it=tt.length;--it>=0;)Le[tt.charAt(it)]=lt;var Ue=lt[1],dt=""+Ue;Ze.hasOwnProperty(dt)||(Xe.push(Ue),Ze[dt]=null)}Xe.push(/[\0-\uffff]/),Be=I(Xe)})();var Fe=Ae.length,De=function(Ne){for(var Xe=Ne.sourceCode,Ze=Ne.basePos,Je=Ne.sourceNode,$e=[Ze,o],lt=0,tt=Xe.match(Be)||[],it={},Ue=0,dt=tt.length;Ue<dt;++Ue){var rt=tt[Ue],Me=it[rt],ze=void 0,Ce;if(typeof Me=="string")Ce=!1;else{var ve=Le[rt.charAt(0)];if(ve)ze=rt.match(ve[1]),Me=ve[0];else{for(var Ee=0;Ee<Fe;++Ee)if(ve=Ae[Ee],ze=rt.match(ve[1]),ze){Me=ve[0];break}ze||(Me=o)}Ce=Me.length>=5&&Me.substring(0,5)==="lang-",Ce&&!(ze&&typeof ze[1]=="string")&&(Ce=!1,Me=E),Ce||(it[rt]=Me)}var te=lt;if(lt+=rt.length,!Ce)$e.push(Ze+te,Me);else{var ne=ze[1],he=rt.indexOf(ne),me=he+ne.length;ze[2]&&(me=rt.length-ze[2].length,he=me-ne.length);var be=Me.substring(5);G(Je,Ze+te,rt.substring(0,he),De,$e),G(Je,Ze+te+he,ne,ue(be,ne),$e),G(Je,Ze+te+me,rt.substring(me),De,$e)}}Ne.decorations=$e};return De}function we(Te){var Ae=[],Le=[];Te.tripleQuotedStrings?Ae.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Ae.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ae.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Le.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=Te.hashComments;Be&&(Te.cStyleComments?(Be>1?Ae.push([C,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ae.push([C,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ae.push([C,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Le.push([C,/^\/\/[^\r\n]*/,null]),Le.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Te.regexLiterals;if(Fe){var De=Fe>1?"":`
\r`,Ne=De?".":"[\\S\\s]",Xe="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+j+"("+Xe+")")])}var Ze=Te.types;Ze&&Le.push([w,Ze]);var Je=(""+Te.keywords).replace(/^ | $/g,"");Je.length&&Le.push([R,new RegExp("^(?:"+Je.replace(/[\s,]+/g,"|")+")\\b"),null]),Ae.push([o,/^\s+/,null,` \r
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&($e+="(?!s*/)"),Le.push([x,/^@[a-z_$][a-z_$@0-9]*/i,null],[w,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[x,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[_,new RegExp($e),null]),oe(Ae,Le)}var pe=we({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function xe(Te,Ae,Le){for(var Be=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,De=Te.ownerDocument,Ne=De.createElement("li");Te.firstChild;)Ne.appendChild(Te.firstChild);var Xe=[Ne];function Ze(Ue){var dt=Ue.nodeType;if(dt==1&&!Be.test(Ue.className))if(Ue.nodeName==="br")Je(Ue),Ue.parentNode&&Ue.parentNode.removeChild(Ue);else for(var rt=Ue.firstChild;rt;rt=rt.nextSibling)Ze(rt);else if((dt==3||dt==4)&&Le){var Me=Ue.nodeValue,ze=Me.match(Fe);if(ze){var Ce=Me.substring(0,ze.index);Ue.nodeValue=Ce;var ve=Me.substring(ze.index+ze[0].length);if(ve){var Ee=Ue.parentNode;Ee.insertBefore(De.createTextNode(ve),Ue.nextSibling)}Je(Ue),Ce||Ue.parentNode.removeChild(Ue)}}}function Je(Ue){for(;!Ue.nextSibling;)if(Ue=Ue.parentNode,!Ue)return;function dt(ze,Ce){var ve=Ce?ze.cloneNode(!1):ze,Ee=ze.parentNode;if(Ee){var te=dt(Ee,1),ne=ze.nextSibling;te.appendChild(ve);for(var he=ne;he;he=ne)ne=he.nextSibling,te.appendChild(he)}return ve}for(var rt=dt(Ue.nextSibling,0),Me;(Me=rt.parentNode)&&Me.nodeType===1;)rt=Me;Xe.push(rt)}for(var $e=0;$e<Xe.length;++$e)Ze(Xe[$e]);Ae===(Ae|0)&&Xe[0].setAttribute("value",Ae);var lt=De.createElement("ol");lt.className="linenums";for(var tt=Math.max(0,Ae-1|0)||0,$e=0,it=Xe.length;$e<it;++$e)Ne=Xe[$e],Ne.className="L"+($e+tt)%10,Ne.firstChild||Ne.appendChild(De.createTextNode("\xA0")),lt.appendChild(Ne);Te.appendChild(lt)}function _e(Te){var Ae=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ae=Ae&&+Ae[1]<=8;var Le=/\n/g,Be=Te.sourceCode,Fe=Be.length,De=0,Ne=Te.spans,Xe=Ne.length,Ze=0,Je=Te.decorations,$e=Je.length,lt=0;Je[$e]=Fe;var tt,it;for(it=tt=0;it<$e;)Je[it]!==Je[it+2]?(Je[tt++]=Je[it++],Je[tt++]=Je[it++]):it+=2;for($e=tt,it=tt=0;it<$e;){for(var Ue=Je[it],dt=Je[it+1],rt=it+2;rt+2<=$e&&Je[rt+1]===dt;)rt+=2;Je[tt++]=Ue,Je[tt++]=dt,it=rt}$e=Je.length=tt;var Me=Te.sourceNode,ze="";Me&&(ze=Me.style.display,Me.style.display="none");try{for(var Ce=null;Ze<Xe;){var ve=Ne[Ze],Ee=Ne[Ze+2]||Fe,te=Je[lt+2]||Fe,rt=Math.min(Ee,te),ne=Ne[Ze+1],he;if(ne.nodeType!==1&&(he=Be.substring(De,rt))){Ae&&(he=he.replace(Le,"\r")),ne.nodeValue=he;var me=ne.ownerDocument,be=me.createElement("span");be.className=Je[lt+1];var Pe=ne.parentNode;Pe.replaceChild(be,ne),be.appendChild(ne),De<Ee&&(Ne[Ze+1]=ne=me.createTextNode(Be.substring(rt,Ee)),Pe.insertBefore(ne,be.nextSibling))}De=rt,De>=Ee&&(Ze+=2),De>=te&&(lt+=2)}}finally{Me&&(Me.style.display=ze)}}var Se={};function ce(Te,Ae){for(var Le=Ae.length;--Le>=0;){var Be=Ae[Le];Se.hasOwnProperty(Be)?W.console&&console.warn("cannot override language handler %s",Be):Se[Be]=Te}}function ue(Te,Ae){return Te&&Se.hasOwnProperty(Te)||(Te=/^\s*</.test(Ae)?"default-markup":"default-code"),Se[Te]}ce(pe,["default-code"]),ce(oe([],[[o,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["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"]),ce(oe([[o,/^[\s]+/,null,` \r
`],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[_,/^[=<>\/]+/],["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"]),ce(oe([],[[D,/^[\s\S]+/]]),["uq.val"]),ce(we({keywords:p,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),ce(we({keywords:"null,true,false"}),["json"]),ce(we({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),ce(we({keywords:f,cStyleComments:!0}),["java"]),ce(we({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(we({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(we({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(we({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(we({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(we({keywords:n,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(oe([],[[T,/^[\s\S]+/]]),["regex"]);function ie(Te){var Ae=Te.langExtension;try{var Le=v(Te.sourceNode,Te.pre),Be=Le.sourceCode;Te.sourceCode=Be,Te.spans=Le.spans,Te.basePos=0,ue(Ae,Be)(Te),_e(Te)}catch(Fe){W.console&&console.log(Fe&&Fe.stack||Fe)}}function de(Te,Ae,Le){var Be=Le||!1,Fe=Ae||null,De=document.createElement("div");De.innerHTML="<pre>"+Te+"</pre>",De=De.firstChild,Be&&xe(De,Be,!0);var Ne={langExtension:Fe,numberLines:Be,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ie(Ne),De.innerHTML}function se(Te,Ae){var Le=Ae||document.body,Be=Le.ownerDocument||document;function Fe(ve){return Le.getElementsByTagName(ve)}for(var De=[Fe("pre"),Fe("code"),Fe("xmp")],Ne=[],Xe=0;Xe<De.length;++Xe)for(var Ze=0,Je=De[Xe].length;Ze<Je;++Ze)Ne.push(De[Xe][Ze]);De=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var lt=0,tt=/\blang(?:uage)?-([\w.]+)(?!\S)/,it=/\bprettyprint\b/,Ue=/\bprettyprinted\b/,dt=/pre|xmp/i,rt=/^code$/i,Me=/^(?:pre|code|xmp)$/i,ze={};function Ce(){for(var ve=W.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;lt<Ne.length&&$e.now()<ve;lt++){for(var Ee=Ne[lt],te=ze,ne=Ee;ne=ne.previousSibling;){var he=ne.nodeType,me=(he===7||he===8)&&ne.nodeValue;if(me?!/^\??prettify\b/.test(me):he!==3||/\S/.test(ne.nodeValue))break;if(me){te={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Yt,Rt,Ti){te[Rt]=Ti});break}}var be=Ee.className;if((te!==ze||it.test(be))&&!Ue.test(be)){for(var Pe=!1,We=Ee.parentNode;We;We=We.parentNode){var st=We.tagName;if(Me.test(st)&&We.className&&it.test(We.className)){Pe=!0;break}}if(!Pe){Ee.className+=" prettyprinted";var ft=te.lang;if(!ft){ft=be.match(tt);var pt;!ft&&(pt=re(Ee))&&rt.test(pt.tagName)&&(ft=pt.className.match(tt)),ft&&(ft=ft[1])}var Ct;if(dt.test(Ee.tagName))Ct=1;else{var xt=Ee.currentStyle,ut=Be.defaultView,Ut=xt?xt.whiteSpace:ut&&ut.getComputedStyle?ut.getComputedStyle(Ee,null).getPropertyValue("white-space"):0;Ct=Ut&&Ut.substring(0,3)==="pre"}var Mt=te.linenums;(Mt=Mt==="true"||+Mt)||(Mt=be.match(/\blinenums\b(?::(\d+))?/),Mt=Mt?Mt[1]&&Mt[1].length?+Mt[1]:!0:!1),Mt&&xe(Ee,Mt,Ct);var Jt={langExtension:ft,sourceNode:Ee,numberLines:Mt,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};ie(Jt)}}}lt<Ne.length?W.setTimeout(Ce,250):typeof Te=="function"&&Te()}Ce()}var Oe=W.PR={createSimpleLexer:oe,registerLangHandler:ce,sourceDecorator:we,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:D,PR_COMMENT:C,PR_DECLARATION:m,PR_KEYWORD:R,PR_LITERAL:x,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:_,PR_SOURCE:E,PR_STRING:T,PR_TAG:b,PR_TYPE:w,prettyPrintOne:P?W.prettyPrintOne=de:F=de,prettyPrint:z=P?W.prettyPrint=se:z=se},ke=W.define;typeof ke=="function"&&ke.amd&&ke("google-code-prettify",[],function(){return Oe})})()},TXwP:function(ct,Ye,ae){var le,J;(function(){var P;(function(){"use strict";var H=[,,function(M){function O(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var f=new O(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},O.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},O.prototype.has_match=function(f){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(f))return!0;return!1},O.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(`
`);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},O.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,h){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var n=this.__base_string_length;return h=h||0,f<0&&(n=0),n+=f*this.__indent_size,n+=h,n},g.prototype.get_indent_string=function(f,h){var n=this.__base_string;return h=h||0,f<0&&(f=0,n=""),h+=f*this.__indent_size,this.__ensure_cache(h),n+=this.__cache[h],n},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,n="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,n=new Array(h+1).join(this.__indent_string)),f&&(n+=new Array(f+1).join(" ")),this.__cache.push(n)};function p(f,h){this.__indent_cache=new g(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join(`
`);return f!==`
`&&(n=n.replace(/[\n]/g,f)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var n=this.__lines.length-2;n>=0;){var d=this.__lines[n];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(n+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},M.exports.Output=p},,,,function(M){function O(f,h){this.raw_options=g(f,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(f,h){var n=this.raw_options[f],d=h||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(d=n.concat()):typeof n=="string"&&(d=n.split(/[^a-zA-Z0-9_\/\-]+/)),d},O.prototype._get_boolean=function(f,h){var n=this.raw_options[f],d=n===void 0?!!h:!!n;return d},O.prototype._get_characters=function(f,h){var n=this.raw_options[f],d=h||"";return typeof n=="string"&&(d=n.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},O.prototype._get_number=function(f,h){var n=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(n,10);return isNaN(d)&&(d=h),d},O.prototype._get_selection=function(f,h,n){var d=this._get_selection_list(f,h,n);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return d[0]},O.prototype._get_selection_list=function(f,h,n){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[h[0]],!this._is_valid_selection(n,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,n);if(!this._is_valid_selection(d,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return d},O.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(n){return h.indexOf(n)===-1})};function g(f,h){var n={};f=p(f);var d;for(d in f)d!==h&&(n[d]=f[d]);if(h&&f[h])for(d in f[h])n[d]=f[h][d];return n}function p(f){var h={},n;for(n in f){var d=n.replace(/-/g,"_");h[d]=f[n]}return h}M.exports.Options=O,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},,function(M){var O=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(O&&p.sticky)&&(h.index!==f&&(h=null)),h},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,h){var n="",d;return p&&(d=this.match(p),d&&(n+=d[0])),f&&(d||!p)&&(n+=this.readUntil(f,h)),n},g.prototype.readUntil=function(p,f){var h="",n=this.__position;p.lastIndex=this.__position;var d=p.exec(this.__input);return d?(n=d.index,f&&(n+=d[0].length)):n=this.__input_length,h=this.__input.substring(this.__position,n),this.__position=n,h},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var h=null,n="g";return f&&O&&(n="y"),typeof p=="string"&&p!==""?h=new RegExp(p,n):p&&(h=new RegExp(p.source,n)),h},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},,,,,function(M){function O(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}O.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},O.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=O},,function(M,O,g){var p=g(16).Beautifier,f=g(17).Options;function h(n,d){var l=new p(n,d);return l.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new f}},function(M,O,g){var p=g(17).Options,f=g(2).Output,h=g(8).InputScanner,n=g(13).Directives,d=new n(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,u=/\s/,c=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(R,C){this._source_text=R||"",this._options=new p(C),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(R){var C="";for(this._ch=this._input.next();this._ch;){if(C+=this._ch,this._ch==="\\")C+=this._input.next();else if(R.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return C},T.prototype.eatWhitespace=function(R){for(var C=u.test(this._input.peek()),w=0;u.test(this._input.peek());)this._ch=this._input.next(),R&&this._ch===`
`&&((w===0||w<this._options.max_preserve_newlines)&&(w++,this._output.add_new_line(!0)));return C},T.prototype.foundNestedPseudoClass=function(){for(var R=0,C=1,w=this._input.peek(C);w;){if(w==="{")return!0;if(w==="(")R+=1;else if(w===")"){if(R===0)return!1;R-=1}else if(w===";"||w==="}")return!1;C++,w=this._input.peek(C)}return!1},T.prototype.print_string=function(R){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(R)},T.prototype.preserveSingleSpace=function(R){R&&(this._output.space_before_token=!0)},T.prototype.indent=function(){this._indentLevel++},T.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R=this._source_text,C=this._options.eol;C==="auto"&&(C=`
`,R&&l.test(R||"")&&(C=R.match(l)[0])),R=R.replace(a,`
`);var w=R.match(/^[\t ]*/)[0];this._output=new f(this._options,w),this._input=new h(R),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var x=0,_=!1,o=!1,b=!1,m=!1,E=!1,N=!1,D=this._ch,B=!1,j,I,v;j=this._input.read(c),I=j!=="",v=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(L),Y=d.get_directives(G);Y&&Y.ignore==="start"&&(G+=d.readIgnored(this._input)),this.print_string(G),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(S)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s$/,""),this.print_string(re),this._output.space_before_token=!0),re=re.replace(/\s$/,""),re==="extend"?m=!0:re==="import"&&(E=!0),re in this.NESTED_AT_RULE?(this._nestedLevel+=1,re in this.CONDITIONAL_GROUP_RULE&&(b=!0)):!_&&x===0&&re.indexOf(":")!==-1&&(o=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")o&&(o=!1,this.outdent()),b?(b=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(v==="("?this._output.space_before_token=!1:v!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),v==="{"&&this._output.trim(!0),E=!1,m=!1,o&&(this.outdent(),o=!1),this.print_string(this._ch),_=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var oe=0;oe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;oe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[oe])){B=!0;break}(_||b)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&x===0?(this.print_string(":"),o||(o=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var we=v==='"'||v==="'";this.preserveSingleSpace(we||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,x===0?(o&&(this.outdent(),o=!1),m=!1,E=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),x++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),x&&(x--,this.outdent()));else{var pe=!1;this._input.lookBack("with")&&(pe=!0),this.preserveSingleSpace(I||pe),this.print_string(this._ch),o&&v==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),N=!0):(this.eatWhitespace(),x++,this.indent())}else if(this._ch===")")x&&(x--,this.outdent()),N&&this._input.peek()===";"&&this._options.selector_separator_newline&&(N=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!o||N)&&x===0&&!E&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!o&&x===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&u.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),u.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var xe=v==='"'||v==="'";this.preserveSingleSpace(xe||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&B&&this._output.add_new_line()}var _e=this._output.get_code(C);return _e},M.exports.Beautifier=T},function(M,O,g){var p=g(6).Options;function f(h){p.call(this,h,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var n=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||n;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<d.length;l++)d[l]!=="expand"?this.brace_style="collapse":this.brace_style=d[l]}f.prototype=new p,M.exports.Options=f}],F={};function z(M){var O=F[M];if(O!==void 0)return O.exports;var g=F[M]={exports:{}};return H[M](g,g.exports,z),g.exports}var W=z(15);P=W})();var Q=P;!(le=[],J=function(){return{css_beautify:Q}}.apply(Ye,le),J!==void 0&&(ct.exports=J))})()},"VrN/":function(ct,Ye,ae){(function(le,J){ct.exports=J()})(this,function(){"use strict";var le=navigator.userAgent,J=navigator.platform,P=/gecko\/\d/i.test(le),Q=/MSIE \d/.test(le),H=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),F=/Edge\/(\d+)/.exec(le),z=Q||H||F,W=z&&(Q?document.documentMode||6:+(F||H)[1]),M=!F&&/WebKit\//.test(le),O=M&&/Qt\/\d+\.\d+/.test(le),g=!F&&/Chrome\//.test(le),p=/Opera\//.test(le),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),n=/PhantomJS/.test(le),d=!F&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),l=/Android/.test(le),a=d||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),u=d||/Mac/.test(J),c=/\bCrOS\b/.test(le),L=/win/i.test(J),S=p&&le.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(p=!1,M=!0);var T=u&&(O||p&&(S==null||S<12.11)),R=P||z&&W>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var w=function(e,t){var r=e.className,i=C(t).exec(r);if(i){var s=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(s?i[1]+s:"")}};function x(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return x(e).appendChild(t)}function o(e,t,r,i){var s=document.createElement(e);if(r&&(s.className=r),i&&(s.style.cssText=i),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)s.appendChild(t[k]);return s}function b(e,t,r,i){var s=o(e,t,r,i);return s.setAttribute("role","presentation"),s}var m;document.createRange?m=function(e,t,r,i){var s=document.createRange();return s.setEnd(i||e,r),s.setStart(e,t),s}:m=function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(s){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i};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 D(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function B(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!C(r[i]).test(t)&&(t+=" "+r[i]);return t}var j=function(e){e.select()};d?j=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(j=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function v(e,t,r){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(r!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function G(e,t,r,i,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=i||0,K=s||0;;){var $=e.indexOf(" ",k);if($<0||$>=t)return K+(t-k);K+=$-k,K+=r-K%r,k=$+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function re(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var oe=50,we={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},xe={origin:"*mouse"},_e={origin:"+move"};function Se(e,t,r){for(var i=0,s=0;;){var k=e.indexOf(" ",i);k==-1&&(k=e.length);var K=k-i;if(k==e.length||s+K>=t)return i+Math.min(K,t-s);if(s+=k-i,s+=r-s%r,i=k+1,s>=t)return i}}var ce=[""];function ue(e){for(;ce.length<=e;)ce.push(ie(ce)+" ");return ce[e]}function ie(e){return e[e.length-1]}function de(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function se(e,t,r){for(var i=0,s=r(t);i<e.length&&r(e[i])<=s;)i++;e.splice(i,0,t)}function Oe(){}function ke(e,t){var r;return Object.create?r=Object.create(e):(Oe.prototype=e,r=new Oe),t&&v(t,r),r}var Te=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ae(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Le(e,t){return t?t.source.indexOf("\\w")>-1&&Ae(e)?!0:t.test(e):Ae(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Ne(e,t,r){for(;(r<0?t>0:t<e.length)&&De(e.charAt(t));)t+=r;return t}function Xe(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var s=(t+r)/2,k=i<0?Math.ceil(s):Math.floor(s);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+i}}function Ze(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var s=!1,k=0;k<e.length;++k){var K=e[k];(K.from<r&&K.to>t||t==r&&K.to==t)&&(i(Math.max(K.from,t),Math.min(K.to,r),K.level==1?"rtl":"ltr",k),s=!0)}s||i(t,r,"ltr")}var Je=null;function $e(e,t,r){var i;Je=null;for(var s=0;s<e.length;++s){var k=e[s];if(k.from<t&&k.to>t)return s;k.to==t&&(k.from!=k.to&&r=="before"?i=s:Je=s),k.from==t&&(k.from!=k.to&&r!="before"?i=s:Je=s)}return i!=null?i:Je}var lt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,k=/[LRr]/,K=/[Lb1n]/,$=/[1n]/;function Z(ee,fe,ge){this.level=ee,this.from=fe,this.to=ge}return function(ee,fe){var ge=fe=="ltr"?"L":"R";if(ee.length==0||fe=="ltr"&&!i.test(ee))return!1;for(var Ie=ee.length,Re=[],je=0;je<Ie;++je)Re.push(r(ee.charCodeAt(je)));for(var Ke=0,Qe=ge;Ke<Ie;++Ke){var nt=Re[Ke];nt=="m"?Re[Ke]=Qe:Qe=nt}for(var ot=0,at=ge;ot<Ie;++ot){var ht=Re[ot];ht=="1"&&at=="r"?Re[ot]="n":k.test(ht)&&(at=ht,ht=="r"&&(Re[ot]="R"))}for(var Et=1,yt=Re[0];Et<Ie-1;++Et){var At=Re[Et];At=="+"&&yt=="1"&&Re[Et+1]=="1"?Re[Et]="1":At==","&&yt==Re[Et+1]&&(yt=="1"||yt=="n")&&(Re[Et]=yt),yt=At}for(var Xt=0;Xt<Ie;++Xt){var ci=Re[Xt];if(ci==",")Re[Xt]="N";else if(ci=="%"){var Zt=void 0;for(Zt=Xt+1;Zt<Ie&&Re[Zt]=="%";++Zt);for(var Fi=Xt&&Re[Xt-1]=="!"||Zt<Ie&&Re[Zt]=="1"?"1":"N",Ii=Xt;Ii<Zt;++Ii)Re[Ii]=Fi;Xt=Zt-1}}for(var ni=0,ki=ge;ni<Ie;++ni){var gi=Re[ni];ki=="L"&&gi=="1"?Re[ni]="L":k.test(gi)&&(ki=gi)}for(var oi=0;oi<Ie;++oi)if(s.test(Re[oi])){var ai=void 0;for(ai=oi+1;ai<Ie&&s.test(Re[ai]);++ai);for(var ei=(oi?Re[oi-1]:ge)=="L",Di=(ai<Ie?Re[ai]:ge)=="L",un=ei==Di?ei?"L":"R":ge,Lr=oi;Lr<ai;++Lr)Re[Lr]=un;oi=ai-1}for(var xi=[],sr,fi=0;fi<Ie;)if(K.test(Re[fi])){var Va=fi;for(++fi;fi<Ie&&K.test(Re[fi]);++fi);xi.push(new Z(0,Va,fi))}else{var cr=fi,Wr=xi.length,Gr=fe=="rtl"?1:0;for(++fi;fi<Ie&&Re[fi]!="L";++fi);for(var Ci=cr;Ci<fi;)if($.test(Re[Ci])){cr<Ci&&(xi.splice(Wr,0,new Z(1,cr,Ci)),Wr+=Gr);var hn=Ci;for(++Ci;Ci<fi&&$.test(Re[Ci]);++Ci);xi.splice(Wr,0,new Z(2,hn,Ci)),Wr+=Gr,cr=Ci}else++Ci;cr<fi&&xi.splice(Wr,0,new Z(1,cr,fi))}return fe=="ltr"&&(xi[0].level==1&&(sr=ee.match(/^\s+/))&&(xi[0].from=sr[0].length,xi.unshift(new Z(0,0,sr[0].length))),ie(xi).level==1&&(sr=ee.match(/\s+$/))&&(ie(xi).to-=sr[0].length,xi.push(new Z(0,Ie-sr[0].length,Ie)))),fe=="rtl"?xi.reverse():xi}}();function tt(e,t){var r=e.order;return r==null&&(r=e.order=lt(e.text,t)),r}var it=[],Ue=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||it).concat(r)}};function dt(e,t){return e._handlers&&e._handlers[t]||it}function rt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,s=i&&i[t];if(s){var k=re(s,r);k>-1&&(i[t]=s.slice(0,k).concat(s.slice(k+1)))}}}function Me(e,t){var r=dt(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),s=0;s<r.length;++s)r[s].apply(null,i)}function ze(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,r||t.type,e,t),he(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)re(r,t[i])==-1&&r.push(t[i])}function ve(e,t){return dt(e,t).length>0}function Ee(e){e.prototype.on=function(t,r){Ue(this,t,r)},e.prototype.off=function(t,r){rt(this,t,r)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){te(e),ne(e)}function be(e){return e.target||e.srcElement}function Pe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(z&&W<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),st;function ft(e){if(st==null){var t=o("span","\u200B");_(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&W<8))}var r=st?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var pt;function Ct(e){if(pt!=null)return pt;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return x(e),!r||r.left==r.right?!1:pt=i.right-r.right<3}var xt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var s=e.indexOf(`
`,t);s==-1&&(s=e.length);var k=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),K=k.indexOf("\r");K!=-1?(r.push(k.slice(0,K)),t+=K+1):(r.push(k),t=s+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ut=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ut=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Jt(e){if(Mt!=null)return Mt;var t=_(e,o("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return Mt=Math.abs(r.left-i.left)>1}var Yt={},Rt={};function Ti(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function Ui(e,t){Rt[e]=t}function qe(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[e.name];typeof t=="string"&&(t={name:t}),e=ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return qe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return qe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wt(e,t){t=qe(t);var r=Yt[t.name];if(!r)return wt(e,"text/plain");var i=r(e,t);if(Ot.hasOwnProperty(t.name)){var s=Ot[t.name];for(var k in s){if(!s.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=s[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var K in t.modeProps)i[K]=t.modeProps[K];return i}var Ot={};function Lt(e,t){var r=Ot.hasOwnProperty(e)?Ot[e]:Ot[e]={};v(t,r)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var s=t[i];s instanceof Array&&(s=s.concat([])),r[i]=s}return r}function qi(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function er(e,t,r){return e.startState?e.startState(t,r):!0}var Bt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.match=function(e,t,r){if(typeof e=="string"){var i=function(K){return r?K.toLowerCase():K},s=this.string.substr(this.pos,e.length);if(i(s)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function mt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var s=r.children[i],k=s.chunkSize();if(t<k){r=s;break}t-=k}return r.lines[t]}function Gi(e,t,r){var i=[],s=t.line;return e.iter(t.line,r.line+1,function(k){var K=k.text;s==r.line&&(K=K.slice(0,r.ch)),s==t.line&&(K=K.slice(t.ch)),i.push(K),++s}),i}function tr(e,t,r){var i=[];return e.iter(t,r,function(s){i.push(s.text)}),i}function vi(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function kt(e){if(e.parent==null)return null;for(var t=e.parent,r=re(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var s=0;!(i.children[s]==t);++s)r+=i.children[s].chunkSize();return r+t.first}function Bi(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var s=e.children[i],k=s.height;if(t<k){e=s;continue e}t-=k,r+=s.chunkSize()}return r}while(!e.lines);for(var K=0;K<e.lines.length;++K){var $=e.lines[K],Z=$.height;if(t<Z)break;t-=Z}return r+K}function Vi(e,t){return t>=e.first&&t<e.first+e.size}function fr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ve))return new Ve(e,t,r);this.line=e,this.ch=t,this.sticky=r}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function pr(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function mr(e){return Ve(e.line,e.ch)}function gr(e,t){return Tt(e,t)<0?t:e}function vr(e,t){return Tt(e,t)<0?e:t}function X(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function y(e,t){if(t.line<e.first)return Ve(e.first,0);var r=e.first+e.size-1;return t.line>r?Ve(r,mt(e,r).text.length):A(t,mt(e,t.line).text.length)}function A(e,t){var r=e.ch;return r==null||r>t?Ve(e.line,t):r<0?Ve(e.line,0):e}function U(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=y(e,t[i]);return r}var q=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,r){return t instanceof q?new V(e,qt(e.mode,t.state),r,t.lookAhead):new V(e,qt(e.mode,t),r)},V.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function ye(e,t,r,i){var s=[e.state.modeGen],k={};yi(e,t.text,e.doc.mode,r,function(ee,fe){return s.push(ee,fe)},k,i);for(var K=r.state,$=function(ee){r.baseTokens=s;var fe=e.state.overlays[ee],ge=1,Ie=0;r.state=!0,yi(e,t.text,fe.mode,r,function(Re,je){for(var Ke=ge;Ie<Re;){var Qe=s[ge];Qe>Re&&s.splice(ge,1,Re,s[ge+1],Qe),ge+=2,Ie=Math.min(Re,Qe)}if(!je)return;if(fe.opaque)s.splice(Ke,ge-Ke,Re,"overlay "+je),ge=Ke+2;else for(;Ke<ge;Ke+=2){var nt=s[Ke+1];s[Ke+1]=(nt?nt+" ":"")+"overlay "+je}},k),r.state=K,r.baseTokens=null,r.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)$(Z);return{styles:s,classes:k.bgClass||k.textClass?k:null}}function He(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=et(e,kt(t)),s=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,i.state),k=ye(e,t,i);s&&(i.state=s),t.stateAfter=i.save(!s),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function et(e,t,r){var i=e.doc,s=e.display;if(!i.mode.startState)return new V(i,!0,t);var k=_i(e,t,r),K=k>i.first&&mt(i,k-1).stateAfter,$=K?V.fromSaved(i,K,k):new V(i,er(i.mode),k);return i.iter(k,t,function(Z){gt(e,Z.text,$);var ee=$.line;Z.stateAfter=ee==t-1||ee%5==0||ee>=s.viewFrom&&ee<s.viewTo?$.save():null,$.nextLine()}),r&&(i.modeFrontier=$.line),$}function gt(e,t,r,i){var s=e.doc.mode,k=new Bt(t,e.options.tabSize,r);for(k.start=k.pos=i||0,t==""&&Ge(s,r.state);!k.eol();)_t(s,k,r.state),k.start=k.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=qi(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function _t(e,t,r,i){for(var s=0;s<10;s++){i&&(i[0]=qi(e,r).mode);var k=e.token(t,r);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var jt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function $t(e,t,r,i){var s=e.doc,k=s.mode,K;t=y(s,t);var $=mt(s,t.line),Z=et(e,t.line,r),ee=new Bt($.text,e.options.tabSize,Z),fe;for(i&&(fe=[]);(i||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,K=_t(k,ee,Z.state),i&&fe.push(new jt(ee,K,qt(s.mode,Z.state)));return i?fe:new jt(ee,K,Z.state)}function Pi(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";t[i]==null?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function yi(e,t,r,i,s,k,K){var $=r.flattenSpans;$==null&&($=e.options.flattenSpans);var Z=0,ee=null,fe=new Bt(t,e.options.tabSize,i),ge,Ie=e.options.addModeClass&&[null];for(t==""&&Pi(Ge(r,i.state),k);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?($=!1,K&&gt(e,t,i,fe.pos),fe.pos=t.length,ge=null):ge=Pi(_t(r,fe,i.state,Ie),k),Ie){var Re=Ie[0].name;Re&&(ge="m-"+(ge?Re+" "+ge:Re))}if(!$||ee!=ge){for(;Z<fe.start;)Z=Math.min(fe.start,Z+5e3),s(Z,ee);ee=ge}fe.start=fe.pos}for(;Z<fe.pos;){var je=Math.min(fe.pos,Z+5e3);s(je,ee),Z=je}}function _i(e,t,r){for(var i,s,k=e.doc,K=r?-1:t-(e.doc.mode.innerMode?1e3:100),$=t;$>K;--$){if($<=k.first)return k.first;var Z=mt(k,$-1),ee=Z.stateAfter;if(ee&&(!r||$+(ee instanceof q?ee.lookAhead:0)<=k.modeFrontier))return $;var fe=G(Z.text,null,e.options.tabSize);(s==null||i>fe)&&(s=$-1,i=fe)}return s}function Xi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,i=t-1;i>r;i--){var s=mt(e,i).stateAfter;if(s&&(!(s instanceof q)||i+s.lookAhead<t)){r=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Ir=!1,li=!1;function ji(){Ir=!0}function or(){li=!0}function lr(e,t,r){this.marker=e,this.from=t,this.to=r}function Mi(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function kr(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zr(e,t,r){var i;if(e)for(var s=0;s<e.length;++s){var k=e[s],K=k.marker,$=k.from==null||(K.inclusiveLeft?k.from<=t:k.from<t);if($||k.from==t&&K.type=="bookmark"&&(!r||!k.marker.insertLeft)){var Z=k.to==null||(K.inclusiveRight?k.to>=t:k.to>t);(i||(i=[])).push(new lr(K,k.from,Z?null:k.to))}}return i}function Kr(e,t,r){var i;if(e)for(var s=0;s<e.length;++s){var k=e[s],K=k.marker,$=k.to==null||(K.inclusiveRight?k.to>=t:k.to>t);if($||k.from==t&&K.type=="bookmark"&&(!r||k.marker.insertLeft)){var Z=k.from==null||(K.inclusiveLeft?k.from<=t:k.from<t);(i||(i=[])).push(new lr(K,Z?null:k.from-t,k.to==null?null:k.to-t))}}return i}function Yi(e,t){if(t.full)return null;var r=Vi(e,t.from.line)&&mt(e,t.from.line).markedSpans,i=Vi(e,t.to.line)&&mt(e,t.to.line).markedSpans;if(!r&&!i)return null;var s=t.from.ch,k=t.to.ch,K=Tt(t.from,t.to)==0,$=zr(r,s,K),Z=Kr(i,k,K),ee=t.text.length==1,fe=ie(t.text).length+(ee?s:0);if($)for(var ge=0;ge<$.length;++ge){var Ie=$[ge];if(Ie.to==null){var Re=Mi(Z,Ie.marker);Re?ee&&(Ie.to=Re.to==null?null:Re.to+fe):Ie.to=s}}if(Z)for(var je=0;je<Z.length;++je){var Ke=Z[je];if(Ke.to!=null&&(Ke.to+=fe),Ke.from==null){var Qe=Mi($,Ke.marker);Qe||(Ke.from=fe,ee&&($||($=[])).push(Ke))}else Ke.from+=fe,ee&&($||($=[])).push(Ke)}$&&($=zi($)),Z&&Z!=$&&(Z=zi(Z));var nt=[$];if(!ee){var ot=t.text.length-2,at;if(ot>0&&$)for(var ht=0;ht<$.length;++ht)$[ht].to==null&&(at||(at=[])).push(new lr($[ht].marker,null,null));for(var Et=0;Et<ot;++Et)nt.push(at);nt.push(Z)}return nt}function zi(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function _r(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(Re){if(Re.markedSpans)for(var je=0;je<Re.markedSpans.length;++je){var Ke=Re.markedSpans[je].marker;Ke.readOnly&&(!i||re(i,Ke)==-1)&&(i||(i=[])).push(Ke)}}),!i)return null;for(var s=[{from:t,to:r}],k=0;k<i.length;++k)for(var K=i[k],$=K.find(0),Z=0;Z<s.length;++Z){var ee=s[Z];if(Tt(ee.to,$.from)<0||Tt(ee.from,$.to)>0)continue;var fe=[Z,1],ge=Tt(ee.from,$.from),Ie=Tt(ee.to,$.to);(ge<0||!K.inclusiveLeft&&!ge)&&fe.push({from:ee.from,to:$.from}),(Ie>0||!K.inclusiveRight&&!Ie)&&fe.push({from:$.to,to:ee.to}),s.splice.apply(s,fe),Z+=fe.length-3}return s}function dn(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function br(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function ti(e){return e.inclusiveLeft?-1:0}function Ht(e){return e.inclusiveRight?1:0}function pi(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var i=e.find(),s=t.find(),k=Tt(i.from,s.from)||ti(e)-ti(t);if(k)return-k;var K=Tt(i.to,s.to)||Ht(e)-Ht(t);return K||t.id-e.id}function Dt(e,t){var r=li&&e.markedSpans,i;if(r)for(var s=void 0,k=0;k<r.length;++k)s=r[k],s.marker.collapsed&&(t?s.from:s.to)==null&&(!i||pi(i,s.marker)<0)&&(i=s.marker);return i}function ri(e){return Dt(e,!0)}function zt(e){return Dt(e,!1)}function ir(e,t){var r=li&&e.markedSpans,i;if(r)for(var s=0;s<r.length;++s){var k=r[s];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!i||pi(i,k.marker)<0)&&(i=k.marker)}return i}function ui(e,t,r,i,s){var k=mt(e,t),K=li&&k.markedSpans;if(K)for(var $=0;$<K.length;++$){var Z=K[$];if(!Z.marker.collapsed)continue;var ee=Z.marker.find(0),fe=Tt(ee.from,r)||ti(Z.marker)-ti(s),ge=Tt(ee.to,i)||Ht(Z.marker)-Ht(s);if(fe>=0&&ge<=0||fe<=0&&ge>=0)continue;if(fe<=0&&(Z.marker.inclusiveRight&&s.inclusiveLeft?Tt(ee.to,r)>=0:Tt(ee.to,r)>0)||fe>=0&&(Z.marker.inclusiveRight&&s.inclusiveLeft?Tt(ee.from,i)<=0:Tt(ee.from,i)<0))return!0}}function wi(e){for(var t;t=ri(e);)e=t.find(-1,!0).line;return e}function Vr(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function Er(e){for(var t,r;t=zt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function cn(e,t){var r=mt(e,t),i=wi(r);return r==i?t:kt(i)}function xr(e,t){if(t>e.lastLine())return t;var r=mt(e,t),i;if(!rr(e,r))return t;for(;i=zt(r);)r=i.find(1,!0).line;return kt(r)+1}function rr(e,t){var r=li&&t.markedSpans;if(r)for(var i=void 0,s=0;s<r.length;++s){if(i=r[s],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fn(e,t,i))return!0}}function fn(e,t,r){if(r.to==null){var i=r.marker.find(1,!0);return fn(e,i.line,Mi(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var s=void 0,k=0;k<t.markedSpans.length;++k)if(s=t.markedSpans[k],s.marker.collapsed&&!s.marker.widgetNode&&s.from==r.to&&(s.to==null||s.to!=r.from)&&(s.marker.inclusiveLeft||r.marker.inclusiveRight)&&fn(e,t,s))return!0}function $i(e){e=wi(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var s=r.lines[i];if(s==e)break;t+=s.height}for(var k=r.parent;k;r=k,k=r.parent)for(var K=0;K<k.children.length;++K){var $=k.children[K];if($==r)break;t+=$.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,r,i=e;r=ri(i);){var s=r.find(0,!0);i=s.from.line,t+=s.from.ch-s.to.ch}for(i=e;r=zt(i);){var k=r.find(0,!0);t-=i.text.length-k.from.ch,i=k.to.line,t+=i.text.length-k.to.ch}return t}function jn(e){var t=e.display,r=e.doc;t.maxLine=mt(r,r.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,r.iter(function(i){var s=pn(i);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=i)})}var Dr=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};Dr.prototype.lineNo=function(){return kt(this)},Ee(Dr);function ua(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dn(e),br(e,r);var s=i?i(e):1;s!=e.height&&vi(e,s)}function vt(e){e.parent=null,dn(e)}var St={},bt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?bt:St;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var r=b("span",null,null,M?"padding-right: .1px":null),i={pre:b("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var k=s?t.rest[s-1]:t.line,K=void 0;i.pos=0,i.addToken=Nt,Ct(e.display.measure)&&(K=tt(k,e.doc.direction))&&(i.addToken=Ai(i.addToken,K)),i.map=[];var $=t!=e.display.externalMeasured&&kt(k);ur(k,i,He(e,k,$)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=B(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=B(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ft(e.display.measure))),s==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(M){var Z=i.content.lastChild;(/\bcm-tab\b/.test(Z.className)||Z.querySelector&&Z.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=B(i.pre.className,i.textClass||"")),i}function Vt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,i,s,k,K){if(!t)return;var $=e.splitSpaces?si(t,e.trailingSpace):t,Z=e.cm.state.specialChars,ee=!1,fe;if(!Z.test(t))e.col+=t.length,fe=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,fe),z&&W<9&&(ee=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var ge=0;;){Z.lastIndex=ge;var Ie=Z.exec(t),Re=Ie?Ie.index-ge:t.length-ge;if(Re){var je=document.createTextNode($.slice(ge,ge+Re));z&&W<9?fe.appendChild(o("span",[je])):fe.appendChild(je),e.map.push(e.pos,e.pos+Re,je),e.col+=Re,e.pos+=Re}if(!Ie)break;ge+=Re+1;var Ke=void 0;if(Ie[0]==" "){var Qe=e.cm.options.tabSize,nt=Qe-e.col%Qe;Ke=fe.appendChild(o("span",ue(nt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=nt}else Ie[0]=="\r"||Ie[0]==`
`?(Ke=fe.appendChild(o("span",Ie[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Ie[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Ie[0]),Ke.setAttribute("cm-text",Ie[0]),z&&W<9?fe.appendChild(o("span",[Ke])):fe.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,r||i||s||ee||k||K){var ot=r||"";i&&(ot+=i),s&&(ot+=s);var at=o("span",[fe],ot,k);if(K)for(var ht in K)K.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&at.setAttribute(ht,K[ht]);return e.content.appendChild(at)}e.content.appendChild(fe)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",s=0;s<e.length;s++){var k=e.charAt(s);k==" "&&r&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(k="\xA0"),i+=k,r=k==" "}return i}function Ai(e,t){return function(r,i,s,k,K,$,Z){s=s?s+" cm-force-border":"cm-force-border";for(var ee=r.pos,fe=ee+i.length;;){for(var ge=void 0,Ie=0;Ie<t.length&&!(ge=t[Ie],ge.to>ee&&ge.from<=ee);Ie++);if(ge.to>=fe)return e(r,i,s,k,K,$,Z);e(r,i.slice(0,ge.to-ee),s,k,null,$,Z),k=null,i=i.slice(ge.to-ee),ee=ge.to}}}function Pt(e,t,r,i){var s=!i&&r.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!i&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",r.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function ur(e,t,r){var i=e.markedSpans,s=e.text,k=0;if(!i){for(var K=1;K<r.length;K+=2)t.addToken(t,s.slice(k,k=r[K]),It(r[K+1],t.cm.options));return}for(var $=s.length,Z=0,ee=1,fe="",ge,Ie,Re=0,je,Ke,Qe,nt,ot;;){if(Re==Z){je=Ke=Qe=Ie="",ot=null,nt=null,Re=Infinity;for(var at=[],ht=void 0,Et=0;Et<i.length;++Et){var yt=i[Et],At=yt.marker;if(At.type=="bookmark"&&yt.from==Z&&At.widgetNode)at.push(At);else if(yt.from<=Z&&(yt.to==null||yt.to>Z||At.collapsed&&yt.to==Z&&yt.from==Z)){if(yt.to!=null&&yt.to!=Z&&Re>yt.to&&(Re=yt.to,Ke=""),At.className&&(je+=" "+At.className),At.css&&(Ie=(Ie?Ie+";":"")+At.css),At.startStyle&&yt.from==Z&&(Qe+=" "+At.startStyle),At.endStyle&&yt.to==Re&&(ht||(ht=[])).push(At.endStyle,yt.to),At.title&&((ot||(ot={})).title=At.title),At.attributes)for(var Xt in At.attributes)(ot||(ot={}))[Xt]=At.attributes[Xt];At.collapsed&&(!nt||pi(nt.marker,At)<0)&&(nt=yt)}else yt.from>Z&&Re>yt.from&&(Re=yt.from)}if(ht)for(var ci=0;ci<ht.length;ci+=2)ht[ci+1]==Re&&(Ke+=" "+ht[ci]);if(!nt||nt.from==Z)for(var Zt=0;Zt<at.length;++Zt)Pt(t,0,at[Zt]);if(nt&&(nt.from||0)==Z){if(Pt(t,(nt.to==null?$+1:nt.to)-Z,nt.marker,nt.from==null),nt.to==null)return;nt.to==Z&&(nt=!1)}}if(Z>=$)break;for(var Fi=Math.min($,Re);;){if(fe){var Ii=Z+fe.length;if(!nt){var ni=Ii>Fi?fe.slice(0,Fi-Z):fe;t.addToken(t,ni,ge?ge+je:je,Qe,Z+ni.length==Re?Ke:"",Ie,ot)}if(Ii>=Fi){fe=fe.slice(Fi-Z),Z=Fi;break}Z=Ii,Qe=""}fe=s.slice(k,k=r[ee++]),ge=It(r[ee++],t.cm.options)}}}function Wt(e,t,r){this.line=t,this.rest=Er(t),this.size=this.rest?kt(ie(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Oi(e,t,r){for(var i=[],s,k=t;k<r;k=s){var K=new Wt(e.doc,mt(e.doc,k),k);s=k+K.size,i.push(K)}return i}var bi=null;function Ki(e){bi?bi.ops.push(e):e.ownsGroup=bi={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var i=0;i<e.ops.length;i++){var s=e.ops[i];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Lo(r)}finally{bi=null,t(r)}}var mn=null;function mi(e,t){var r=dt(e,t);if(!r.length)return;var i=Array.prototype.slice.call(arguments,2),s;bi?s=bi.delayedCallbacks:mn?s=mn:(s=mn=[],setTimeout(ko,0));for(var k=function($){s.push(function(){return r[$].apply(null,i)})},K=0;K<r.length;++K)k(K)}function ko(){var e=mn;mn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,i){for(var s=0;s<t.changes.length;s++){var k=t.changes[s];k=="text"?Po(e,t):k=="gutter"?Qa(e,t,r,i):k=="class"?ha(e,t):k=="widget"&&Mo(e,t,i)}t.changes=null}function gn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),z&&W<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=gn(t);t.background=i.insertBefore(o("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Ft(e,t)}function Po(e,t){var r=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):r&&(t.text.className=r)}function ha(e,t){Do(e,t),t.line.wrapClass?gn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Qa(e,t,r,i){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 s=gn(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),s.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var K=gn(t),$=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable($),K.insertBefore($,t.text),t.line.gutterClass&&($.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=$.appendChild(o("div",fr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var ee=e.display.gutterSpecs[Z].className,fe=k.hasOwnProperty(ee)&&k[ee];fe&&$.appendChild(o("div",[fe],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ee]+"px; width: "+i.gutterWidth[ee]+"px"))}}}function Mo(e,t,r){t.alignable&&(t.alignable=null);for(var i=C("CodeMirror-linewidget"),s=t.node.firstChild,k=void 0;s;s=k)k=s.nextSibling,i.test(s.className)&&t.node.removeChild(s);Ja(e,t,r)}function No(e,t,r,i){var s=$a(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),ha(e,t),Qa(e,t,r,i),Ja(e,t,i),t.node}function Ja(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,r,!1)}function Za(e,t,r,i,s){if(!t.widgets)return;for(var k=gn(r),K=0,$=t.widgets;K<$.length;++K){var Z=$[K],ee=o("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Fo(Z,ee,r,i),e.display.input.setUneditable(ee),s&&Z.above?k.insertBefore(ee,r.gutter||r.text):k.appendChild(ee),mi(Z,"redraw")}}function Fo(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var s=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(s-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),_(t.display.measure,o("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function hr(e,t){for(var r=be(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Hn(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,o("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function nr(e){return oe-e.display.nativeBarWidth}function Pr(e){return e.display.scroller.clientWidth-nr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-nr(e)-e.display.barHeight}function Uo(e,t,r){var i=e.options.lineWrapping,s=i&&Pr(e);if(!t.measure.heights||i&&t.measure.width!=s){var k=t.measure.heights=[];if(i){t.measure.width=s;for(var K=t.text.firstChild.getClientRects(),$=0;$<K.length-1;$++){var Z=K[$],ee=K[$+1];Math.abs(Z.bottom-ee.bottom)>2&&k.push((Z.bottom+ee.top)/2-r.top)}}k.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var s=0;s<e.rest.length;s++)if(kt(e.rest[s])>r)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}function Bo(e,t){t=wi(t);var r=kt(t),i=e.display.externalMeasured=new Wt(e.doc,t,r);i.lineN=r;var s=i.built=Ft(e,i);return i.text=s.pre,_(e.display.lineMeasure,s.pre),i}function ts(e,t,r,i){return ar(e,Xr(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function Xr(e,t){var r=kt(t),i=fa(e,r);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,r,_a(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var s=es(i,t,r);return{line:t,view:i,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function ar(e,t,r,i,s){t.before&&(r=-1);var k=r+(i||""),K;return t.cache.hasOwnProperty(k)?K=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),K=Ho(e,t,r,i),K.bogus||(t.cache[k]=K)),{left:K.left,right:K.right,top:s?K.rtop:K.top,bottom:s?K.rbottom:K.bottom}}var is={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var i,s,k,K,$,Z,ee=0;ee<e.length;ee+=3)if($=e[ee],Z=e[ee+1],t<$?(s=0,k=1,K="left"):t<Z?(s=t-$,k=s+1):(ee==e.length-3||t==Z&&e[ee+3]>t)&&(k=Z-$,s=k-1,t>=Z&&(K="right")),s!=null){if(i=e[ee+2],$==Z&&r==(i.insertLeft?"left":"right")&&(K=r),r=="left"&&s==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],K="left";if(r=="right"&&s==Z-$)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)i=e[(ee+=3)+2],K="right";break}return{node:i,start:s,end:k,collapse:K,coverStart:$,coverEnd:Z}}function jo(e,t){var r=is;if(t=="left")for(var i=0;i<e.length&&!((r=e[i]).left!=r.right);i++);else for(var s=e.length-1;s>=0&&!((r=e[s]).left!=r.right);s--);return r}function Ho(e,t,r,i){var s=rs(t.map,r,i),k=s.node,K=s.start,$=s.end,Z=s.collapse,ee;if(k.nodeType==3){for(var fe=0;fe<4;fe++){for(;K&&De(t.line.text.charAt(s.coverStart+K));)--K;for(;s.coverStart+$<s.coverEnd&&De(t.line.text.charAt(s.coverStart+$));)++$;if(z&&W<9&&K==0&&$==s.coverEnd-s.coverStart?ee=k.parentNode.getBoundingClientRect():ee=jo(m(k,K,$).getClientRects(),i),ee.left||ee.right||K==0)break;$=K,K=K-1,Z="right"}z&&W<11&&(ee=Wo(e.display.measure,ee))}else{K>0&&(Z=i="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?ee=ge[i=="right"?ge.length-1:0]:ee=k.getBoundingClientRect()}if(z&&W<9&&!K&&(!ee||!ee.left&&!ee.right)){var Ie=k.parentNode.getClientRects()[0];Ie?ee={left:Ie.left,right:Ie.left+$r(e.display),top:Ie.top,bottom:Ie.bottom}:ee=is}for(var Re=ee.top-t.rect.top,je=ee.bottom-t.rect.top,Ke=(Re+je)/2,Qe=t.view.measure.heights,nt=0;nt<Qe.length-1&&!(Ke<Qe[nt]);nt++);var ot=nt?Qe[nt-1]:0,at=Qe[nt],ht={left:(Z=="right"?ee.right:ee.left)-t.rect.left,right:(Z=="left"?ee.left:ee.right)-t.rect.left,top:ot,bottom:at};return!ee.left&&!ee.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=Re,ht.rbottom=je),ht}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Jt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function ns(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function as(e){e.display.externalMeasure=null,x(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ns(e.display.view[t])}function yn(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return g&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=vn(e.widgets[r]));return t}function Wn(e,t,r,i,s){if(!s){var k=pa(t);r.top+=k,r.bottom+=k}if(i=="line")return r;i||(i="local");var K=$i(t);if(i=="local"?K+=Hn(e.display):K-=e.display.viewOffset,i=="page"||i=="window"){var $=e.display.lineSpace.getBoundingClientRect();K+=$.top+(i=="window"?0:os());var Z=$.left+(i=="window"?0:ss());r.left+=Z,r.right+=Z}return r.top+=K,r.bottom+=K,r}function ls(e,t,r){if(r=="div")return t;var i=t.left,s=t.top;if(r=="page")i-=ss(),s-=os();else if(r=="local"||!r){var k=e.display.sizer.getBoundingClientRect();i+=k.left,s+=k.top}var K=e.display.lineSpace.getBoundingClientRect();return{left:i-K.left,top:s-K.top}}function ma(e,t,r,i,s){return i||(i=mt(e.doc,t.line)),Wn(e,i,ts(e,i,t.ch,s),r)}function Qi(e,t,r,i,s,k){i=i||mt(e.doc,t.line),s||(s=Xr(e,i));function K(je,Ke){var Qe=ar(e,s,je,Ke?"right":"left",k);return Ke?Qe.left=Qe.right:Qe.right=Qe.left,Wn(e,i,Qe,r)}var $=tt(i,e.doc.direction),Z=t.ch,ee=t.sticky;if(Z>=i.text.length?(Z=i.text.length,ee="before"):Z<=0&&(Z=0,ee="after"),!$)return K(ee=="before"?Z-1:Z,ee=="before");function fe(je,Ke,Qe){var nt=$[Ke],ot=nt.level==1;return K(Qe?je-1:je,ot!=Qe)}var ge=$e($,Z,ee),Ie=Je,Re=fe(Z,ge,ee=="before");return Ie!=null&&(Re.other=fe(Z,Ie,ee!="before")),Re}function us(e,t){var r=0;t=y(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);var i=mt(e.doc,t.line),s=$i(i)+Hn(e.display);return{left:r,right:r,top:s,bottom:s+i.height}}function ga(e,t,r,i,s){var k=Ve(e,t,r);return k.xRel=s,i&&(k.outside=i),k}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var s=Bi(i,r),k=i.first+i.size-1;if(s>k)return ga(i.first+i.size-1,mt(i,k).text.length,null,1,1);t<0&&(t=0);for(var K=mt(i,s);;){var $=Go(e,K,s,t,r),Z=ir(K,$.ch+($.xRel>0||$.outside>0?1:0));if(!Z)return $;var ee=Z.find(1);if(ee.line==s)return ee;K=mt(i,s=ee.line)}}function hs(e,t,r,i){i-=pa(t);var s=t.text.length,k=Xe(function(K){return ar(e,r,K-1).bottom<=i},s,0);return s=Xe(function(K){return ar(e,r,K).top>i},k,s),{begin:k,end:s}}function ds(e,t,r,i){r||(r=Xr(e,t));var s=Wn(e,t,ar(e,r,i),"line").top;return hs(e,t,r,s)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,s){s-=$i(t);var k=Xr(e,t),K=pa(t),$=0,Z=t.text.length,ee=!0,fe=tt(t,e.doc.direction);if(fe){var ge=(e.options.lineWrapping?Ko:zo)(e,t,r,k,fe,i,s);ee=ge.level!=1,$=ee?ge.from:ge.to-1,Z=ee?ge.to:ge.from-1}var Ie=null,Re=null,je=Xe(function(Et){var yt=ar(e,k,Et);return yt.top+=K,yt.bottom+=K,ya(yt,i,s,!1)?(yt.top<=s&&yt.left<=i&&(Ie=Et,Re=yt),!0):!1},$,Z),Ke,Qe,nt=!1;if(Re){var ot=i-Re.left<Re.right-i,at=ot==ee;je=Ie+(at?0:1),Qe=at?"after":"before",Ke=ot?Re.left:Re.right}else{!ee&&(je==Z||je==$)&&je++,Qe=je==0?"after":je==t.text.length?"before":ar(e,k,je-(ee?1:0)).bottom+K<=s==ee?"after":"before";var ht=Qi(e,Ve(r,je,Qe),"line",t,k);Ke=ht.left,nt=s<ht.top?-1:s>=ht.bottom?1:0}return je=Ne(t.text,je,1),ga(r,je,Qe,nt,i-Ke)}function zo(e,t,r,i,s,k,K){var $=Xe(function(ge){var Ie=s[ge],Re=Ie.level!=1;return ya(Qi(e,Ve(r,Re?Ie.to:Ie.from,Re?"before":"after"),"line",t,i),k,K,!0)},0,s.length-1),Z=s[$];if($>0){var ee=Z.level!=1,fe=Qi(e,Ve(r,ee?Z.from:Z.to,ee?"after":"before"),"line",t,i);ya(fe,k,K,!0)&&fe.top>K&&(Z=s[$-1])}return Z}function Ko(e,t,r,i,s,k,K){var $=hs(e,t,i,K),Z=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var fe=null,ge=null,Ie=0;Ie<s.length;Ie++){var Re=s[Ie];if(Re.from>=ee||Re.to<=Z)continue;var je=Re.level!=1,Ke=ar(e,i,je?Math.min(ee,Re.to)-1:Math.max(Z,Re.from)).right,Qe=Ke<k?k-Ke+1e9:Ke-k;(!fe||ge>Qe)&&(fe=Re,ge=Qe)}return fe||(fe=s[s.length-1]),fe.from<Z&&(fe={from:Z,to:fe.to,level:fe.level}),fe.to>ee&&(fe={from:fe.from,to:ee,level:fe.level}),fe}var Mr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mr==null){Mr=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mr.appendChild(document.createTextNode("x")),Mr.appendChild(o("br"));Mr.appendChild(document.createTextNode("x"))}_(e.measure,Mr);var r=Mr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),x(e.measure),r||1}function $r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),r=o("pre",[t],"CodeMirror-line-like");_(e.measure,r);var i=t.getBoundingClientRect(),s=(i.right-i.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function _a(e){for(var t=e.display,r={},i={},s=t.gutters.clientLeft,k=t.gutters.firstChild,K=0;k;k=k.nextSibling,++K){var $=e.display.gutterSpecs[K].className;r[$]=k.offsetLeft+k.clientLeft+s,i[$]=k.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Yr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/$r(e.display)-3);return function(s){if(rr(e.doc,s))return 0;var k=0;if(s.widgets)for(var K=0;K<s.widgets.length;K++)s.widgets[K].height&&(k+=s.widgets[K].height);return r?k+(Math.ceil(s.text.length/i)||1)*t:k+t}}function Ea(e){var t=e.doc,r=cs(e);t.iter(function(i){var s=r(i);s!=i.height&&vi(i,s)})}function Nr(e,t,r,i){var s=e.display;if(!r&&be(t).getAttribute("cm-not-content")=="true")return null;var k,K,$=s.lineSpace.getBoundingClientRect();try{k=t.clientX-$.left,K=t.clientY-$.top}catch(ge){return null}var Z=va(e,k,K),ee;if(i&&Z.xRel>0&&(ee=mt(e.doc,Z.line).text).length==Z.ch){var fe=G(ee,ee.length,e.options.tabSize)-ee.length;Z=Ve(Z.line,Math.max(0,Math.round((k-qa(e.display).left)/$r(e.display))-fe))}return Z}function Fr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function Ri(e,t,r,i){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),i||(i=0);var s=e.display;if(i&&r<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)li&&cn(e.doc,t)<s.viewTo&&wr(e);else if(r<=s.viewFrom)li&&xr(e.doc,r+i)>s.viewFrom?wr(e):(s.viewFrom+=i,s.viewTo+=i);else if(t<=s.viewFrom&&r>=s.viewTo)wr(e);else if(t<=s.viewFrom){var k=Gn(e,r,r+i,1);k?(s.view=s.view.slice(k.index),s.viewFrom=k.lineN,s.viewTo+=i):wr(e)}else if(r>=s.viewTo){var K=Gn(e,t,t,-1);K?(s.view=s.view.slice(0,K.index),s.viewTo=K.lineN):wr(e)}else{var $=Gn(e,t,t,-1),Z=Gn(e,r,r+i,1);$&&Z?(s.view=s.view.slice(0,$.index).concat(Oi(e,$.lineN,Z.lineN)).concat(s.view.slice(Z.index)),s.viewTo+=i):wr(e)}var ee=s.externalMeasured;ee&&(r<ee.lineN?ee.lineN+=i:t<ee.lineN+ee.size&&(s.externalMeasured=null))}function Tr(e,t,r){e.curOp.viewChanged=!0;var i=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var k=i.view[Fr(e,t)];if(k.node==null)return;var K=k.changes||(k.changes=[]);re(K,r)==-1&&K.push(r)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,r,i){var s=Fr(e,t),k,K=e.display.view;if(!li||r==e.doc.first+e.doc.size)return{index:s,lineN:r};for(var $=e.display.viewFrom,Z=0;Z<s;Z++)$+=K[Z].size;if($!=t){if(i>0){if(s==K.length-1)return null;k=$+K[s].size-t,s++}else k=$-t;t+=k,r+=k}for(;cn(e.doc,r)!=r;){if(s==(i<0?0:K.length-1))return null;r+=i*K[s-(i<0?1:0)].size,s+=i}return{index:s,lineN:r}}function Vo(e,t,r){var i=e.display,s=i.view;s.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Oi(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Oi(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Fr(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(Oi(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,Fr(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var s=t[i];!s.hidden&&(!s.node||s.changes)&&++r}return r}function _n(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,i={},s=i.cursors=document.createDocumentFragment(),k=i.selection=document.createDocumentFragment(),K=0;K<r.sel.ranges.length;K++){if(!t&&K==r.sel.primIndex)continue;var $=r.sel.ranges[K];if($.from().line>=e.display.viewTo||$.to().line<e.display.viewFrom)continue;var Z=$.empty();(Z||e.options.showCursorWhenSelecting)&&ms(e,$.head,s),Z||Xo(e,$,k)}return i}function ms(e,t,r){var i=Qi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=r.appendChild(o("div","\xA0","CodeMirror-cursor"));if(s.style.left=i.left+"px",s.style.top=i.top+"px",s.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var k=r.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=i.other.left+"px",k.style.top=i.other.top+"px",k.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var i=e.display,s=e.doc,k=document.createDocumentFragment(),K=qa(e.display),$=K.left,Z=Math.max(i.sizerWidth,Pr(e)-i.sizer.offsetLeft)-K.right,ee=s.direction=="ltr";function fe(at,ht,Et,yt){ht<0&&(ht=0),ht=Math.round(ht),yt=Math.round(yt),k.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+at+`px;
top: `+ht+"px; width: "+(Et==null?Z-at:Et)+`px;
height: `+(yt-ht)+"px"))}function ge(at,ht,Et){var yt=mt(s,at),At=yt.text.length,Xt,ci;function Zt(ni,ki){return ma(e,Ve(at,ni),"div",yt,ki)}function Fi(ni,ki,gi){var oi=ds(e,yt,null,ni),ai=ki=="ltr"==(gi=="after")?"left":"right",ei=gi=="after"?oi.begin:oi.end-(/\s/.test(yt.text.charAt(oi.end-1))?2:1);return Zt(ei,ai)[ai]}var Ii=tt(yt,s.direction);return Ze(Ii,ht||0,Et==null?At:Et,function(ni,ki,gi,oi){var ai=gi=="ltr",ei=Zt(ni,ai?"left":"right"),Di=Zt(ki-1,ai?"right":"left"),un=ht==null&&ni==0,Lr=Et==null&&ki==At,xi=oi==0,sr=!Ii||oi==Ii.length-1;if(Di.top-ei.top<=3){var fi=(ee?un:Lr)&&xi,Va=(ee?Lr:un)&&sr,cr=fi?$:(ai?ei:Di).left,Wr=Va?Z:(ai?Di:ei).right;fe(cr,ei.top,Wr-cr,ei.bottom)}else{var Gr,Ci,hn,Xa;ai?(Gr=ee&&un&&xi?$:ei.left,Ci=ee?Z:Fi(ni,gi,"before"),hn=ee?$:Fi(ki,gi,"after"),Xa=ee&&Lr&&sr?Z:Di.right):(Gr=ee?Fi(ni,gi,"before"):$,Ci=!ee&&un&&xi?Z:ei.right,hn=!ee&&Lr&&sr?$:Di.left,Xa=ee?Fi(ki,gi,"after"):Z),fe(Gr,ei.top,Ci-Gr,ei.bottom),ei.bottom<Di.top&&fe($,ei.bottom,null,Di.top),fe(hn,Di.top,Xa-hn,Di.bottom)}(!Xt||zn(ei,Xt)<0)&&(Xt=ei),zn(Di,Xt)<0&&(Xt=Di),(!ci||zn(ei,ci)<0)&&(ci=ei),zn(Di,ci)<0&&(ci=Di)}),{start:Xt,end:ci}}var Ie=t.from(),Re=t.to();if(Ie.line==Re.line)ge(Ie.line,Ie.ch,Re.ch);else{var je=mt(s,Ie.line),Ke=mt(s,Re.line),Qe=wi(je)==wi(Ke),nt=ge(Ie.line,Ie.ch,Qe?je.text.length+1:null).end,ot=ge(Re.line,Qe?0:null,Re.ch).start;Qe&&(nt.top<ot.top-2?(fe(nt.right,nt.top,null,nt.bottom),fe($,ot.top,ot.left,ot.bottom)):fe(nt.right,nt.top,ot.left-nt.right,nt.bottom)),nt.bottom<ot.top&&fe($,nt.bottom,null,ot.top)}r.appendChild(k)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Qr(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,w(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var s=t.view[i],k=e.options.lineWrapping,K=void 0,$=0;if(s.hidden)continue;if(z&&W<8){var Z=s.node.offsetTop+s.node.offsetHeight;K=Z-r,r=Z}else{var ee=s.node.getBoundingClientRect();K=ee.bottom-ee.top,!k&&s.text.firstChild&&($=s.text.firstChild.getBoundingClientRect().right-ee.left-1)}var fe=s.line.height-K;if((fe>.005||fe<-.005)&&(vi(s.line,K),ys(s.line),s.rest))for(var ge=0;ge<s.rest.length;ge++)ys(s.rest[ge]);if($>e.display.sizerWidth){var Ie=Math.ceil($/$r(e.display));Ie>e.display.maxLineLength&&(e.display.maxLineLength=Ie,e.display.maxLine=s.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Vn(e,t,r){var i=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-Hn(e));var s=r&&r.bottom!=null?r.bottom:i+e.wrapper.clientHeight,k=Bi(t,i),K=Bi(t,s);if(r&&r.ensure){var $=r.ensure.from.line,Z=r.ensure.to.line;$<k?(k=$,K=Bi(t,$i(mt(t,$))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=K&&(k=Bi(t,$i(mt(t,Z))-e.wrapper.clientHeight),K=Z)}return{from:k,to:Math.max(K,k+1)}}function Yo(e,t){if(ze(e,"scrollCursorIntoView"))return;var r=e.display,i=r.sizer.getBoundingClientRect(),s=null;if(t.top+i.top<0?s=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(s=!1),s!=null&&!n){var k=o("div","\u200B",null,`position: absolute;
top: `+(t.top-r.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+nr(e)+r.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(s),e.display.lineSpace.removeChild(k)}}function $o(e,t,r,i){i==null&&(i=0);var s;!e.options.lineWrapping&&t==r&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var K=!1,$=Qi(e,t),Z=!r||r==t?$:Qi(e,r);s={left:Math.min($.left,Z.left),top:Math.min($.top,Z.top)-i,right:Math.max($.left,Z.left),bottom:Math.max($.bottom,Z.bottom)+i};var ee=wa(e,s),fe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(En(e,ee.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(K=!0)),ee.scrollLeft!=null&&(Ur(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(K=!0)),!K)break}return s}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&En(e,r.scrollTop),r.scrollLeft!=null&&Ur(e,r.scrollLeft)}function wa(e,t){var r=e.display,i=Yr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ca(e),K={};t.bottom-t.top>k&&(t.bottom=t.top+k);var $=e.doc.height+da(r),Z=t.top<i,ee=t.bottom>$-i;if(t.top<s)K.scrollTop=Z?0:t.top;else if(t.bottom>s+k){var fe=Math.min(t.top,(ee?$:t.bottom)-k);fe!=s&&(K.scrollTop=fe)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Ie=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Re=Pr(e)-r.gutters.offsetWidth,je=t.right-t.left>Re;return je&&(t.right=t.left+Re),t.left<10?K.scrollLeft=0:t.left<Ie?K.scrollLeft=Math.max(0,t.left+ge-(je?0:10)):t.right>Re+Ie-3&&(K.scrollLeft=t.right+(je?0:10)-Re),K}function Sa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Jr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Jo(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);_s(e,r,i,t.margin)}}function _s(e,t,r,i){var s=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});bn(e,s.scrollLeft,s.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Aa(e,{top:t}),bs(e,t,!0),P&&Aa(e),wn(e,100)}function bs(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ur(e,t,r,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xn(e){var t=e.display,r=t.gutters.offsetWidth,i=Math.round(e.doc.height+da(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:i,scrollHeight:i+nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Br=function(e,t,r){this.cm=r;var i=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=s.tabIndex=-1,e(i),e(s),Ue(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ue(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var s=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:t?i:0}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=u&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Br.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var s=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Zr(e,t){t||(t=xn(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var s=0;s<4&&r!=e.display.barWidth||i!=e.display.barHeight;s++)r!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),Es(e,xn(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Br,null:Tn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&w(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?Ur(e,t):En(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function jr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zo},Ki(e.curOp)}function Hr(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var i=0;i<t.length;i++)tl(t[i]);for(var s=0;s<t.length;s++)il(t[s]);for(var k=0;k<t.length;k++)rl(t[k]);for(var K=0;K<t.length;K++)nl(t[K])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,r=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=xn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Pr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ur(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Zr(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function nl(e){var t=e.cm,r=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ur(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=$o(t,y(i,e.scrollToPos.from),y(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,s)}var k=e.maybeHiddenMarkers,K=e.maybeUnhiddenMarkers;if(k)for(var $=0;$<k.length;++$)k[$].lines.length||Me(k[$],"hide");if(K)for(var Z=0;Z<K.length;++Z)K[Z].lines.length&&Me(K[Z],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ni(e,t){if(e.curOp)return t();jr(e);try{return t()}finally{Hr(e)}}function hi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);jr(e);try{return t.apply(e,arguments)}finally{Hr(e)}}}function Si(e){return function(){if(this.curOp)return e.apply(this,arguments);jr(this);try{return e.apply(this,arguments)}finally{Hr(this)}}}function di(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);jr(t);try{return e.apply(this,arguments)}finally{Hr(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=et(e,t.highlightFrontier),s=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var K=k.styles,$=k.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,Z=ye(e,k,i,!0);$&&(i.state=$),k.styles=Z.styles;var ee=k.styleClasses,fe=Z.classes;fe?k.styleClasses=fe:ee&&(k.styleClasses=null);for(var ge=!K||K.length!=k.styles.length||ee!=fe&&(!ee||!fe||ee.bgClass!=fe.bgClass||ee.textClass!=fe.textClass),Ie=0;!ge&&Ie<K.length;++Ie)ge=K[Ie]!=k.styles[Ie];ge&&s.push(i.line),k.stateAfter=i.save(),i.nextLine()}else k.text.length<=e.options.maxHighlightLength&&gt(e,k.text,i),k.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),s.length&&Ni(e,function(){for(var k=0;k<s.length;k++)Tr(e,s[k],"text")})}var Yn=function(e,t,r){var i=e.display;this.viewport=t,this.visible=Vn(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Pr(e),this.force=r,this.dims=_a(e),this.events=[]};Yn.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Me.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=nr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=nr(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=N();if(!t||!E(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&E(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}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(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return wr(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&(wr(e),t.dims=_a(e));var s=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),K=Math.min(s,t.visible.to+e.options.viewportMargin);r.viewFrom<k&&k-r.viewFrom<20&&(k=Math.max(i.first,r.viewFrom)),r.viewTo>K&&r.viewTo-K<20&&(K=Math.min(s,r.viewTo)),li&&(k=cn(e.doc,k),K=xr(e.doc,K));var $=k!=r.viewFrom||K!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,k,K),r.viewOffset=$i(mt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var Z=fs(e);if(!$&&Z==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=ol(e);return Z>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),Z>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),x(r.cursorDiv),x(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,$&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,wn(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vn(e.display,e.doc,r));if(!Ca(e,t))break;Kn(e);var s=xn(e);_n(e),Zr(e,s),Ra(e,s),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var r=new Yn(e,t);if(Ca(e,r)){Kn(e),ws(e,r);var i=xn(e);_n(e),Zr(e,i),Ra(e,i),r.finish()}}function ul(e,t,r){var i=e.display,s=e.options.lineNumbers,k=i.lineDiv,K=k.firstChild;function $(je){var Ke=je.nextSibling;return M&&u&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ke}for(var Z=i.view,ee=i.viewFrom,fe=0;fe<Z.length;fe++){var ge=Z[fe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=k){var Ie=No(e,ge,ee,r);k.insertBefore(Ie,K)}else{for(;K!=ge.node;)K=$(K);var Re=s&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(re(ge.changes,"gutter")>-1&&(Re=!1),Ya(e,ge,ee,r)),Re&&(x(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fr(e.options,ee)))),K=ge.node.nextSibling}ee+=ge.size}for(;K;)K=$(K)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+nr(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,k=i+"px",K=0;K<r.length;K++)if(!r[K].hidden){e.options.fixedGutter&&(r[K].gutter&&(r[K].gutter.style.left=k),r[K].gutterBackground&&(r[K].gutterBackground.style.left=k));var $=r[K].alignable;if($)for(var Z=0;Z<$.length;Z++)$[Z].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=i+s+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=fr(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var s=i.measure.appendChild(o("div",[o("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=s.firstChild.offsetWidth,K=s.offsetWidth-k;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(k,i.lineGutter.offsetWidth-K)+1,i.lineNumWidth=i.lineNumInnerWidth+K,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Oa(e.display),!0}return!1}function La(e,t){for(var r=[],i=!1,s=0;s<e.length;s++){var k=e[s],K=null;if(typeof k!="string"&&(K=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)i=!0;else continue;r.push({className:k,style:K})}return t&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;x(t),e.lineGutter=null;for(var i=0;i<r.length;++i){var s=r[i],k=s.className,K=s.style,$=t.appendChild(o("div",null,"CodeMirror-gutter "+k));K&&($.style.cssText=K),k=="CodeMirror-linenumbers"&&(e.lineGutter=$,$.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Oa(e)}function Sn(e){As(e.display),Ri(e),Ss(e)}function hl(e,t,r,i){var s=this;this.input=r,s.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=b("div",null,"CodeMirror-code"),s.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=o("div",null,"CodeMirror-cursors"),s.measure=o("div",null,"CodeMirror-measure"),s.lineMeasure=o("div",null,"CodeMirror-measure"),s.lineSpace=b("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var k=b("div",[s.lineSpace],"CodeMirror-lines");s.mover=o("div",[k],null,"position: relative"),s.sizer=o("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=o("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),s.gutters=o("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=o("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=o("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),z&&W<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!M&&!(P&&a)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=La(i.gutters,i.lineNumbers),As(s),r.init(s)}var $n=0,Hi=null;z?Hi=-.53:P?Hi=15:g?Hi=-.7:f&&(Hi=-1/3);function Os(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function dl(e){var t=Os(e);return t.x*=Hi,t.y*=Hi,t}function Rs(e,t){var r=Os(t),i=r.x,s=r.y,k=e.display,K=k.scroller,$=K.scrollWidth>K.clientWidth,Z=K.scrollHeight>K.clientHeight;if(!(i&&$||s&&Z))return;if(s&&u&&M){e:for(var ee=t.target,fe=k.view;ee!=K;ee=ee.parentNode)for(var ge=0;ge<fe.length;ge++)if(fe[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(i&&!P&&!p&&Hi!=null){s&&Z&&En(e,Math.max(0,K.scrollTop+s*Hi)),Ur(e,Math.max(0,K.scrollLeft+i*Hi)),(!s||s&&Z)&&te(t),k.wheelStartX=null;return}if(s&&Hi!=null){var Ie=s*Hi,Re=e.doc.scrollTop,je=Re+k.wrapper.clientHeight;Ie<0?Re=Math.max(0,Re+Ie-50):je=Math.min(e.doc.height,je+Ie+50),Aa(e,{top:Re,bottom:je})}$n<20&&(k.wheelStartX==null?(k.wheelStartX=K.scrollLeft,k.wheelStartY=K.scrollTop,k.wheelDX=i,k.wheelDY=s,setTimeout(function(){if(k.wheelStartX==null)return;var Ke=K.scrollLeft-k.wheelStartX,Qe=K.scrollTop-k.wheelStartY,nt=Qe&&k.wheelDY&&Qe/k.wheelDY||Ke&&k.wheelDX&&Ke/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!nt)return;Hi=(Hi*$n+nt)/($n+1),++$n},200)):(k.wheelDX+=i,k.wheelDY+=s))}var Wi=function(e,t){this.ranges=e,this.primIndex=t};Wi.prototype.primary=function(){return this.ranges[this.primIndex]},Wi.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],i=e.ranges[t];if(!pr(r.anchor,i.anchor)||!pr(r.head,i.head))return!1}return!0},Wi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Gt(mr(this.ranges[t].anchor),mr(this.ranges[t].head));return new Wi(e,this.primIndex)},Wi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(Tt(t,i.from())>=0&&Tt(e,i.to())<=0)return r}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return vr(this.anchor,this.head)},Gt.prototype.to=function(){return gr(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ji(e,t,r){var i=e&&e.options.selectionsMayTouch,s=t[r];t.sort(function(Ie,Re){return Tt(Ie.from(),Re.from())}),r=re(t,s);for(var k=1;k<t.length;k++){var K=t[k],$=t[k-1],Z=Tt($.to(),K.from());if(i&&!K.empty()?Z>0:Z>=0){var ee=vr($.from(),K.from()),fe=gr($.to(),K.to()),ge=$.empty()?K.from()==K.head:$.from()==$.head;k<=r&&--r,t.splice(--k,2,new Gt(ge?fe:ee,ge?ee:fe))}}return new Wi(t,r)}function Sr(e,t){return new Wi([new Gt(e,t||e)],0)}function Cr(e){return e.text?Ve(e.from.line+e.text.length-1,ie(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Cr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Cr(t).ch-t.to.ch),Ve(r,i)}function Ia(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var s=e.sel.ranges[i];r.push(new Gt(Ls(s.anchor,t),Ls(s.head,t)))}return Ji(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Ve(r.line,e.ch-t.ch+r.ch):Ve(r.line+(e.line-t.line),e.ch)}function cl(e,t,r){for(var i=[],s=Ve(e.first,0),k=s,K=0;K<t.length;K++){var $=t[K],Z=Is($.from,s,k),ee=Is(Cr($),s,k);if(s=$.to,k=ee,r=="around"){var fe=e.sel.ranges[K],ge=Tt(fe.head,fe.anchor)<0;i[K]=new Gt(ge?ee:Z,ge?Z:ee)}else i[K]=new Gt(Z,Z)}return new Wi(i,e.sel.primIndex)}function ka(e){e.doc.mode=wt(e.options,e.doc.modeOption),Cn(e)}function Cn(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,wn(e,100),e.state.modeGen++,e.curOp&&Ri(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&ie(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,r,i){function s(ot){return r?r[ot]:null}function k(ot,at,ht){ua(ot,at,ht,i),mi(ot,"change",ot,t)}function K(ot,at){for(var ht=[],Et=ot;Et<at;++Et)ht.push(new Dr(ee[Et],s(Et),i));return ht}var $=t.from,Z=t.to,ee=t.text,fe=mt(e,$.line),ge=mt(e,Z.line),Ie=ie(ee),Re=s(ee.length-1),je=Z.line-$.line;if(t.full)e.insert(0,K(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(ks(e,t)){var Ke=K(0,ee.length-1);k(ge,ge.text,Re),je&&e.remove($.line,je),Ke.length&&e.insert($.line,Ke)}else if(fe==ge)if(ee.length==1)k(fe,fe.text.slice(0,$.ch)+Ie+fe.text.slice(Z.ch),Re);else{var Qe=K(1,ee.length-1);Qe.push(new Dr(Ie+fe.text.slice(Z.ch),Re,i)),k(fe,fe.text.slice(0,$.ch)+ee[0],s(0)),e.insert($.line+1,Qe)}else if(ee.length==1)k(fe,fe.text.slice(0,$.ch)+ee[0]+ge.text.slice(Z.ch),s(0)),e.remove($.line+1,je);else{k(fe,fe.text.slice(0,$.ch)+ee[0],s(0)),k(ge,Ie+ge.text.slice(Z.ch),Re);var nt=K(1,ee.length-1);je>1&&e.remove($.line+1,je-1),e.insert($.line+1,nt)}mi(e,"change",e,t)}function Ar(e,t,r){function i(s,k,K){if(s.linked)for(var $=0;$<s.linked.length;++$){var Z=s.linked[$];if(Z.doc==k)continue;var ee=K&&Z.sharedHist;if(r&&!ee)continue;t(Z.doc,ee),i(Z.doc,s,ee)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ps(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Ri(e)}function Ps(e){(e.doc.direction=="rtl"?D:w)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ni(e,function(){Ps(e),Ri(e)})}function Qn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Pa(e,t){var r={from:mr(t.from),to:Cr(t),text:Gi(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Ar(e,function(i){return Fs(i,r,t.from.line,t.to.line+1)},!0),r}function Ms(e){for(;e.length;){var t=ie(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),ie(e.done);if(e.done.length&&!ie(e.done).ranges)return ie(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ie(e.done)}function Ns(e,t,r,i){var s=e.history;s.undone.length=0;var k=+new Date,K,$;if((s.lastOp==i||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(K=pl(s,s.lastOp==i)))$=ie(K.changes),Tt(t.from,t.to)==0&&Tt(t.from,$.to)==0?$.to=Cr(t):K.changes.push(Pa(e,t));else{var Z=ie(s.done);for((!Z||!Z.ranges)&&Jn(e.sel,s.done),K={changes:[Pa(e,t)],generation:s.generation},s.done.push(K);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(r),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=k,s.lastOp=s.lastSelOp=i,s.lastOrigin=s.lastSelOrigin=t.origin,$||Me(e,"historyAdded")}function ml(e,t,r,i){var s=t.charAt(0);return s=="*"||s=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var s=e.history,k=i&&i.origin;r==s.lastSelOp||k&&s.lastSelOrigin==k&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==k||ml(e,k,ie(s.done),t))?s.done[s.done.length-1]=t:Jn(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=k,s.lastSelOp=r,i&&i.clearRedo!==!1&&Ms(s.undone)}function Jn(e,t){var r=ie(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var s=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(K){K.markedSpans&&((s||(s=t["spans_"+e.id]={}))[k]=K.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var i=[],s=0;s<t.text.length;++s)i.push(vl(r[s]));return i}function Us(e,t){var r=yl(e,t),i=Yi(e,t);if(!r)return i;if(!i)return r;for(var s=0;s<r.length;++s){var k=r[s],K=i[s];if(k&&K){e:for(var $=0;$<K.length;++$){for(var Z=K[$],ee=0;ee<k.length;++ee)if(k[ee].marker==Z.marker)continue e;k.push(Z)}}else K&&(r[s]=K)}return r}function qr(e,t,r){for(var i=[],s=0;s<e.length;++s){var k=e[s];if(k.ranges){i.push(r?Wi.prototype.deepCopy.call(k):k);continue}var K=k.changes,$=[];i.push({changes:$});for(var Z=0;Z<K.length;++Z){var ee=K[Z],fe=void 0;if($.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(fe=ge.match(/^spans_(\d+)$/))&&(re(t,Number(fe[1]))>-1&&(ie($)[ge]=ee[ge],delete ee[ge]))}}return i}function Ma(e,t,r,i){if(i){var s=e.anchor;if(r){var k=Tt(t,s)<0;k!=Tt(r,s)<0?(s=t,t=r):k!=Tt(t,r)<0&&(t=r)}return new Gt(s,t)}else return new Gt(r||t,t)}function Zn(e,t,r,i,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new Wi([Ma(e.sel.primary(),t,r,s)],0),i)}function Bs(e,t,r){for(var i=[],s=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)i[k]=Ma(e.sel.ranges[k],t[k],null,s);var K=Ji(e.cm,i,e.sel.primIndex);Ei(e,K,r)}function Na(e,t,r,i){var s=e.sel.ranges.slice(0);s[t]=r,Ei(e,Ji(e.cm,s,e.sel.primIndex),i)}function js(e,t,r,i){Ei(e,Sr(t,r),i)}function _l(e,t,r){var i={ranges:t.ranges,update:function(s){this.ranges=[];for(var k=0;k<s.length;k++)this.ranges[k]=new Gt(y(e,s[k].anchor),y(e,s[k].head))},origin:r&&r.origin};return Me(e,"beforeSelectionChange",e,i),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Ji(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,r){var i=e.history.done,s=ie(i);s&&s.ranges?(i[i.length-1]=t,qn(e,t,r)):Ei(e,t,r)}function Ei(e,t,r){qn(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function qn(e,t,r){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,r));var i=r&&r.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(r&&r.scroll===!1)&&e.cm&&Jr(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ce(e.cm)),mi(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,r,i){for(var s,k=0;k<t.ranges.length;k++){var K=t.ranges[k],$=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Z=ea(e,K.anchor,$&&$.anchor,r,i),ee=ea(e,K.head,$&&$.head,r,i);(s||Z!=K.anchor||ee!=K.head)&&(s||(s=t.ranges.slice(0,k)),s[k]=new Gt(Z,ee))}return s?Ji(e.cm,s,t.primIndex):t}function en(e,t,r,i,s){var k=mt(e,t.line);if(k.markedSpans)for(var K=0;K<k.markedSpans.length;++K){var $=k.markedSpans[K],Z=$.marker,ee="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,fe="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if(($.from==null||(ee?$.from<=t.ch:$.from<t.ch))&&($.to==null||(fe?$.to>=t.ch:$.to>t.ch))){if(s&&(Me(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(k.markedSpans){--K;continue}else break;if(!Z.atomic)continue;if(r){var ge=Z.find(i<0?1:-1),Ie=void 0;if((i<0?fe:ee)&&(ge=Ks(e,ge,-i,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(Ie=Tt(ge,r))&&(i<0?Ie<0:Ie>0))return en(e,ge,t,i,s)}var Re=Z.find(i<0?-1:1);return(i<0?ee:fe)&&(Re=Ks(e,Re,i,Re.line==t.line?k:null)),Re?en(e,Re,t,i,s):null}}return t}function ea(e,t,r,i,s){var k=i||1,K=en(e,t,r,k,s)||!s&&en(e,t,r,k,!0)||en(e,t,r,-k,s)||!s&&en(e,t,r,-k,!0);return K||(e.cantEdit=!0,Ve(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?y(e,Ve(t.line-1)):null:r>0&&t.ch==(i||mt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+r)}function Vs(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),pe)}function Xs(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(s,k,K,$){s&&(i.from=y(e,s)),k&&(i.to=y(e,k)),K&&(i.text=K),$!==void 0&&(i.origin=$)}),Me(e,"beforeChange",e,i),e.cm&&Me(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function tn(e,t,r){if(e.cm){if(!e.cm.curOp)return hi(e.cm,tn)(e,t,r);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=Ir&&!r&&_r(e,t.from,t.to);if(i)for(var s=i.length-1;s>=0;--s)Ys(e,{from:i[s].from,to:i[s].to,text:s?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),An(e,t,r,Yi(e,t));var i=[];Ar(e,function(s,k){!k&&re(i,s.history)==-1&&(Zs(s.history,t),i.push(s.history)),An(s,t,null,Yi(s,t))})}function ta(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var s=e.history,k,K=e.sel,$=t=="undo"?s.done:s.undone,Z=t=="undo"?s.undone:s.done,ee=0;ee<$.length&&!(k=$[ee],r?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==$.length)return;for(s.lastOrigin=s.lastSelOrigin=null;;)if(k=$.pop(),k.ranges){if(Jn(k,Z),r&&!k.equals(e.sel)){Ei(e,k,{clearRedo:!1});return}K=k}else if(i){$.push(k);return}else break;var fe=[];Jn(K,Z),Z.push({changes:fe,generation:s.generation}),s.generation=k.generation||++s.maxGeneration;for(var ge=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),Ie=function(Ke){var Qe=k.changes[Ke];if(Qe.origin=t,ge&&!Xs(e,Qe,!1))return $.length=0,{};fe.push(Pa(e,Qe));var nt=Ke?Ia(e,Qe):ie($);An(e,Qe,nt,Us(e,Qe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Qe.from,to:Cr(Qe)});var ot=[];Ar(e,function(at,ht){!ht&&re(ot,at.history)==-1&&(Zs(at.history,Qe),ot.push(at.history)),An(at,Qe,null,Us(at,Qe))})},Re=k.changes.length-1;Re>=0;--Re){var je=Ie(Re);if(je)return je.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wi(de(e.sel.ranges,function(s){return new Gt(Ve(s.anchor.line+t,s.anchor.ch),Ve(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm){Ri(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)Tr(e.cm,i,"gutter")}}function An(e,t,r,i){if(e.cm&&!e.cm.curOp)return hi(e.cm,An)(e,t,r,i);if(t.to.line<e.first){$s(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var s=t.text.length-1-(e.first-t.from.line);$s(e,s),t={from:Ve(e.first,0),to:Ve(t.to.line+s,t.to.ch),text:[ie(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Ve(k,mt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gi(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),qn(e,r,pe),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var i=e.doc,s=e.display,k=t.from,K=t.to,$=!1,Z=k.line;e.options.lineWrapping||(Z=kt(wi(mt(i,k.line))),i.iter(Z,K.line+1,function(Re){if(Re==s.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Ce(e),Da(i,t,r,cs(e)),e.options.lineWrapping||(i.iter(Z,k.line+t.text.length,function(Re){var je=pn(Re);je>s.maxLineLength&&(s.maxLine=Re,s.maxLineLength=je,s.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Xi(i,k.line),wn(e,400);var ee=t.text.length-(K.line-k.line)-1;t.full?Ri(e):k.line==K.line&&t.text.length==1&&!ks(e.doc,t)?Tr(e,k.line,"text"):Ri(e,k.line,K.line+1,ee);var fe=ve(e,"changes"),ge=ve(e,"change");if(ge||fe){var Ie={from:k,to:K,text:t.text,removed:t.removed,origin:t.origin};ge&&mi(e,"change",e,Ie),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ie)}e.display.selForContextMenu=null}function rn(e,t,r,i,s){var k;i||(i=r),Tt(i,r)<0&&(k=[i,r],r=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:r,to:i,text:t,origin:s})}function Qs(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,r,i){for(var s=0;s<e.length;++s){var k=e[s],K=!0;if(k.ranges){k.copied||(k=e[s]=k.deepCopy(),k.copied=!0);for(var $=0;$<k.ranges.length;$++)Qs(k.ranges[$].anchor,t,r,i),Qs(k.ranges[$].head,t,r,i);continue}for(var Z=0;Z<k.changes.length;++Z){var ee=k.changes[Z];if(r<ee.from.line)ee.from=Ve(ee.from.line+i,ee.from.ch),ee.to=Ve(ee.to.line+i,ee.to.ch);else if(t<=ee.to.line){K=!1;break}}K||(e.splice(0,s+1),s=0)}}function Zs(e,t){var r=t.from.line,i=t.to.line,s=t.text.length-(i-r)-1;Js(e.done,r,i,s),Js(e.undone,r,i,s)}function On(e,t,r,i){var s=t,k=t;return typeof t=="number"?k=mt(e,X(e,t)):s=kt(t),s==null?null:(i(k,s)&&e.cm&&Tr(e.cm,s,r),k)}function Rn(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}Rn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;r<i;++r){var s=this.lines[r];this.height-=s.height,vt(s),mi(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,r){for(var i=e+t;e<i;++e)if(r(this.lines[e]))return!0}};function Ln(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var s=e[i];t+=s.chunkSize(),r+=s.height,s.parent=this}this.size=t,this.height=r,this.parent=null}Ln.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var k=Math.min(t,s-e),K=i.height;if(i.removeInner(e,k),this.height-=K-i.height,s==k&&(this.children.splice(r--,1),i.parent=null),(t-=k)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rn))){var $=[];this.collapse($),this.children=[new Rn($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var s=this.children[i],k=s.chunkSize();if(e<=k){if(s.insertInner(e,t,r),s.lines&&s.lines.length>50){for(var K=s.lines.length%25+25,$=K;$<s.lines.length;){var Z=new Rn(s.lines.slice($,$+=25));s.height-=Z.height,this.children.splice(++i,0,Z),Z.parent=this}s.lines=s.lines.slice(0,K),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Ln(t);if(e.parent){e.size-=r.size,e.height-=r.height;var s=re(e.parent.children,e);e.parent.children.splice(s+1,0,r)}else{var i=new Ln(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var s=this.children[i],k=s.chunkSize();if(e<k){var K=Math.min(t,k-e);if(s.iterN(e,K,r))return!0;if((t-=K)==0)break;e=0}else e-=k}}};var In=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=e,this.node=t};In.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,i=kt(r);if(i==null||!t)return;for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(r.widgets=null);var k=vn(this);vi(r,Math.max(0,r.height-k)),e&&(Ni(e,function(){qs(e,r,-k),Tr(e,i,"widget")}),mi(e,"lineWidgetCleared",e,this,i))},In.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,i=this.line;this.height=null;var s=vn(this)-t;if(!s)return;rr(this.doc,i)||vi(i,i.height+s),r&&Ni(r,function(){r.curOp.forceUpdate=!0,qs(r,i,s),mi(r,"lineWidgetChanged",r,e,kt(i))})},Ee(In);function qs(e,t,r){$i(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,i){var s=new In(e,r,i),k=e.cm;return k&&s.noHScroll&&(k.display.alignWidgets=!0),On(e,t,"widget",function(K){var $=K.widgets||(K.widgets=[]);if(s.insertAt==null?$.push(s):$.splice(Math.min($.length-1,Math.max(0,s.insertAt)),0,s),s.line=K,k&&!rr(e,K)){var Z=$i(K)<e.scrollTop;vi(K,K.height+vn(s)),Z&&Sa(k,s.height),k.curOp.forceUpdate=!0}return!0}),k&&mi(k,"lineWidgetAdded",k,s,typeof t=="number"?t:kt(t)),s}var eo=0,Or=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Or.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&jr(e),ve(this,"clear")){var r=this.find();r&&mi(this,"clear",r.from,r.to)}for(var i=null,s=null,k=0;k<this.lines.length;++k){var K=this.lines[k],$=Mi(K.markedSpans,this);e&&!this.collapsed?Tr(e,kt(K),"text"):e&&($.to!=null&&(s=kt(K)),$.from!=null&&(i=kt(K))),K.markedSpans=kr(K.markedSpans,$),$.from==null&&this.collapsed&&!rr(this.doc,K)&&e&&vi(K,Yr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var ee=wi(this.lines[Z]),fe=pn(ee);fe>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ri(e,i,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&mi(e,"markerCleared",e,this,i,s),t&&Hr(e),this.parent&&this.parent.clear()},Or.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,s=0;s<this.lines.length;++s){var k=this.lines[s],K=Mi(k.markedSpans,this);if(K.from!=null&&(r=Ve(t?k:kt(k),K.from),e==-1))return r;if(K.to!=null&&(i=Ve(t?k:kt(k),K.to),e==1))return i}return r&&{from:r,to:i}},Or.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,i=this.doc.cm;if(!t||!i)return;Ni(i,function(){var s=t.line,k=kt(t.line),K=fa(i,k);if(K&&(ns(K),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!rr(r.doc,s)&&r.height!=null){var $=r.height;r.height=null;var Z=vn(r)-$;Z&&vi(s,s.height+Z)}mi(i,"markerChanged",i,e)})},Or.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||re(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Or.prototype.detachLine=function(e){if(this.lines.splice(re(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ee(Or);function nn(e,t,r,i,s){if(i&&i.shared)return xl(e,t,r,i,s);if(e.cm&&!e.cm.curOp)return hi(e.cm,nn)(e,t,r,i,s);var k=new Or(e,s),K=Tt(t,r);if(i&&v(i,k,!1),K>0||K==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=b("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ui(e,t.line,t,r,k)||t.line!=r.line&&ui(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");or()}k.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var $=t.line,Z=e.cm,ee;if(e.iter($,r.line+1,function(ge){Z&&k.collapsed&&!Z.options.lineWrapping&&wi(ge)==Z.display.maxLine&&(ee=!0),k.collapsed&&$!=t.line&&vi(ge,0),yr(ge,new lr(k,$==t.line?t.ch:null,$==r.line?r.ch:null)),++$}),k.collapsed&&e.iter(t.line,r.line+1,function(ge){rr(e,ge)&&vi(ge,0)}),k.clearOnEnter&&Ue(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(ji(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),Z){if(ee&&(Z.curOp.updateMaxLine=!0),k.collapsed)Ri(Z,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var fe=t.line;fe<=r.line;fe++)Tr(Z,fe,"text");k.atomic&&Gs(Z.doc),mi(Z,"markerAdded",Z,k)}return k}var kn=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};kn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mi(this,"clear")},kn.prototype.find=function(e,t){return this.primary.find(e,t)},Ee(kn);function xl(e,t,r,i,s){i=v(i),i.shared=!1;var k=[nn(e,t,r,i,s)],K=k[0],$=i.widgetNode;return Ar(e,function(Z){$&&(i.widgetNode=$.cloneNode(!0)),k.push(nn(Z,y(Z,t),y(Z,r),i,s));for(var ee=0;ee<Z.linked.length;++ee)if(Z.linked[ee].isParent)return;K=ie(k)}),new kn(k,K)}function to(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var r=0;r<t.length;r++){var i=t[r],s=i.find(),k=e.clipPos(s.from),K=e.clipPos(s.to);if(Tt(k,K)){var $=nn(e,k,K,i.primary,i.primary.type);i.markers.push($),$.parent=i}}}function wl(e){for(var t=function(i){var s=e[i],k=[s.primary.doc];Ar(s.primary.doc,function(Z){return k.push(Z)});for(var K=0;K<s.markers.length;K++){var $=s.markers[K];re(k,$.doc)==-1&&($.parent=null,s.markers.splice(K--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,Li=function(e,t,r,i,s){if(!(this instanceof Li))return new Li(e,t,r,i,s);r==null&&(r=0),Ln.call(this,[new Rn([new Dr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var k=Ve(r,0);this.sel=Sr(k),this.history=new Qn(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:k,to:k,text:e}),Ei(this,Sr(k),pe)};Li.prototype=ke(Ln.prototype,{constructor:Li,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:di(function(e){var t=Ve(this.first,0),r=this.first+this.size-1;tn(this,{from:t,to:Ve(r,mt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),Ei(this,Sr(t),pe)}),replaceRange:function(e,t,r,i){t=y(this,t),r=r?y(this,r):t,rn(this,e,t,r,i)},getRange:function(e,t,r){var i=Gi(this,y(this,e),y(this,t));return r===!1?i:i.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Vi(this,e))return mt(this,e)},getLineNumber:function(e){return kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=mt(this,e)),wi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return y(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:di(function(e,t,r){js(this,y(this,typeof e=="number"?Ve(e,t||0):e),null,r)}),setSelection:di(function(e,t,r){js(this,y(this,e),y(this,t||e),r)}),extendSelection:di(function(e,t,r){Zn(this,y(this,e),t&&y(this,t),r)}),extendSelections:di(function(e,t){Bs(this,U(this,e),t)}),extendSelectionsBy:di(function(e,t){var r=de(this.sel.ranges,e);Bs(this,U(this,r),t)}),setSelections:di(function(e,t,r){if(!e.length)return;for(var i=[],s=0;s<e.length;s++)i[s]=new Gt(y(this,e[s].anchor),y(this,e[s].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Ei(this,Ji(this.cm,i,t),r)}),addSelection:di(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new Gt(y(this,e),y(this,t||e))),Ei(this,Ji(this.cm,i,i.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,i=0;i<t.length;i++){var s=Gi(this,t[i].from(),t[i].to());r=r?r.concat(s):s}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var s=Gi(this,r[i].from(),r[i].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[i]=s}return t},replaceSelection:function(e,t,r){for(var i=[],s=0;s<this.sel.ranges.length;s++)i[s]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:di(function(e,t,r){for(var i=[],s=this.sel,k=0;k<s.ranges.length;k++){var K=s.ranges[k];i[k]={from:K.from(),to:K.to(),text:this.splitLines(e[k]),origin:r}}for(var $=t&&t!="end"&&cl(this,i,t),Z=i.length-1;Z>=0;Z--)tn(this,i[Z]);$?Hs(this,$):this.cm&&Jr(this.cm)}),undo:di(function(){ta(this,"undo")}),redo:di(function(){ta(this,"redo")}),undoSelection:di(function(){ta(this,"undo",!0)}),redoSelection:di(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ar(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:qr(this.history.done),undone:qr(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=qr(e.done.slice(0),null,!0),t.undone=qr(e.undone.slice(0),null,!0)},setGutterMarker:di(function(e,t,r){return On(this,e,"gutter",function(i){var s=i.gutterMarkers||(i.gutterMarkers={});return s[t]=r,!r&&Be(s)&&(i.gutterMarkers=null),!0})}),clearGutter:di(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&On(t,r,"gutter",function(){return r.gutterMarkers[e]=null,Be(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Vi(this,e))return null;if(t=e,e=mt(this,e),!e)return null}else if(t=kt(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:di(function(e,t,r){return On(this,e,t=="gutter"?"gutter":"class",function(i){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[s])i[s]=r;else{if(C(r).test(i[s]))return!1;i[s]+=" "+r}return!0})}),removeLineClass:di(function(e,t,r){return On(this,e,t=="gutter"?"gutter":"class",function(i){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=i[s];if(k)if(r==null)i[s]=null;else{var K=k.match(C(r));if(!K)return!1;var $=K.index+K[0].length;i[s]=k.slice(0,K.index)+(!K.index||$==k.length?"":" ")+k.slice($)||null}else return!1;return!0})}),addLineWidget:di(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return nn(this,y(this,e),y(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=y(this,e),nn(this,e,e,r,"bookmark")},findMarksAt:function(e){e=y(this,e);var t=[],r=mt(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var s=r[i];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,r){e=y(this,e),t=y(this,t);var i=[],s=e.line;return this.iter(e.line,t.line+1,function(k){var K=k.markedSpans;if(K)for(var $=0;$<K.length;$++){var Z=K[$];!(Z.to!=null&&s==e.line&&e.ch>=Z.to||Z.from==null&&s!=e.line||Z.from!=null&&s==t.line&&Z.from>=t.ch)&&(!r||r(Z.marker))&&i.push(Z.marker.parent||Z.marker)}++s}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)r[i].from!=null&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first,i=this.lineSeparator().length;return this.iter(function(s){var k=s.text.length+i;if(k>e)return t=e,!0;e-=k,++r}),y(this,Ve(r,t))},indexFromPos:function(e){e=y(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+r}),t},copy:function(e){var t=new Li(tr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var i=new Li(tr(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof Qt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];Ar(e,function(s){return i.push(s.id)},!0),e.history=new Qn(null),e.history.done=qr(this.history.done,i),e.history.undone=qr(this.history.undone,i)}},iterLinkedDocs:function(e){Ar(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:di(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)})}),Li.prototype.eachLine=Li.prototype.iter;var io=0;function Cl(e){var t=this;if(ro(t),ze(t,e)||hr(t.display,e))return;te(e),z&&(io=+new Date);var r=Nr(t,e,!0),i=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var s=i.length,k=Array(s),K=0,$=function(){++K==s&&hi(t,function(){r=y(t.doc,r);var Re={from:r,to:r,text:t.doc.splitLines(k.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Re),Hs(t.doc,Sr(y(t.doc,r),y(t.doc,Cr(Re))))})()},Z=function(Re,je){if(t.options.allowDropFileTypes&&re(t.options.allowDropFileTypes,Re.type)==-1){$();return}var Ke=new FileReader;Ke.onerror=function(){return $()},Ke.onload=function(){var Qe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Qe)){$();return}k[je]=Qe,$()},Ke.readAsText(Re)},ee=0;ee<i.length;ee++)Z(i[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var fe=e.dataTransfer.getData("Text");if(fe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Sr(r,r)),ge)for(var Ie=0;Ie<ge.length;++Ie)rn(t.doc,"",ge[Ie].anchor,ge[Ie].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(Re){}}}function Al(e,t){if(z&&(!e.state.draggingText||+new Date-io<100)){me(t);return}if(ze(e,t)||hr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=o("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function Ol(e,t){var r=Nr(e,t);if(!r)return;var i=document.createDocumentFragment();ms(e,r,i),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(e.display.dragCursor,i)}function ro(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function no(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<t.length;i++){var s=t[i].CodeMirror;s&&r.push(s)}r.length&&r[0].operation(function(){for(var k=0;k<r.length;k++)e(r[k])})}var ao=!1;function Rl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ue(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,no(Il)},100))}),Ue(window,"blur",function(){return no(Qr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Rr={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"},Dn=0;Dn<10;Dn++)Rr[Dn+48]=Rr[Dn+96]=String(Dn);for(var ia=65;ia<=90;ia++)Rr[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)Rr[Pn+111]=Rr[Pn+63235]="F"+Pn;var dr={};dr.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"},dr.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"},dr.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"},dr.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"]},dr.default=u?dr.macDefault:dr.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,i,s,k,K=0;K<t.length-1;K++){var $=t[K];if(/^(cmd|meta|m)$/i.test($))k=!0;else if(/^a(lt)?$/i.test($))r=!0;else if(/^(c|ctrl|control)$/i.test($))i=!0;else if(/^s(hift)?$/i.test($))s=!0;else throw new Error("Unrecognized modifier name: "+$)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function Dl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(i=="..."){delete e[r];continue}for(var s=de(r.split(" "),kl),k=0;k<s.length;k++){var K=void 0,$=void 0;k==s.length-1?($=s.join(" "),K=i):($=s.slice(0,k+1).join(" "),K="...");var Z=t[$];if(!Z)t[$]=K;else if(Z!=K)throw new Error("Inconsistent bindings for "+$)}delete e[r]}for(var ee in t)e[ee]=t[ee];return e}function an(e,t,r,i){t=ra(t);var s=t.call?t.call(e,i):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&r(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,r,i);for(var k=0;k<t.fallthrough.length;k++){var K=an(e,t.fallthrough[k],r,i);if(K)return K}}}function so(e){var t=typeof e=="string"?e:Rr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=Rr[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function ra(e){return typeof e=="string"?dr[e]:e}function sn(e,t){for(var r=e.doc.sel.ranges,i=[],s=0;s<r.length;s++){for(var k=t(r[s]);i.length&&Tt(k.from,ie(i).to)<=0;){var K=i.pop();if(Tt(K.from,k.from)<0){k.from=K.from;break}}i.push(k)}Ni(e,function(){for(var $=i.length-1;$>=0;$--)rn(e.doc,"",i[$].from,i[$].to,"+delete");Jr(e)})}function Fa(e,t,r){var i=Ne(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ua(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Ve(t.line,i,r<0?"after":"before")}function Ba(e,t,r,i,s){if(e){t.doc.direction=="rtl"&&(s=-s);var k=tt(r,t.doc.direction);if(k){var K=s<0?ie(k):k[0],$=s<0==(K.level==1),Z=$?"after":"before",ee;if(K.level>0||t.doc.direction=="rtl"){var fe=Xr(t,r);ee=s<0?r.text.length-1:0;var ge=ar(t,fe,ee).top;ee=Xe(function(Ie){return ar(t,fe,Ie).top==ge},s<0==(K.level==1)?K.from:K.to-1,ee),Z=="before"&&(ee=Fa(r,ee,1))}else ee=s<0?K.to:K.from;return new Ve(i,ee,Z)}}return new Ve(i,s<0?r.text.length:0,s<0?"before":"after")}function Pl(e,t,r,i){var s=tt(t,e.doc.direction);if(!s)return Ua(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=$e(s,r.ch,r.sticky),K=s[k];if(e.doc.direction=="ltr"&&K.level%2==0&&(i>0?K.to>r.ch:K.from<r.ch))return Ua(t,r,i);var $=function(nt,ot){return Fa(t,nt instanceof Ve?nt.ch:nt,ot)},Z,ee=function(nt){return e.options.lineWrapping?(Z=Z||Xr(e,t),ds(e,t,Z,nt)):{begin:0,end:t.text.length}},fe=ee(r.sticky=="before"?$(r,-1):r.ch);if(e.doc.direction=="rtl"||K.level==1){var ge=K.level==1==i<0,Ie=$(r,ge?1:-1);if(Ie!=null&&(ge?Ie<=K.to&&Ie<=fe.end:Ie>=K.from&&Ie>=fe.begin)){var Re=ge?"before":"after";return new Ve(r.line,Ie,Re)}}var je=function(nt,ot,at){for(var ht=function(Xt,ci){return ci?new Ve(r.line,$(Xt,1),"before"):new Ve(r.line,Xt,"after")};nt>=0&&nt<s.length;nt+=ot){var Et=s[nt],yt=ot>0==(Et.level!=1),At=yt?at.begin:$(at.end,-1);if(Et.from<=At&&At<Et.to)return ht(At,yt);if(At=yt?Et.from:$(Et.to,-1),at.begin<=At&&At<at.end)return ht(At,yt)}},Ke=je(k+i,i,fe);if(Ke)return Ke;var Qe=i>0?fe.end:$(fe.begin,-1);return Qe!=null&&!(i>0&&Qe==t.text.length)&&(Ke=je(i>0?0:s.length-1,i,ee(Qe)),Ke)?Ke:null}var Mn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return sn(e,function(t){if(t.empty()){var r=mt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:y(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:i}})},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 uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ml(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},_e)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},_e)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},_e)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),i=e.options.tabSize,s=0;s<r.length;s++){var k=r[s].from(),K=G(e.getLine(k.line),k.ch,i);t.push(ue(i-K%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var s=t[i].head,k=mt(e.doc,s.line).text;if(k){if(s.ch==k.length&&(s=new Ve(s.line,s.ch-1)),s.ch>0)s=new Ve(s.line,s.ch+1),e.replaceRange(k.charAt(s.ch-1)+k.charAt(s.ch-2),Ve(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var K=mt(e.doc,s.line-1).text;K&&(s=new Ve(s.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+K.charAt(K.length-1),Ve(s.line-1,K.length-1),s,"+transpose"))}}r.push(new Gt(s,s))}e.setSelections(r)})},newlineAndIndent:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Jr(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=mt(e.doc,t),i=wi(r);return i!=r&&(t=kt(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var r=mt(e.doc,t),i=Vr(r);return i!=r&&(t=kt(i)),Ba(!0,e,r,t,-1)}function ho(e,t){var r=uo(e,t.line),i=mt(e.doc,r.line),s=tt(i,e.doc.direction);if(!s||s[0].level==0){var k=Math.max(r.ch,i.text.search(/\S/)),K=t.line==r.line&&t.ch<=k&&t.ch;return Ve(r.line,K?0:k,r.sticky)}return r}function na(e,t,r){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),s=t(e)!=we}finally{e.display.shift=i,e.state.suppressEdits=!1}return s}function Nl(e,t,r){for(var i=0;i<e.state.keyMaps.length;i++){var s=an(t,e.state.keyMaps[i],r,e);if(s)return s}return e.options.extraKeys&&an(t,e.options.extraKeys,r,e)||an(t,e.options.keyMap,r,e)}var Fl=new Y;function Nn(e,t,r,i){var s=e.state.keySeq;if(s){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),co(e,s+" "+t,r,i))return!0}return co(e,t,r,i)}function co(e,t,r,i){var s=Nl(e,t,i);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&mi(e,"keyHandled",e,t,r),(s=="handled"||s=="multi")&&(te(r),xa(e)),!!s}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+r,t,function(i){return na(e,i,!0)})||Nn(e,r,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return na(e,i)}):Nn(e,r,t,function(i){return na(e,i)}):!1}function Ul(e,t,r){return Nn(e,"'"+r+"'",t,function(i){return na(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),ze(t,e))return;z&&W<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var i=fo(t,e);p&&(ja=i?r:null,!i&&r==88&&!Ut&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),P&&!u&&!i&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;D(t,"CodeMirror-crosshair");function r(i){(i.keyCode==18||!i.altKey)&&(w(t,"CodeMirror-crosshair"),rt(document,"keyup",r),rt(document,"mouseover",r))}Ue(document,"keyup",r),Ue(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),ze(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(hr(t.display,e)||ze(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var r=e.keyCode,i=e.charCode;if(p&&r==ja){ja=null,te(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var s=String.fromCharCode(i==null?r:i);if(s=="\b")return;if(Ul(t,e,s))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ha.prototype.compare=function(e,t,r){return this.time+jl>e&&Tt(t,this.pos)==0&&r==this.button};var Fn,Un;function Hl(e,t){var r=+new Date;return Un&&Un.compare(r,e,t)?(Fn=Un=null,"triple"):Fn&&Fn.compare(r,e,t)?(Un=new Ha(r,e,t),Fn=null,"double"):(Fn=new Ha(r,e,t),Un=null,"single")}function vo(e){var t=this,r=t.display;if(ze(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,hr(r,e)){M||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Nr(t,e),s=Pe(e),k=i?Hl(i,s):"single";if(window.focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,s,i,k,e))return;s==1?i?zl(t,i,k,e):be(e)==r.scroller&&te(e):s==2?(i&&Zn(t.doc,i),setTimeout(function(){return r.input.focus()},20)):s==3&&(R?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,s){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Nn(e,oo(k,s),s,function(K){if(typeof K=="string"&&(K=Mn[K]),!K)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=K(e,r)!=we}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,r){var i=e.getOption("configureMouse"),s=i?i(e,t,r):{};if(s.unit==null){var k=c?r.shiftKey&&r.metaKey:r.altKey;s.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||r.shiftKey),s.addNew==null&&(s.addNew=u?r.metaKey:r.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(u?r.altKey:r.ctrlKey)),s}function zl(e,t,r,i){z?setTimeout(I(gs,e),0):e.curOp.focus=N();var s=Gl(e,r,i),k=e.doc.sel,K;e.options.dragDrop&&We&&!e.isReadOnly()&&r=="single"&&(K=k.contains(t))>-1&&(Tt((K=k.ranges[K]).from(),t)<0||t.xRel>0)&&(Tt(K.to(),t)>0||t.xRel<0)?Kl(e,i,t,s):Vl(e,i,t,s)}function Kl(e,t,r,i){var s=e.display,k=!1,K=hi(e,function(ee){M&&(s.scroller.draggable=!1),e.state.draggingText=!1,rt(s.wrapper.ownerDocument,"mouseup",K),rt(s.wrapper.ownerDocument,"mousemove",$),rt(s.scroller,"dragstart",Z),rt(s.scroller,"drop",K),k||(te(ee),i.addNew||Zn(e.doc,r,null,null,i.extend),M&&!f||z&&W==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),$=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},Z=function(){return k=!0};M&&(s.scroller.draggable=!0),e.state.draggingText=K,K.copy=!i.moveOnDrag,s.scroller.dragDrop&&s.scroller.dragDrop(),Ue(s.wrapper.ownerDocument,"mouseup",K),Ue(s.wrapper.ownerDocument,"mousemove",$),Ue(s.scroller,"dragstart",Z),Ue(s.scroller,"drop",K),vs(e),setTimeout(function(){return s.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Gt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Gt(Ve(t.line,0),y(e.doc,Ve(t.line+1,0)));var i=r(e,t);return new Gt(i.from,i.to)}function Vl(e,t,r,i){var s=e.display,k=e.doc;te(t);var K,$,Z=k.sel,ee=Z.ranges;if(i.addNew&&!i.extend?($=k.sel.contains(r),$>-1?K=ee[$]:K=new Gt(r,r)):(K=k.sel.primary(),$=k.sel.primIndex),i.unit=="rectangle")i.addNew||(K=new Gt(r,r)),r=Nr(e,t,!0,!0),$=-1;else{var fe=yo(e,r,i.unit);i.extend?K=Ma(K,fe.anchor,fe.head,i.extend):K=fe}i.addNew?$==-1?($=ee.length,Ei(k,Ji(e,ee.concat([K]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&i.unit=="char"&&!i.extend?(Ei(k,Ji(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),Z=k.sel):Na(k,$,K,xe):($=0,Ei(k,new Wi([K],0),xe),Z=k.sel);var ge=r;function Ie(at){if(Tt(ge,at)==0)return;if(ge=at,i.unit=="rectangle"){for(var ht=[],Et=e.options.tabSize,yt=G(mt(k,r.line).text,r.ch,Et),At=G(mt(k,at.line).text,at.ch,Et),Xt=Math.min(yt,At),ci=Math.max(yt,At),Zt=Math.min(r.line,at.line),Fi=Math.min(e.lastLine(),Math.max(r.line,at.line));Zt<=Fi;Zt++){var Ii=mt(k,Zt).text,ni=Se(Ii,Xt,Et);Xt==ci?ht.push(new Gt(Ve(Zt,ni),Ve(Zt,ni))):Ii.length>ni&&ht.push(new Gt(Ve(Zt,ni),Ve(Zt,Se(Ii,ci,Et))))}ht.length||ht.push(new Gt(r,r)),Ei(k,Ji(e,Z.ranges.slice(0,$).concat(ht),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(at)}else{var ki=K,gi=yo(e,at,i.unit),oi=ki.anchor,ai;Tt(gi.anchor,oi)>0?(ai=gi.head,oi=vr(ki.from(),gi.anchor)):(ai=gi.anchor,oi=gr(ki.to(),gi.head));var ei=Z.ranges.slice(0);ei[$]=Xl(e,new Gt(y(k,oi),ai)),Ei(k,Ji(e,ei,$),xe)}}var Re=s.wrapper.getBoundingClientRect(),je=0;function Ke(at){var ht=++je,Et=Nr(e,at,!0,i.unit=="rectangle");if(!Et)return;if(Tt(Et,ge)!=0){e.curOp.focus=N(),Ie(Et);var yt=Vn(s,k);(Et.line>=yt.to||Et.line<yt.from)&&setTimeout(hi(e,function(){je==ht&&Ke(at)}),150)}else{var At=at.clientY<Re.top?-20:at.clientY>Re.bottom?20:0;At&&setTimeout(hi(e,function(){if(je!=ht)return;s.scroller.scrollTop+=At,Ke(at)}),50)}}function Qe(at){e.state.selectingText=!1,je=Infinity,at&&(te(at),s.input.focus()),rt(s.wrapper.ownerDocument,"mousemove",nt),rt(s.wrapper.ownerDocument,"mouseup",ot),k.history.lastSelOrigin=null}var nt=hi(e,function(at){at.buttons===0||!Pe(at)?Qe(at):Ke(at)}),ot=hi(e,Qe);e.state.selectingText=ot,Ue(s.wrapper.ownerDocument,"mousemove",nt),Ue(s.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var r=t.anchor,i=t.head,s=mt(e.doc,r.line);if(Tt(r,i)==0&&r.sticky==i.sticky)return t;var k=tt(s);if(!k)return t;var K=$e(k,r.ch,r.sticky),$=k[K];if($.from!=r.ch&&$.to!=r.ch)return t;var Z=K+($.from==r.ch==($.level!=1)?0:1);if(Z==0||Z==k.length)return t;var ee;if(i.line!=r.line)ee=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=$e(k,i.ch,i.sticky),ge=fe-K||(i.ch-r.ch)*($.level==1?-1:1);fe==Z-1||fe==Z?ee=ge<0:ee=ge>0}var Ie=k[Z+(ee?-1:0)],Re=ee==(Ie.level==1),je=Re?Ie.from:Ie.to,Ke=Re?"after":"before";return r.ch==je&&r.sticky==Ke?t:new Gt(new Ve(r.line,je,Ke),i)}function _o(e,t,r,i){var s,k;if(t.touches)s=t.touches[0].clientX,k=t.touches[0].clientY;else try{s=t.clientX,k=t.clientY}catch(Ie){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&te(t);var K=e.display,$=K.lineDiv.getBoundingClientRect();if(k>$.bottom||!ve(e,r))return he(t);k-=$.top-K.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var ee=K.gutters.childNodes[Z];if(ee&&ee.getBoundingClientRect().right>=s){var fe=Bi(e.doc,k),ge=e.display.gutterSpecs[Z];return Me(e,r,e,fe,ge.className,t),he(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(hr(e.display,t)||Yl(e,t))return;if(ze(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yn(e)}var on={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function r(i,s,k,K){e.defaults[i]=s,k&&(t[i]=K?function($,Z,ee){ee!=on&&k($,Z,ee)}:k)}e.defineOption=r,e.Init=on,r("value","",function(i,s){return i.setValue(s)},!0),r("mode",null,function(i,s){i.doc.modeOption=s,ka(i)},!0),r("indentUnit",2,ka,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Cn(i),yn(i),Ri(i)},!0),r("lineSeparator",null,function(i,s){if(i.doc.lineSep=s,!s)return;var k=[],K=i.doc.first;i.doc.iter(function(Z){for(var ee=0;;){var fe=Z.text.indexOf(s,ee);if(fe==-1)break;ee=fe+s.length,k.push(Ve(K,fe))}K++});for(var $=k.length-1;$>=0;$--)rn(i.doc,s,k[$],Ve(k[$].line,k[$].ch+s.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,s,k){i.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),k!=on&&i.refresh()}),r("specialCharPlaceholder",Vt,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,s){return i.getInputField().spellcheck=s},!0),r("autocorrect",!1,function(i,s){return i.getInputField().autocorrect=s},!0),r("autocapitalize",!1,function(i,s){return i.getInputField().autocapitalize=s},!0),r("rtlMoveVisually",!L),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Sn(i)},!0),r("keyMap","default",function(i,s,k){var K=ra(s),$=k!=on&&ra(k);$&&$.detach&&$.detach(i,K),K.attach&&K.attach(i,$||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(i,s){i.display.gutterSpecs=La(s,i.options.lineNumbers),Sn(i)},!0),r("fixedGutter",!0,function(i,s){i.display.gutters.style.left=s?ba(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return Zr(i)},!0),r("scrollbarStyle","native",function(i){Ts(i),Zr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,s){i.display.gutterSpecs=La(i.options.gutters,s),Sn(i)},!0),r("firstLineNumber",1,Sn,!0),r("lineNumberFormatter",function(i){return i},Sn,!0),r("showCursorWhenSelecting",!1,_n,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,s){s=="nocursor"&&(Qr(i),i.display.input.blur()),i.display.input.readOnlyChanged(s)}),r("screenReaderLabel",null,function(i,s){s=s===""?null:s,i.display.input.screenReaderLabelChanged(s)}),r("disableInput",!1,function(i,s){s||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_n,!0),r("singleCursorHeightPerLine",!0,_n,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Cn,!0),r("addModeClass",!1,Cn,!0),r("pollInterval",100),r("undoDepth",200,function(i,s){return i.doc.history.undoDepth=s}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Cn,!0),r("moveInputWithCursor",!0,function(i,s){s||i.display.input.resetPosition()}),r("tabindex",null,function(i,s){return i.display.input.getField().tabIndex=s||""}),r("autofocus",null),r("direction","ltr",function(i,s){return i.doc.setDirection(s)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=on;if(!t!=!i){var s=e.display.dragFunctions,k=t?Ue:rt;k(e.display.scroller,"dragstart",s.start),k(e.display.scroller,"dragenter",s.enter),k(e.display.scroller,"dragover",s.over),k(e.display.scroller,"dragleave",s.leave),k(e.display.scroller,"drop",s.drop)}}function Jl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(w(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Ea(e),Ri(e),yn(e),setTimeout(function(){return Zr(e)},100)}function Qt(e,t){var r=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?v(t):{},v(xo,t,!1);var i=t.value;typeof i=="string"?i=new Li(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var s=new Qt.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,s,t);k.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!a&&k.input.focus(),z&&W<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Rl(),jr(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Qr(this);for(var K in aa)aa.hasOwnProperty(K)&&aa[K](this,t[K],on);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$<Ga.length;++$)Ga[$](this);Hr(this),M&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Qt.defaults=xo,Qt.optionHandlers=aa;function Zl(e){var t=e.display;Ue(t.scroller,"mousedown",hi(e,vo)),z&&W<11?Ue(t.scroller,"dblclick",hi(e,function(Z){if(ze(e,Z))return;var ee=Nr(e,Z);if(!ee||Wa(e,Z)||hr(e.display,Z))return;te(Z);var fe=e.findWordAt(ee);Zn(e.doc,fe.anchor,fe.head)})):Ue(t.scroller,"dblclick",function(Z){return ze(e,Z)||te(Z)}),Ue(t.scroller,"contextmenu",function(Z){return bo(e,Z)}),Ue(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||bo(e,Z)});var r,i={end:0};function s(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function k(Z){if(Z.touches.length!=1)return!1;var ee=Z.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function K(Z,ee){if(ee.left==null)return!0;var fe=ee.left-Z.left,ge=ee.top-Z.top;return fe*fe+ge*ge>20*20}Ue(t.scroller,"touchstart",function(Z){if(!ze(e,Z)&&!k(Z)&&!Wa(e,Z)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),Ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ue(t.scroller,"touchend",function(Z){var ee=t.activeTouch;if(ee&&!hr(t,Z)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var fe=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||K(ee,ee.prev)?ge=new Gt(fe,fe):!ee.prev.prev||K(ee,ee.prev.prev)?ge=e.findWordAt(fe):ge=new Gt(Ve(fe.line,0),y(e.doc,Ve(fe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(Z)}s()}),Ue(t.scroller,"touchcancel",s),Ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Ur(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),Ue(t.scroller,"mousewheel",function(Z){return Rs(e,Z)}),Ue(t.scroller,"DOMMouseScroll",function(Z){return Rs(e,Z)}),Ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){ze(e,Z)||me(Z)},over:function(Z){ze(e,Z)||(Ol(e,Z),me(Z))},start:function(Z){return Al(e,Z)},drop:hi(e,Cl),leave:function(Z){ze(e,Z)||ro(e)}};var $=t.input.getField();Ue($,"keyup",function(Z){return mo.call(e,Z)}),Ue($,"keydown",hi(e,po)),Ue($,"keypress",hi(e,go)),Ue($,"focus",function(Z){return Ta(e,Z)}),Ue($,"blur",function(Z){return Qr(e,Z)})}var Ga=[];Qt.defineInitHook=function(e){return Ga.push(e)};function Bn(e,t,r,i){var s=e.doc,k;r==null&&(r="add"),r=="smart"&&(s.mode.indent?k=et(e,t).state:r="prev");var K=e.options.tabSize,$=mt(s,t),Z=G($.text,null,K);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],fe;if(!i&&!/\S/.test($.text))fe=0,r="not";else if(r=="smart"&&(fe=s.mode.indent(k,$.text.slice(ee.length),$.text),fe==we||fe>150)){if(!i)return;r="prev"}r=="prev"?t>s.first?fe=G(mt(s,t-1).text,null,K):fe=0:r=="add"?fe=Z+e.options.indentUnit:r=="subtract"?fe=Z-e.options.indentUnit:typeof r=="number"&&(fe=Z+r),fe=Math.max(0,fe);var ge="",Ie=0;if(e.options.indentWithTabs)for(var Re=Math.floor(fe/K);Re;--Re)Ie+=K,ge+=" ";if(Ie<fe&&(ge+=ue(fe-Ie)),ge!=ee)return rn(s,ge,Ve(t,0),Ve(t,ee.length),"+input"),$.stateAfter=null,!0;for(var je=0;je<s.sel.ranges.length;je++){var Ke=s.sel.ranges[je];if(Ke.head.line==t&&Ke.head.ch<ee.length){var Qe=Ve(t,ee.length);Na(s,je,new Gt(Qe,Qe));break}}}var Zi=null;function sa(e){Zi=e}function za(e,t,r,i,s){var k=e.doc;e.display.shift=!1,i||(i=k.sel);var K=+new Date-200,$=s=="paste"||e.state.pasteIncoming>K,Z=xt(t),ee=null;if($&&i.ranges.length>1)if(Zi&&Zi.text.join(`
`)==t){if(i.ranges.length%Zi.text.length==0){ee=[];for(var fe=0;fe<Zi.text.length;fe++)ee.push(k.splitLines(Zi.text[fe]))}}else Z.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ee=de(Z,function(nt){return[nt]}));for(var ge=e.curOp.updateInput,Ie=i.ranges.length-1;Ie>=0;Ie--){var Re=i.ranges[Ie],je=Re.from(),Ke=Re.to();Re.empty()&&(r&&r>0?je=Ve(je.line,je.ch-r):e.state.overwrite&&!$?Ke=Ve(Ke.line,Math.min(mt(k,Ke.line).text.length,Ke.ch+ie(Z).length)):$&&Zi&&Zi.lineWise&&Zi.text.join(`
`)==Z.join(`
`)&&(je=Ke=Ve(je.line,0)));var Qe={from:je,to:Ke,text:ee?ee[Ie%ee.length]:Z,origin:s||($?"paste":e.state.cutIncoming>K?"cut":"+input")};tn(e.doc,Qe),mi(e,"inputRead",e,Qe)}t&&!$&&wo(e,t),Jr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ni(t,function(){return za(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var s=r.ranges[i];if(s.head.ch>100||i&&r.ranges[i-1].head.line==s.head.line)continue;var k=e.getModeAt(s.head),K=!1;if(k.electricChars){for(var $=0;$<k.electricChars.length;$++)if(t.indexOf(k.electricChars.charAt($))>-1){K=Bn(e,s.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(mt(e.doc,s.head.line).text.slice(0,s.head.ch))&&(K=Bn(e,s.head.line,"smart")));K&&mi(e,"electricInput",e,s.head.line)}}function So(e){for(var t=[],r=[],i=0;i<e.doc.sel.ranges.length;i++){var s=e.doc.sel.ranges[i].head.line,k={anchor:Ve(s,0),head:Ve(s+1,0)};r.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:r}}function Co(e,t,r,i){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),d&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,s){var k=this.options,K=k[i];if(k[i]==s&&i!="mode")return;k[i]=s,t.hasOwnProperty(i)&&hi(this,t[i])(this,s,K),Me(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,s){this.state.keyMaps[s?"push":"unshift"](ra(i))},removeKeyMap:function(i){for(var s=this.state.keyMaps,k=0;k<s.length;++k)if(s[k]==i||s[k].name==i)return s.splice(k,1),!0},addOverlay:Si(function(i,s){var k=i.token?i:e.getMode(this.options,i);if(k.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:k,modeSpec:i,opaque:s&&s.opaque,priority:s&&s.priority||0},function(K){return K.priority}),this.state.modeGen++,Ri(this)}),removeOverlay:Si(function(i){for(var s=this.state.overlays,k=0;k<s.length;++k){var K=s[k].modeSpec;if(K==i||typeof i=="string"&&K.name==i){s.splice(k,1),this.state.modeGen++,Ri(this);return}}}),indentLine:Si(function(i,s,k){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),Vi(this.doc,i)&&Bn(this,i,s,k)}),indentSelection:Si(function(i){for(var s=this.doc.sel.ranges,k=-1,K=0;K<s.length;K++){var $=s[K];if($.empty())$.head.line>k&&(Bn(this,$.head.line,i,!0),k=$.head.line,K==this.doc.sel.primIndex&&Jr(this));else{var Z=$.from(),ee=$.to(),fe=Math.max(k,Z.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=fe;ge<k;++ge)Bn(this,ge,i);var Ie=this.doc.sel.ranges;Z.ch==0&&s.length==Ie.length&&Ie[K].from().ch>0&&Na(this.doc,K,new Gt(Z,Ie[K].to()),pe)}}}),getTokenAt:function(i,s){return $t(this,i,s)},getLineTokens:function(i,s){return $t(this,Ve(i),s,!0)},getTokenTypeAt:function(i){i=y(this.doc,i);var s=He(this,mt(this.doc,i.line)),k=0,K=(s.length-1)/2,$=i.ch,Z;if($==0)Z=s[2];else for(;;){var ee=k+K>>1;if((ee?s[ee*2-1]:0)>=$)K=ee;else if(s[ee*2+1]<$)k=ee+1;else{Z=s[ee*2+2];break}}var fe=Z?Z.indexOf("overlay "):-1;return fe<0?Z:fe==0?null:Z.slice(0,fe-1)},getModeAt:function(i){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(i).state).mode:s},getHelper:function(i,s){return this.getHelpers(i,s)[0]},getHelpers:function(i,s){var k=[];if(!r.hasOwnProperty(s))return k;var K=r[s],$=this.getModeAt(i);if(typeof $[s]=="string")K[$[s]]&&k.push(K[$[s]]);else if($[s])for(var Z=0;Z<$[s].length;Z++){var ee=K[$[s][Z]];ee&&k.push(ee)}else $.helperType&&K[$.helperType]?k.push(K[$.helperType]):K[$.name]&&k.push(K[$.name]);for(var fe=0;fe<K._global.length;fe++){var ge=K._global[fe];ge.pred($,this)&&re(k,ge.val)==-1&&k.push(ge.val)}return k},getStateAfter:function(i,s){var k=this.doc;return i=X(k,i==null?k.first+k.size-1:i),et(this,i+1,s).state},cursorCoords:function(i,s){var k,K=this.doc.sel.primary();return i==null?k=K.head:typeof i=="object"?k=y(this.doc,i):k=i?K.from():K.to(),Qi(this,k,s||"page")},charCoords:function(i,s){return ma(this,y(this.doc,i),s||"page")},coordsChar:function(i,s){return i=ls(this,i,s||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,s){return i=ls(this,{top:i,left:0},s||"page").top,Bi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,s,k){var K=!1,$;if(typeof i=="number"){var Z=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>Z&&(i=Z,K=!0),$=mt(this.doc,i)}else $=i;return Wn(this,$,{top:0,left:0},s||"page",k||K).top+(K?this.doc.height-$i($):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,s,k,K,$){var Z=this.display;i=Qi(this,y(this.doc,i));var ee=i.bottom,fe=i.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),Z.sizer.appendChild(s),K=="over")ee=i.top;else if(K=="above"||K=="near"){var ge=Math.max(Z.wrapper.clientHeight,this.doc.height),Ie=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(K=="above"||i.bottom+s.offsetHeight>ge)&&i.top>s.offsetHeight?ee=i.top-s.offsetHeight:i.bottom+s.offsetHeight<=ge&&(ee=i.bottom),fe+s.offsetWidth>Ie&&(fe=Ie-s.offsetWidth)}s.style.top=ee+"px",s.style.left=s.style.right="",$=="right"?(fe=Z.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):($=="left"?fe=0:$=="middle"&&(fe=(Z.sizer.clientWidth-s.offsetWidth)/2),s.style.left=fe+"px"),k&&Qo(this,{left:fe,top:ee,right:fe+s.offsetWidth,bottom:ee+s.offsetHeight})},triggerOnKeyDown:Si(po),triggerOnKeyPress:Si(go),triggerOnKeyUp:mo,triggerOnMouseDown:Si(vo),execCommand:function(i){if(Mn.hasOwnProperty(i))return Mn[i].call(null,this)},triggerElectric:Si(function(i){wo(this,i)}),findPosH:function(i,s,k,K){var $=1;s<0&&($=-1,s=-s);for(var Z=y(this.doc,i),ee=0;ee<s&&!(Z=Ka(this.doc,Z,$,k,K),Z.hitSide);++ee);return Z},moveH:Si(function(i,s){var k=this;this.extendSelectionsBy(function(K){return k.display.shift||k.doc.extend||K.empty()?Ka(k.doc,K.head,i,s,k.options.rtlMoveVisually):i<0?K.from():K.to()},_e)}),deleteH:Si(function(i,s){var k=this.doc.sel,K=this.doc;k.somethingSelected()?K.replaceSelection("",null,"+delete"):sn(this,function($){var Z=Ka(K,$.head,i,s,!1);return i<0?{from:Z,to:$.head}:{from:$.head,to:Z}})}),findPosV:function(i,s,k,K){var $=1,Z=K;s<0&&($=-1,s=-s);for(var ee=y(this.doc,i),fe=0;fe<s;++fe){var ge=Qi(this,ee,"div");if(Z==null?Z=ge.left:ge.left=Z,ee=Oo(this,ge,$,k),ee.hitSide)break}return ee},moveV:Si(function(i,s){var k=this,K=this.doc,$=[],Z=!this.display.shift&&!K.extend&&K.sel.somethingSelected();if(K.extendSelectionsBy(function(fe){if(Z)return i<0?fe.from():fe.to();var ge=Qi(k,fe.head,"div");fe.goalColumn!=null&&(ge.left=fe.goalColumn),$.push(ge.left);var Ie=Oo(k,ge,i,s);return s=="page"&&fe==K.sel.primary()&&Sa(k,ma(k,Ie,"div").top-ge.top),Ie},_e),$.length)for(var ee=0;ee<K.sel.ranges.length;ee++)K.sel.ranges[ee].goalColumn=$[ee]}),findWordAt:function(i){var s=this.doc,k=mt(s,i.line).text,K=i.ch,$=i.ch;if(k){var Z=this.getHelper(i,"wordChars");(i.sticky=="before"||$==k.length)&&K?--K:++$;for(var ee=k.charAt(K),fe=Le(ee,Z)?function(ge){return Le(ge,Z)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Le(ge)};K>0&&fe(k.charAt(K-1));)--K;for(;$<k.length&&fe(k.charAt($));)++$}return new Gt(Ve(i.line,K),Ve(i.line,$))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):w(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Si(function(i,s){bn(this,i,s)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-nr(this)-this.display.barHeight,width:i.scrollWidth-nr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Pr(this)}},scrollIntoView:Si(function(i,s){i==null?(i={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Ve(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=s||0,i.from.line!=null?Jo(this,i):_s(this,i.from,i.to,i.margin)}),setSize:Si(function(i,s){var k=this,K=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};i!=null&&(this.display.wrapper.style.width=K(i)),s!=null&&(this.display.wrapper.style.height=K(s)),this.options.lineWrapping&&as(this);var $=this.display.viewFrom;this.doc.iter($,this.display.viewTo,function(Z){if(Z.widgets){for(var ee=0;ee<Z.widgets.length;ee++)if(Z.widgets[ee].noHScroll){Tr(k,$,"widget");break}}++$}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(i){return Ni(this,i)},startOperation:function(){return jr(this)},endOperation:function(){return Hr(this)},refresh:Si(function(){var i=this.display.cachedTextHeight;Ri(this),this.curOp.forceUpdate=!0,yn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(i==null||Math.abs(i-Yr(this.display))>.5||this.options.lineWrapping)&&Ea(this),Me(this,"refresh",this)}),swapDoc:Si(function(i){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yn(this),this.display.input.reset(),bn(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,mi(this,"swapDoc",this,s),s}),phrase:function(i){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,i)?s[i]:i},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ee(e),e.registerHelper=function(i,s,k){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][s]=k},e.registerGlobalHelper=function(i,s,k,K){e.registerHelper(i,s,K),r[i]._global.push({pred:k,val:K})}}function Ka(e,t,r,i,s){var k=t,K=r,$=mt(e,t.line),Z=s&&e.direction=="rtl"?-r:r;function ee(){var ot=t.line+Z;return ot<e.first||ot>=e.first+e.size?!1:(t=new Ve(ot,t.ch,t.sticky),$=mt(e,ot))}function fe(ot){var at;if(i=="codepoint"){var ht=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(ht)?at=null:at=new Ve(t.line,Math.max(0,Math.min($.text.length,t.ch+r*(ht>=55296&&ht<56320?2:1))),-r)}else s?at=Pl(e.cm,$,t,r):at=Ua($,t,r);if(at==null)if(!ot&&ee())t=Ba(s,e.cm,$,t.line,Z);else return!1;else t=at;return!0}if(i=="char"||i=="codepoint")fe();else if(i=="column")fe(!0);else if(i=="word"||i=="group")for(var ge=null,Ie=i=="group",Re=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(r<0&&!fe(!je));je=!1){var Ke=$.text.charAt(t.ch)||`
`,Qe=Le(Ke,Re)?"w":Ie&&Ke==`
`?"n":!Ie||/\s/.test(Ke)?null:"p";if(Ie&&!je&&!Qe&&(Qe="s"),ge&&ge!=Qe){r<0&&(r=1,fe(),t.sticky="after");break}if(Qe&&(ge=Qe),r>0&&!fe(!je))break}var nt=ea(e,t,k,K,!0);return pr(k,nt)&&(nt.hitSide=!0),nt}function Oo(e,t,r,i){var s=e.doc,k=t.left,K;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max($-.5*Yr(e.display),3);K=(r>0?t.bottom:t.top)+r*Z}else i=="line"&&(K=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,k,K),!ee.outside);){if(r<0?K<=0:K>=s.height){ee.hitSide=!0;break}K+=r*5}return ee}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,r=this,i=r.cm,s=r.div=e.lineDiv;Co(s,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k($){for(var Z=$.target;Z;Z=Z.parentNode){if(Z==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}Ue(s,"paste",function($){if(!k($)||ze(i,$)||To($,i))return;W<=11&&setTimeout(hi(i,function(){return t.updateFromDOM()}),20)}),Ue(s,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Ue(s,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Ue(s,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ue(s,"touchstart",function(){return r.forceCompositionEnd()}),Ue(s,"input",function(){t.composing||t.readFromDOMSoon()});function K($){if(!k($)||ze(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Z=So(i);sa({lineWise:!0,text:Z.text}),$.type=="cut"&&i.operation(function(){i.setSelections(Z.ranges,0,pe),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=Zi.text.join(`
`);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var fe=Ao(),ge=fe.firstChild;i.display.lineSpace.insertBefore(fe,i.display.lineSpace.firstChild),ge.value=Zi.text.join(`
`);var Ie=document.activeElement;j(ge),setTimeout(function(){i.display.lineSpace.removeChild(fe),Ie.focus(),Ie==s&&r.showPrimarySelection()},50)}Ue(s,"copy",K),Ue(s,"cut",K)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),s=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var k=oa(t,e.anchorNode,e.anchorOffset),K=oa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&K&&!K.bad&&Tt(vr(k,K),i)==0&&Tt(gr(k,K),s)==0)return;var $=t.display.view,Z=i.line>=t.display.viewFrom&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=s.line<t.display.viewTo&&Ro(t,s);if(!ee){var fe=$[$.length-1].measure,ge=fe.maps?fe.maps[fe.maps.length-1]:fe.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Z||!ee){e.removeAllRanges();return}var Ie=e.rangeCount&&e.getRangeAt(0),Re;try{Re=m(Z.node,Z.offset,ee.offset,ee.node)}catch(je){}Re&&(!P&&t.state.focused?(e.collapse(Z.node,Z.offset),Re.collapsed||(e.removeAllRanges(),e.addRange(Re))):(e.removeAllRanges(),e.addRange(Re)),Ie&&e.anchorNode==null?e.addRange(Ie):P&&this.startGracePeriod()),this.rememberSelection()},Kt.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)},Kt.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},Kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},Kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Kt.prototype.blur=function(){this.div.blur()},Kt.prototype.getField=function(){return this.div},Kt.prototype.supportsTouch=function(){return!0},Kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ni(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)},Kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);r&&i&&Ni(t,function(){Ei(t.doc,Sr(r,i),pe),(r.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),i=r.from(),s=r.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Ve(i.line-1,mt(e.doc,i.line-1).length)),s.ch==mt(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=Ve(s.line+1,0)),i.line<t.viewFrom||s.line>t.viewTo-1)return!1;var k,K,$;i.line==t.viewFrom||(k=Fr(e,i.line))==0?(K=kt(t.view[0].line),$=t.view[0].node):(K=kt(t.view[k].line),$=t.view[k-1].node.nextSibling);var Z=Fr(e,s.line),ee,fe;if(Z==t.view.length-1?(ee=t.viewTo-1,fe=t.lineDiv.lastChild):(ee=kt(t.view[Z+1].line)-1,fe=t.view[Z+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,fe,K,ee)),Ie=Gi(e.doc,Ve(K,0),Ve(ee,mt(e.doc,ee).text.length));ge.length>1&&Ie.length>1;)if(ie(ge)==ie(Ie))ge.pop(),Ie.pop(),ee--;else if(ge[0]==Ie[0])ge.shift(),Ie.shift(),K++;else break;for(var Re=0,je=0,Ke=ge[0],Qe=Ie[0],nt=Math.min(Ke.length,Qe.length);Re<nt&&Ke.charCodeAt(Re)==Qe.charCodeAt(Re);)++Re;for(var ot=ie(ge),at=ie(Ie),ht=Math.min(ot.length-(ge.length==1?Re:0),at.length-(Ie.length==1?Re:0));je<ht&&ot.charCodeAt(ot.length-je-1)==at.charCodeAt(at.length-je-1);)++je;if(ge.length==1&&Ie.length==1&&K==i.line)for(;Re&&Re>i.ch&&ot.charCodeAt(ot.length-je-1)==at.charCodeAt(at.length-je-1);)Re--,je++;ge[ge.length-1]=ot.slice(0,ot.length-je).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Re).replace(/\u200b+$/,"");var Et=Ve(K,Re),yt=Ve(ee,Ie.length?ie(Ie).length-je:0);if(ge.length>1||ge[0]||Tt(Et,yt))return rn(e.doc,ge,Et,yt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.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)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ni(this.cm,function(){return Ri(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Ro(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=mt(e.doc,t.line),s=es(r,i,t.line),k=tt(i,e.doc.direction),K="left";if(k){var $=$e(k,t.ch);K=$%2?"right":"left"}var Z=rs(s.map,t.ch,K);return Z.offset=Z.collapse=="right"?Z.end:Z.start,Z}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,r,i,s){var k="",K=!1,$=e.doc.lineSeparator(),Z=!1;function ee(Re){return function(je){return je.id==Re}}function fe(){K&&(k+=$,Z&&(k+=$),K=Z=!1)}function ge(Re){Re&&(fe(),k+=Re)}function Ie(Re){if(Re.nodeType==1){var je=Re.getAttribute("cm-text");if(je){ge(je);return}var Ke=Re.getAttribute("cm-marker"),Qe;if(Ke){var nt=e.findMarks(Ve(i,0),Ve(s+1,0),ee(+Ke));nt.length&&(Qe=nt[0].find(0))&&ge(Gi(e.doc,Qe.from,Qe.to).join($));return}if(Re.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(Re.nodeName);if(!/^br$/i.test(Re.nodeName)&&Re.textContent.length==0)return;ot&&fe();for(var at=0;at<Re.childNodes.length;at++)Ie(Re.childNodes[at]);/^(pre|p)$/i.test(Re.nodeName)&&(Z=!0),ot&&(K=!0)}else Re.nodeType==3&&ge(Re.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ie(t),t==r);)t=t.nextSibling,Z=!1;return k}function oa(e,t,r){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[r],!i)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,r=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var s=0;s<e.display.view.length;s++){var k=e.display.view[s];if(k.node==i)return iu(k,t,r)}}function iu(e,t,r){var i=e.text.firstChild,s=!1;if(!t||!E(i,t))return ln(Ve(kt(e.line),0),!0);if(t==i&&(s=!0,t=i.childNodes[r],r=0,!t)){var k=e.rest?ie(e.rest):e.line;return ln(Ve(kt(k),k.text.length),s)}var K=t.nodeType==3?t:null,$=t;for(!K&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(K=t.firstChild,r&&(r=K.nodeValue.length));$.parentNode!=i;)$=$.parentNode;var Z=e.measure,ee=Z.maps;function fe(Qe,nt,ot){for(var at=-1;at<(ee?ee.length:0);at++)for(var ht=at<0?Z.map:ee[at],Et=0;Et<ht.length;Et+=3){var yt=ht[Et+2];if(yt==Qe||yt==nt){var At=kt(at<0?e.line:e.rest[at]),Xt=ht[Et]+ot;return(ot<0||yt!=Qe)&&(Xt=ht[Et+(ot?1:0)]),Ve(At,Xt)}}}var ge=fe(K,$,r);if(ge)return ln(ge,s);for(var Ie=$.nextSibling,Re=K?K.nodeValue.length-r:0;Ie;Ie=Ie.nextSibling){if(ge=fe(Ie,Ie.firstChild,0),ge)return ln(Ve(ge.line,ge.ch-Re),s);Re+=Ie.textContent.length}for(var je=$.previousSibling,Ke=r;je;je=je.previousSibling){if(ge=fe(je,je.firstChild,-1),ge)return ln(Ve(ge.line,ge.ch+Ke),s);Ke+=je.textContent.length}}var ii=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};ii.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),d&&(s.style.width="0px"),Ue(s,"input",function(){z&&W>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ue(s,"paste",function(K){if(ze(i,K)||To(K,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function k(K){if(ze(i,K))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),K.type=="cut"?i.setSelections($.ranges,null,pe):(r.prevInput="",s.value=$.text.join(`
`),j(s))}else return;K.type=="cut"&&(i.state.cutIncoming=+new Date)}Ue(s,"cut",k),Ue(s,"copy",k),Ue(e.scroller,"paste",function(K){if(hr(e,K)||ze(i,K))return;if(!s.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var $=new Event("paste");$.clipboardData=K.clipboardData,s.dispatchEvent($)}),Ue(e.lineSpace,"selectstart",function(K){hr(e,K)||te(K)}),Ue(s,"compositionstart",function(){var K=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:K,range:i.markText(K,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ue(s,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},ii.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ii.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var s=Qi(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),K=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+K.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+K.left-k.left))}return i},ii.prototype.showSelection=function(e){var t=this.cm,r=t.display;_(r.cursorDiv,e.cursors),_(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ii.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&j(this.textarea),z&&W>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",z&&W>=9&&(this.hasSelection=null))},ii.prototype.getField=function(){return this.textarea},ii.prototype.supportsTouch=function(){return!1},ii.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},ii.prototype.blur=function(){this.textarea.blur()},ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ii.prototype.receivedFocus=function(){this.slowPoll()},ii.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()})},ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ut(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=r.value;if(s==i&&!t.somethingSelected())return!1;if(z&&W>=9&&this.hasSelection===s||u&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=s.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var K=0,$=Math.min(i.length,s.length);K<$&&i.charCodeAt(K)==s.charCodeAt(K);)++K;return Ni(t,function(){za(t,s.slice(K),i.length-K,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ii.prototype.onKeyPress=function(){z&&W>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Nr(r,e),K=i.scroller.scrollTop;if(!k||p)return;var $=r.options.resetSelectionOnContextMenu;$&&r.doc.sel.contains(k)==-1&&hi(r,Ei)(r.doc,Sr(k),pe);var Z=s.style.cssText,ee=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.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 ge;M&&(ge=window.scrollY),i.input.focus(),M&&window.scrollTo(null,ge),i.input.reset(),r.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=Re,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Ie(){if(s.selectionStart!=null){var Ke=r.somethingSelected(),Qe="\u200B"+(Ke?s.value:"");s.value="\u21DA",s.value=Qe,t.prevInput=Ke?"":"\u200B",s.selectionStart=1,s.selectionEnd=Qe.length,i.selForContextMenu=r.doc.sel}}function Re(){if(t.contextMenuPending!=Re)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,s.style.cssText=Z,z&&W<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=K),s.selectionStart!=null){(!z||z&&W<9)&&Ie();var Ke=0,Qe=function(){i.selForContextMenu==r.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="\u200B"?hi(r,Vs)(r):Ke++<10?i.detectingSelectAll=setTimeout(Qe,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Qe,200)}}if(z&&W>=9&&Ie(),R){me(e);var je=function(){rt(window,"mouseup",je),setTimeout(Re,20)};Ue(window,"mouseup",je)}else setTimeout(Re,50)},ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ii.prototype.setUneditable=function(){},ii.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?v(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=N();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=$.getValue()}var s;if(e.form&&(Ue(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;s=k.submit;try{var K=k.submit=function(){i(),k.submit=s,k.submit(),k.submit=K}}catch(Z){}}t.finishInit=function(Z){Z.save=i,Z.getTextArea=function(){return e},Z.toTextArea=function(){Z.toTextArea=isNaN,i(),e.parentNode.removeChild(Z.getWrapperElement()),e.style.display="",e.form&&(rt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var $=Qt(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return $}function nu(e){e.off=rt,e.on=Ue,e.wheelEventPixels=dl,e.Doc=Li,e.splitLines=xt,e.countColumn=G,e.findColumn=Se,e.isWordChar=Ae,e.Pass=we,e.signal=Me,e.Line=Dr,e.changeEnd=Cr,e.scrollbarModel=xs,e.Pos=Ve,e.cmpPos=Tt,e.modes=Yt,e.mimeModes=Rt,e.resolveMode=qe,e.getMode=wt,e.modeExtensions=Ot,e.extendMode=Lt,e.copyState=qt,e.startState=er,e.innerMode=qi,e.commands=Mn,e.keyMap=dr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=an,e.normalizeKeyMap=Dl,e.StringStream=Bt,e.SharedTextMarker=kn,e.TextMarker=Or,e.LineWidget=In,e.e_preventDefault=te,e.e_stopPropagation=ne,e.e_stop=me,e.addClass=D,e.contains=E,e.rmClass=w,e.keyNames=Rr}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Li.prototype)Li.prototype.hasOwnProperty(la)&&re(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[la]));return Ee(Li),Qt.inputStyles={textarea:ii,contenteditable:Kt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),Ti.apply(this,arguments)},Qt.defineMIME=Ui,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Li.prototype[e]=t},Qt.fromTextArea=ru,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(ct,Ye,ae){"use strict";ae.r(Ye),ae.d(Ye,"ResizableTextArea",function(){return re});var le=ae("wx14"),J=ae("1OyB"),P=ae("vuIU"),Q=ae("Ji7U"),H=ae("LK+K"),F=ae("q1tI"),z=ae("VTBJ"),W=ae("rePB"),M=ae("Zm9Q"),O=ae("Kwbf"),g=ae("c+Xe"),p=ae("m+aA"),f=ae("bdgK"),h=new Map;function n(pe){pe.forEach(function(xe){var _e,Se=xe.target;(_e=h.get(Se))===null||_e===void 0||_e.forEach(function(ce){return ce(Se)})})}var d=new f.default(n),l=null,a=null;function u(pe,xe){h.has(pe)||(h.set(pe,new Set),d.observe(pe)),h.get(pe).add(xe)}function c(pe,xe){h.has(pe)&&(h.get(pe).delete(xe),h.get(pe).size||(d.unobserve(pe),h.delete(pe)))}var L=function(pe){Object(Q.a)(_e,pe);var xe=Object(H.a)(_e);function _e(){return Object(J.a)(this,_e),xe.apply(this,arguments)}return Object(P.a)(_e,[{key:"render",value:function(){return this.props.children}}]),_e}(F.Component),S=F.createContext(null);function T(pe){var xe=pe.children,_e=pe.onBatchResize,Se=F.useRef(0),ce=F.useRef([]),ue=F.useContext(S),ie=F.useCallback(function(de,se,Oe){Se.current+=1;var ke=Se.current;ce.current.push({size:de,element:se,data:Oe}),Promise.resolve().then(function(){ke===Se.current&&(_e==null||_e(ce.current),ce.current=[])}),ue==null||ue(de,se,Oe)},[_e,ue]);return F.createElement(S.Provider,{value:ie},xe)}function R(pe){var xe=pe.children,_e=pe.disabled,Se=F.useRef(null),ce=F.useRef(null),ue=F.useContext(S),ie=F.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=F.isValidElement(xe)&&Object(g.c)(xe),se=de?xe.ref:null,Oe=F.useMemo(function(){return Object(g.a)(se,Se)},[se,Se]),ke=F.useRef(pe);ke.current=pe;var Te=F.useCallback(function(Ae){var Le=ke.current,Be=Le.onResize,Fe=Le.data,De=Ae.getBoundingClientRect(),Ne=De.width,Xe=De.height,Ze=Ae.offsetWidth,Je=Ae.offsetHeight,$e=Math.floor(Ne),lt=Math.floor(Xe);if(ie.current.width!==$e||ie.current.height!==lt||ie.current.offsetWidth!==Ze||ie.current.offsetHeight!==Je){var tt={width:$e,height:lt,offsetWidth:Ze,offsetHeight:Je};ie.current=tt;var it=Ze===Math.round(Ne)?Ne:Ze,Ue=Je===Math.round(Xe)?Xe:Je,dt=Object(z.a)(Object(z.a)({},tt),{},{offsetWidth:it,offsetHeight:Ue});ue==null||ue(dt,Ae,Fe),Be&&Promise.resolve().then(function(){Be(dt,Ae)})}},[]);return F.useEffect(function(){var Ae=Object(p.a)(Se.current)||Object(p.a)(ce.current);return Ae&&!_e&&u(Ae,Te),function(){return c(Ae,Te)}},[Se.current,_e]),F.createElement(L,{ref:ce},de?F.cloneElement(xe,{ref:Oe}):xe)}var C="rc-observer-key";function w(pe){var xe=pe.children,_e=Object(M.a)(xe);return _e.map(function(Se,ce){var ue=(Se==null?void 0:Se.key)||"".concat(C,"-").concat(ce);return F.createElement(R,Object(le.a)({},pe,{key:ue}),Se)})}w.Collection=T;var x=w,_=ae("bT9E"),o=ae("TSYQ"),b=ae.n(o),m=`
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={},D;function B(pe){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(xe&&N[_e])return N[_e];var Se=window.getComputedStyle(pe),ce=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),ie=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),de=E.map(function(Oe){return"".concat(Oe,":").concat(Se.getPropertyValue(Oe))}).join(";"),se={sizingStyle:de,paddingSize:ue,borderSize:ie,boxSizing:ce};return xe&&_e&&(N[_e]=se),se}function j(pe){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),pe.getAttribute("wrap")?D.setAttribute("wrap",pe.getAttribute("wrap")):D.removeAttribute("wrap");var ce=B(pe,xe),ue=ce.paddingSize,ie=ce.borderSize,de=ce.boxSizing,se=ce.sizingStyle;D.setAttribute("style","".concat(se,";").concat(m)),D.value=pe.value||pe.placeholder||"";var Oe=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,Te=D.scrollHeight,Ae;if(de==="border-box"?Te+=ie:de==="content-box"&&(Te-=ue),_e!==null||Se!==null){D.value=" ";var Le=D.scrollHeight-ue;_e!==null&&(Oe=Le*_e,de==="border-box"&&(Oe=Oe+ue+ie),Te=Math.max(Oe,Te)),Se!==null&&(ke=Le*Se,de==="border-box"&&(ke=ke+ue+ie),Ae=Te>ke?"":"hidden",Te=Math.min(ke,Te))}return{height:Te,minHeight:Oe,maxHeight:ke,overflowY:Ae,resize:"none"}}var I=ae("Gytx"),v=ae.n(I),G;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(G||(G={}));var Y=function(pe){Object(Q.a)(_e,pe);var xe=Object(H.a)(_e);function _e(Se){var ce;return Object(J.a)(this,_e),ce=xe.call(this,Se),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(ue){ce.textArea=ue},ce.handleResize=function(ue){var ie=ce.state.resizeStatus,de=ce.props,se=de.autoSize,Oe=de.onResize;if(ie!==G.NONE)return;typeof Oe=="function"&&Oe(ue),se&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var ue=ce.props.autoSize;if(!ue||!ce.textArea)return;var ie=ue.minRows,de=ue.maxRows,se=j(ce.textArea,!1,ie,de);ce.setState({textareaStyles:se,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:G.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:G.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var ue=ce.props,ie=ue.prefixCls,de=ie===void 0?"rc-textarea":ie,se=ue.autoSize,Oe=ue.onResize,ke=ue.className,Te=ue.disabled,Ae=ce.state,Le=Ae.textareaStyles,Be=Ae.resizeStatus,Fe=Object(_.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=b()(de,ke,Object(W.a)({},"".concat(de,"-disabled"),Te));"value"in Fe&&(Fe.value=Fe.value||"");var Ne=Object(z.a)(Object(z.a)(Object(z.a)({},ce.props.style),Le),Be===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return F.createElement(x,{onResize:ce.handleResize,disabled:!(se||Oe)},F.createElement("textarea",Object(le.a)({},Fe,{className:De,style:Ne,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:G.NONE},ce}return Object(P.a)(_e,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!v()(ce.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 ce=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,ue)}}catch(ie){}}},{key:"render",value:function(){return this.renderTextArea()}}]),_e}(F.Component),re=Y,oe=function(pe){Object(Q.a)(_e,pe);var xe=Object(H.a)(_e);function _e(Se){var ce;Object(J.a)(this,_e),ce=xe.call(this,Se),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(ie){ce.resizableTextArea=ie},ce.handleChange=function(ie){var de=ce.props.onChange;ce.setValue(ie.target.value,function(){ce.resizableTextArea.resizeTextarea()}),de&&de(ie)},ce.handleKeyDown=function(ie){var de=ce.props,se=de.onPressEnter,Oe=de.onKeyDown;ie.keyCode===13&&se&&se(ie),Oe&&Oe(ie)};var ue=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return ce.state={value:ue},ce}return Object(P.a)(_e,[{key:"setValue",value:function(ce,ue){"value"in this.props||this.setState({value:ce},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return F.createElement(re,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),_e}(F.Component),we=Ye.default=oe},ZW9T:function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return j});var le=ae("k1fw"),J=ae("miYZ"),P=ae("tsqr"),Q=ae("rAM+"),H=ae("tJVT"),F=ae("PpiC"),z=ae("q1tI"),W=ae.n(z),M=ae("bdgK"),O=ae("oBTY"),g=ae("9og8"),p=ae("WmNS"),f=ae.n(p),h={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},n={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},a=ae("5VLF"),u=ae.n(a),c={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},L=function(v,G){return G.map(function(Y){return{label:Y,kind:v.languages.CompletionItemKind.Keyword,insertText:Y}})},S=function(v){return Object.keys(c.tables).map(function(G){return{label:G,kind:v.languages.CompletionItemKind.Variable,insertText:G}})},T=function(v,G){var Y=c.tables[v];return Y?Y.map(function(re){return{label:re,kind:G.languages.CompletionItemKind.Field,insertText:re}}):[]};function R(I,v,G,Y,re){var oe=v.getWordUntilPosition(G),we={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:oe.startColumn,endColumn:oe.endColumn},pe=Y.map(function(xe){return{label:xe,kind:I.languages.CompletionItemKind.Keyword,insertText:xe,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:we}});return re.map(function(xe){pe.push(Object(le.a)(Object(le.a)({},xe),{},{range:we}))}),pe}var C=function(I){c.languages.map(function(re){return I.languages.registerDocumentFormattingEditProvider(re,{provideDocumentFormattingEdits:function(we,pe,xe){return Object(g.a)(f.a.mark(function _e(){var Se;return f.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return Se=u()(we.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),ue.abrupt("return",[{range:we.getFullModelRange(),text:Se}]);case 2:case"end":return ue.stop()}},_e)}))()}}),re});var v=d.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=l.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=n.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(O.a)(d.keywords),Object(O.a)(d.quickKey.map(function(re){return re.label}))),provideCompletionItems:function(oe,we){var pe=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),xe=pe.match(/cu/gim);console.log("match:",xe,we,pe,oe);var _e=[],Se=we.lineNumber,ce=we.column,ue=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:ce}),ie=ue.trim().split(/\s+/),de=ie[ie.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(_e=Object(O.a)(T(se,I)))}else de==="."?_e=[]:_e=[].concat(Object(O.a)(S(I)),Object(O.a)(L(I,d.keywords)),Object(O.a)(v));return{suggestions:_e}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(O.a)(h.keywords)),provideCompletionItems:function(oe,we){var pe=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),xe=pe.match(/cu/gim);console.log("match:",xe,we,pe,oe);var _e=[],Se=we.lineNumber,ce=we.column,ue=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:ce}),ie=ue.trim().split(/\s+/),de=ie[ie.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(_e=Object(O.a)(T(se,I)))}else de==="."?_e=[]:_e=[].concat(Object(O.a)(S(I)),Object(O.a)(L(I,h.keywords)));return{suggestions:_e}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(O.a)(n.keywords)),provideCompletionItems:function(oe,we){var pe=[],xe=we.lineNumber,_e=we.column,Se=oe.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:_e}),ce=Se.trim().split(/\s+/),ue=ce[ce.length-1];if(ue.endsWith(".")){var ie=ue.slice(0,ue.length-1);Object.keys(c.tables).includes(ie)&&(pe=Object(O.a)(T(ie,I)))}else ue==="."?pe=[]:pe=[].concat(Object(O.a)(S(I)),Object(O.a)(L(I,n.keywords)),Object(O.a)(Y));return{suggestions:pe}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(O.a)(l.keywords)),provideCompletionItems:function(oe,we){var pe=[],xe=we.lineNumber,_e=we.column,Se=oe.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:_e}),ce=Se.trim().split(/\s+/),ue=ce[ce.length-1];if(ue.endsWith(".")){var ie=ue.slice(0,ue.length-1);Object.keys(c.tables).includes(ie)&&(pe=Object(O.a)(T(ie,I)))}else ue==="."?pe=[]:pe=[].concat(Object(O.a)(S(I)),Object(O.a)(L(I,l.keywords)),Object(O.a)(G));return{suggestions:pe}}})},w="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",x=ae("LvDl"),_=ae("+ua5");function o(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function b(){}var m=!1,E={"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 N(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=I;if(Array.isArray(I)){for(var G=0;G<I.length;G++){var Y=E[I[G]];if(Y)return Y}return v[0]}return E[v]||v}var D=null,B=Ye.b=function(I){var v=I.width,G=v===void 0?"100%":v,Y=I.height,re=Y===void 0?"100%":Y,oe=I.value,we=I.language,pe=we===void 0?"javascript":we,xe=I.style,_e=xe===void 0?{}:xe,Se=I.options,ce=Se===void 0?{}:Se,ue=I.overrideServices,ie=ue===void 0?{}:ue,de=I.theme,se=de===void 0?"vs-dark":de,Oe=I.onEditBlur,ke=I.onSave,Te=I.autoHeight,Ae=Te===void 0?!1:Te,Le=I.forbidCopy,Be=Le===void 0?!1:Le,Fe=I.onChange,De=Fe===void 0?b:Fe,Ne=I.editorDidMount,Xe=Ne===void 0?b:Ne,Ze=I.onFocus,Je=Ze===void 0?b:Ze,$e=I.filename,lt=$e===void 0?"educoder.txt":$e,tt=I.errorLine,it=I.errorContent,Ue=it===void 0?"":it,dt=Object(F.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),rt=Object(z.useRef)(),Me=Object(z.useRef)({}),ze=Object(z.useRef)(),Ce=Object(z.useRef)(!1),ve=Object(z.useRef)(),Ee=Object(z.useState)(!1),te=Object(H.a)(Ee,2),ne=te[0],he=te[1];function me(){var qe;return rt.current&&(qe=new M.default(function(wt){var Ot=Object(Q.a)(wt),Lt;try{for(Ot.s();!(Lt=Ot.n()).done;){var qt=Lt.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&Me.current.instance.layout()}}catch(qi){Ot.e(qi)}finally{Ot.f()}}),qe.observe(rt.current)),qe}function be(){P.b.warn(decodeURIComponent(w))}var Pe=function(){var wt=Me.current.instance;if(oe!=null&&wt&&ne){var Ot=wt.getModel();Ot&&oe!==Ot.getValue()&&(m=!0,Ot.setValue(oe),wt.layout(),m=!1)}};Object(z.useEffect)(function(){ze.current&&clearTimeout(ze.current),ze.current=setTimeout(function(){Pe()},500)},[oe,ne,Me.current]),Object(z.useEffect)(function(){if(tt&&Me.current&&Me.current.instance){var qe=Me.current.instance;qe.changeViewZones(function(Ot){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=Ue,Ot.addZone({afterLineNumber:tt||11,heightInLines:3,domNode:Lt})});var wt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};qe.addOverlayWidget(wt),qe.revealPositionInCenter({lineNumber:20,column:1})}},[tt,Me.current,ne]);function We(){var qe=Me.current.instance;if(qe){var wt=qe.getSelection(),Ot=Me.current.pastePos||{},Lt=new D.Range(Ot.startLineNumber||wt.endLineNumber,Ot.startColumn||wt.endColumn,Ot.endLineNumber||wt.endLineNumber,Ot.endColumn||wt.endColumn);setTimeout(function(){qe.executeEdits("",[{range:Lt,text:""}])},300)}}function st(qe){(window.navigator.platform.match("Mac")?qe.metaKey:qe.ctrlKey)&&qe.keyCode==83&&(qe.preventDefault(),ke())}var ft=function(){if(Ae&&Me.current.instance){var wt=Me.current.instance.getContentHeight();Ti(wt<re?re:wt)}else Ti(re)};function pt(qe){var wt=document.createEvent("MouseEvents");wt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),qe.dispatchEvent(wt)}function Ct(qe,wt){var Ot=window.URL||window.webkitURL||window,Lt=new Blob([wt]),qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");qt.href=Ot.createObjectURL(Lt),qt.download=qe,pt(qt)}Object(z.useEffect)(function(){ft()},[ft]),Object(z.useEffect)(function(){rt.current&&!ne&&ae.e(27).then(ae.t.bind(null,"M/lh",7)).then(function(qe){try{D=qe,Me.current.instance=D.editor.create(rt.current,{value:oe,language:N(pe),theme:se,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},ie);var wt=Me.current.instance;if(Xe(wt,D),setTimeout(function(){ft(),Me.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ct(lt||"educoder.txt",wt.getValue())}})},500),Me.current.subscription=wt.onDidChangeModelContent(function(Lt){Ce.current?clearTimeout(ve.current):(ft(),De(wt.getValue(),Lt)),ve.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||C(D),Be&&(wt.addCommand(D.KeyMod.CtrlCmd|D.KeyMod.Shift|D.KeyCode.KEY_V,function(){return be(),null}),wt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_C,function(){return be(),null})),window.Monaco=D,Oe&&wt.onDidBlurEditorWidget(function(){Oe(wt.getValue())}),Je&&wt.onDidFocusEditorText(function(){Je(wt.getValue())}),Be){wt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_V,function(){return be(),null}),wt.onDidPaste(function(Lt){Me.current.pastePos=Lt});try{window.addEventListener("paste",We)}catch(Lt){}}var Ot=me();return he(!0),function(){var Lt=Me.current.instance;Lt.dispose();var qt=Lt.getModel();qt&&qt.dispose(),Me.current.subscription&&Me.current.subscription.dispose(),Be&&window.removeEventListener("paste",We),Ot.unobserve(rt.current)}}catch(Lt){}})},[]),Object(z.useEffect)(function(){var qe=Me.current.instance;if(qe&&ne)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[ke,ne]),Object(z.useEffect)(function(){var qe=Me.current.instance;if(qe&&ne){var wt=N(pe);D.editor.setModelLanguage(qe.getModel(),wt),console.log("language:",pe,qe.getModel(),wt)}},[pe,ne]),Object(z.useEffect)(function(){var qe=Me.current.instance;qe&&ne&&D.editor.setTheme(se)},[se,ne]),Object(z.useEffect)(function(){var qe=Me.current.instance;qe&&ne&&(qe.updateOptions(Object(le.a)({},ce)),setTimeout(function(){qe.getModel().updateOptions(Object(le.a)({},ce))},200))},[JSON.stringify(ce),ne]),Object(z.useEffect)(function(){var qe=Me.current.instance;qe&&ne&&qe.layout()},[G,re,ne]);var xt=Object(z.useState)(o(G)),ut=Object(H.a)(xt,2),Ut=ut[0],Mt=ut[1],Jt=Object(z.useState)(o(re)),Yt=Object(H.a)(Jt,2),Rt=Yt[0],Ti=Yt[1],Ui=Object(le.a)(Object(le.a)({},_e),{},{width:Ut,height:Rt});return W.a.createElement("div",{className:"my-monaco-editor",ref:rt,style:Ui})};function j(I){var v=I.width,G=v===void 0?"100%":v,Y=I.height,re=Y===void 0?"100%":Y,oe=I.original,we=I.modified,pe=I.language,xe=I.options,_e=xe===void 0?{}:xe,Se=Object(z.useRef)(),ce=Object(z.useState)(null),ue=Object(H.a)(ce,2),ie=ue[0],de=ue[1];function se(Ae){var Le;return Se.current&&(Le=new M.default(function(Be){var Fe=Object(Q.a)(Be),De;try{for(Fe.s();!(De=Fe.n()).done;){var Ne=De.value;(Ne.target.offsetHeight>0||Ne.target.offsetWidth>0)&&Ae.layout()}}catch(Xe){Fe.e(Xe)}finally{Fe.f()}}),Le.observe(Se.current)),Le}Object(z.useEffect)(function(){Se.current&&ae.e(27).then(ae.t.bind(null,"M/lh",7)).then(function(Ae){D=Ae;var Le=D.editor.createDiffEditor(Se.current,Object(le.a)(Object(le.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},_e),{},{wordWrap:!0}));de(Le);var Be=se(Le);return function(){Le.dispose();var Fe=Le.getModel();Fe&&Fe.dispose(),Be.unobserve(Se.current)}})},[]),Object(z.useEffect)(function(){ie&&ie.setModel({original:D.editor.createModel(oe,pe),modified:D.editor.createModel(we,pe)})},[oe,we,pe,ie]);var Oe=o(G),ke=o(re),Te={width:Oe,height:ke};return W.a.createElement("div",{className:"my-diff-editor",ref:Se,style:Te})}},ZpRC:function(ct,Ye,ae){"use strict";function le(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function J(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function P(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var f=getComputedStyle(g,null);return J(f.overflowY,p)||J(f.overflowX,p)||function(h){var n=function(d){if(!d.ownerDocument||!d.ownerDocument.defaultView)return null;try{return d.ownerDocument.defaultView.frameElement}catch(l){return null}}(h);return!!n&&(n.clientHeight<h.scrollHeight||n.clientWidth<h.scrollWidth)}(g)}return!1}function Q(g,p,f,h,n,d,l,a){return d<g&&l>p||d>g&&l<p?0:d<=g&&a<=f||l>=p&&a>=f?d-g-h:l>p&&a<f||d<g&&a>f?l-p+n:0}var H=function(g,p){var f=window,h=p.scrollMode,n=p.block,d=p.inline,l=p.boundary,a=p.skipOverflowHiddenElements,u=typeof l=="function"?l:function(Le){return Le!==l};if(!le(g))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,L=[],S=g;le(S)&&u(S);){if((S=S.parentElement)===c){L.push(S);break}S!=null&&S===document.body&&P(S)&&!P(document.documentElement)||S!=null&&P(S,a)&&L.push(S)}for(var T=f.visualViewport?f.visualViewport.width:innerWidth,R=f.visualViewport?f.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,x=g.getBoundingClientRect(),_=x.height,o=x.width,b=x.top,m=x.right,E=x.bottom,N=x.left,D=n==="start"||n==="nearest"?b:n==="end"?E:b+_/2,B=d==="center"?N+o/2:d==="end"?m:N,j=[],I=0;I<L.length;I++){var v=L[I],G=v.getBoundingClientRect(),Y=G.height,re=G.width,oe=G.top,we=G.right,pe=G.bottom,xe=G.left;if(h==="if-needed"&&b>=0&&N>=0&&E<=R&&m<=T&&b>=oe&&E<=pe&&N>=xe&&m<=we)return j;var _e=getComputedStyle(v),Se=parseInt(_e.borderLeftWidth,10),ce=parseInt(_e.borderTopWidth,10),ue=parseInt(_e.borderRightWidth,10),ie=parseInt(_e.borderBottomWidth,10),de=0,se=0,Oe="offsetWidth"in v?v.offsetWidth-v.clientWidth-Se-ue:0,ke="offsetHeight"in v?v.offsetHeight-v.clientHeight-ce-ie:0;if(c===v)de=n==="start"?D:n==="end"?D-R:n==="nearest"?Q(w,w+R,R,ce,ie,w+D,w+D+_,_):D-R/2,se=d==="start"?B:d==="center"?B-T/2:d==="end"?B-T:Q(C,C+T,T,Se,ue,C+B,C+B+o,o),de=Math.max(0,de+w),se=Math.max(0,se+C);else{de=n==="start"?D-oe-ce:n==="end"?D-pe+ie+ke:n==="nearest"?Q(oe,pe,Y,ce,ie+ke,D,D+_,_):D-(oe+Y/2)+ke/2,se=d==="start"?B-xe-Se:d==="center"?B-(xe+re/2)+Oe/2:d==="end"?B-we+ue+Oe:Q(xe,we,re,Se,ue+Oe,B,B+o,o);var Te=v.scrollLeft,Ae=v.scrollTop;D+=Ae-(de=Math.max(0,Math.min(Ae+de,v.scrollHeight-Y+ke))),B+=Te-(se=Math.max(0,Math.min(Te+se,v.scrollWidth-re+Oe)))}j.push({el:v,top:de,left:se})}return j};function F(g){return g===Object(g)&&Object.keys(g).length!==0}function z(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(h){var n=h.el,d=h.top,l=h.left;n.scroll&&f?n.scroll({top:d,left:l,behavior:p}):(n.scrollTop=d,n.scrollLeft=l)})}function W(g){return g===!1?{block:"end",inline:"nearest"}:F(g)?g:{block:"start",inline:"nearest"}}function M(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(F(p)&&typeof p.behavior=="function")return p.behavior(f?[]:H(g,p));if(f)return;var h=W(p);return z(H(g,h),h.behavior)}var O=Ye.a=M},Zss7:function(ct,Ye,ae){var le;(function(J){var P=/^\s+/,Q=/\s+$/,H=0,F=J.round,z=J.min,W=J.max,M=J.random;function O(ie,de){if(ie=ie||"",de=de||{},ie instanceof O)return ie;if(!(this instanceof O))return new O(ie,de);var se=g(ie);this._originalInput=ie,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=F(100*this._a)/100,this._format=de.format||se.format,this._gradientType=de.gradientType,this._r<1&&(this._r=F(this._r)),this._g<1&&(this._g=F(this._g)),this._b<1&&(this._b=F(this._b)),this._ok=se.ok,this._tc_id=H++}O.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 ie=this.toRgb();return(ie.r*299+ie.g*587+ie.b*114)/1e3},getLuminance:function(){var ie=this.toRgb(),de,se,Oe,ke,Te,Ae;return de=ie.r/255,se=ie.g/255,Oe=ie.b/255,de<=.03928?ke=de/12.92:ke=J.pow((de+.055)/1.055,2.4),se<=.03928?Te=se/12.92:Te=J.pow((se+.055)/1.055,2.4),Oe<=.03928?Ae=Oe/12.92:Ae=J.pow((Oe+.055)/1.055,2.4),.2126*ke+.7152*Te+.0722*Ae},setAlpha:function(ie){return this._a=j(ie),this._roundA=F(100*this._a)/100,this},toHsv:function(){var ie=n(this._r,this._g,this._b);return{h:ie.h*360,s:ie.s,v:ie.v,a:this._a}},toHsvString:function(){var ie=n(this._r,this._g,this._b),de=F(ie.h*360),se=F(ie.s*100),Oe=F(ie.v*100);return this._a==1?"hsv("+de+", "+se+"%, "+Oe+"%)":"hsva("+de+", "+se+"%, "+Oe+"%, "+this._roundA+")"},toHsl:function(){var ie=f(this._r,this._g,this._b);return{h:ie.h*360,s:ie.s,l:ie.l,a:this._a}},toHslString:function(){var ie=f(this._r,this._g,this._b),de=F(ie.h*360),se=F(ie.s*100),Oe=F(ie.l*100);return this._a==1?"hsl("+de+", "+se+"%, "+Oe+"%)":"hsla("+de+", "+se+"%, "+Oe+"%, "+this._roundA+")"},toHex:function(ie){return l(this._r,this._g,this._b,ie)},toHexString:function(ie){return"#"+this.toHex(ie)},toHex8:function(ie){return a(this._r,this._g,this._b,this._a,ie)},toHex8String:function(ie){return"#"+this.toHex8(ie)},toRgb:function(){return{r:F(this._r),g:F(this._g),b:F(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+F(this._r)+", "+F(this._g)+", "+F(this._b)+")":"rgba("+F(this._r)+", "+F(this._g)+", "+F(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:F(I(this._r,255)*100)+"%",g:F(I(this._g,255)*100)+"%",b:F(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%)":"rgba("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(ie){var de="#"+u(this._r,this._g,this._b,this._a),se=de,Oe=this._gradientType?"GradientType = 1, ":"";if(ie){var ke=O(ie);se="#"+u(ke._r,ke._g,ke._b,ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+Oe+"startColorstr="+de+",endColorstr="+se+")"},toString:function(ie){var de=!!ie;ie=ie||this._format;var se=!1,Oe=this._a<1&&this._a>=0,ke=!de&&Oe&&(ie==="hex"||ie==="hex6"||ie==="hex3"||ie==="hex4"||ie==="hex8"||ie==="name");return ke?ie==="name"&&this._a===0?this.toName():this.toRgbString():(ie==="rgb"&&(se=this.toRgbString()),ie==="prgb"&&(se=this.toPercentageRgbString()),(ie==="hex"||ie==="hex6")&&(se=this.toHexString()),ie==="hex3"&&(se=this.toHexString(!0)),ie==="hex4"&&(se=this.toHex8String(!0)),ie==="hex8"&&(se=this.toHex8String()),ie==="name"&&(se=this.toName()),ie==="hsl"&&(se=this.toHslString()),ie==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(ie,de){var se=ie.apply(null,[this].concat([].slice.call(de)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(c,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(ie,de){return ie.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},O.fromRatio=function(ie,de){if(typeof ie=="object"){var se={};for(var Oe in ie)ie.hasOwnProperty(Oe)&&(Oe==="a"?se[Oe]=ie[Oe]:se[Oe]=we(ie[Oe]));ie=se}return O(ie,de)};function g(ie){var de={r:0,g:0,b:0},se=1,Oe=null,ke=null,Te=null,Ae=!1,Le=!1;return typeof ie=="string"&&(ie=ce(ie)),typeof ie=="object"&&(Se(ie.r)&&Se(ie.g)&&Se(ie.b)?(de=p(ie.r,ie.g,ie.b),Ae=!0,Le=String(ie.r).substr(-1)==="%"?"prgb":"rgb"):Se(ie.h)&&Se(ie.s)&&Se(ie.v)?(Oe=we(ie.s),ke=we(ie.v),de=d(ie.h,Oe,ke),Ae=!0,Le="hsv"):Se(ie.h)&&Se(ie.s)&&Se(ie.l)&&(Oe=we(ie.s),Te=we(ie.l),de=h(ie.h,Oe,Te),Ae=!0,Le="hsl"),ie.hasOwnProperty("a")&&(se=ie.a)),se=j(se),{ok:Ae,format:ie.format||Le,r:z(255,W(de.r,0)),g:z(255,W(de.g,0)),b:z(255,W(de.b,0)),a:se}}function p(ie,de,se){return{r:I(ie,255)*255,g:I(de,255)*255,b:I(se,255)*255}}function f(ie,de,se){ie=I(ie,255),de=I(de,255),se=I(se,255);var Oe=W(ie,de,se),ke=z(ie,de,se),Te,Ae,Le=(Oe+ke)/2;if(Oe==ke)Te=Ae=0;else{var Be=Oe-ke;Ae=Le>.5?Be/(2-Oe-ke):Be/(Oe+ke);switch(Oe){case ie:Te=(de-se)/Be+(de<se?6:0);break;case de:Te=(se-ie)/Be+2;break;case se:Te=(ie-de)/Be+4;break}Te/=6}return{h:Te,s:Ae,l:Le}}function h(ie,de,se){var Oe,ke,Te;ie=I(ie,360),de=I(de,100),se=I(se,100);function Ae(Fe,De,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?Fe+(De-Fe)*6*Ne:Ne<1/2?De:Ne<2/3?Fe+(De-Fe)*(2/3-Ne)*6:Fe}if(de===0)Oe=ke=Te=se;else{var Le=se<.5?se*(1+de):se+de-se*de,Be=2*se-Le;Oe=Ae(Be,Le,ie+1/3),ke=Ae(Be,Le,ie),Te=Ae(Be,Le,ie-1/3)}return{r:Oe*255,g:ke*255,b:Te*255}}function n(ie,de,se){ie=I(ie,255),de=I(de,255),se=I(se,255);var Oe=W(ie,de,se),ke=z(ie,de,se),Te,Ae,Le=Oe,Be=Oe-ke;if(Ae=Oe===0?0:Be/Oe,Oe==ke)Te=0;else{switch(Oe){case ie:Te=(de-se)/Be+(de<se?6:0);break;case de:Te=(se-ie)/Be+2;break;case se:Te=(ie-de)/Be+4;break}Te/=6}return{h:Te,s:Ae,v:Le}}function d(ie,de,se){ie=I(ie,360)*6,de=I(de,100),se=I(se,100);var Oe=J.floor(ie),ke=ie-Oe,Te=se*(1-de),Ae=se*(1-ke*de),Le=se*(1-(1-ke)*de),Be=Oe%6,Fe=[se,Ae,Te,Te,Le,se][Be],De=[Le,se,se,Ae,Te,Te][Be],Ne=[Te,Te,Le,se,se,Ae][Be];return{r:Fe*255,g:De*255,b:Ne*255}}function l(ie,de,se,Oe){var ke=[oe(F(ie).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16))];return Oe&&ke[0].charAt(0)==ke[0].charAt(1)&&ke[1].charAt(0)==ke[1].charAt(1)&&ke[2].charAt(0)==ke[2].charAt(1)?ke[0].charAt(0)+ke[1].charAt(0)+ke[2].charAt(0):ke.join("")}function a(ie,de,se,Oe,ke){var Te=[oe(F(ie).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16)),oe(pe(Oe))];return ke&&Te[0].charAt(0)==Te[0].charAt(1)&&Te[1].charAt(0)==Te[1].charAt(1)&&Te[2].charAt(0)==Te[2].charAt(1)&&Te[3].charAt(0)==Te[3].charAt(1)?Te[0].charAt(0)+Te[1].charAt(0)+Te[2].charAt(0)+Te[3].charAt(0):Te.join("")}function u(ie,de,se,Oe){var ke=[oe(pe(Oe)),oe(F(ie).toString(16)),oe(F(de).toString(16)),oe(F(se).toString(16))];return ke.join("")}O.equals=function(ie,de){return!ie||!de?!1:O(ie).toRgbString()==O(de).toRgbString()},O.random=function(){return O.fromRatio({r:M(),g:M(),b:M()})};function c(ie,de){de=de===0?0:de||10;var se=O(ie).toHsl();return se.s-=de/100,se.s=v(se.s),O(se)}function L(ie,de){de=de===0?0:de||10;var se=O(ie).toHsl();return se.s+=de/100,se.s=v(se.s),O(se)}function S(ie){return O(ie).desaturate(100)}function T(ie,de){de=de===0?0:de||10;var se=O(ie).toHsl();return se.l+=de/100,se.l=v(se.l),O(se)}function R(ie,de){de=de===0?0:de||10;var se=O(ie).toRgb();return se.r=W(0,z(255,se.r-F(255*-(de/100)))),se.g=W(0,z(255,se.g-F(255*-(de/100)))),se.b=W(0,z(255,se.b-F(255*-(de/100)))),O(se)}function C(ie,de){de=de===0?0:de||10;var se=O(ie).toHsl();return se.l-=de/100,se.l=v(se.l),O(se)}function w(ie,de){var se=O(ie).toHsl(),Oe=(se.h+de)%360;return se.h=Oe<0?360+Oe:Oe,O(se)}function x(ie){var de=O(ie).toHsl();return de.h=(de.h+180)%360,O(de)}function _(ie){var de=O(ie).toHsl(),se=de.h;return[O(ie),O({h:(se+120)%360,s:de.s,l:de.l}),O({h:(se+240)%360,s:de.s,l:de.l})]}function o(ie){var de=O(ie).toHsl(),se=de.h;return[O(ie),O({h:(se+90)%360,s:de.s,l:de.l}),O({h:(se+180)%360,s:de.s,l:de.l}),O({h:(se+270)%360,s:de.s,l:de.l})]}function b(ie){var de=O(ie).toHsl(),se=de.h;return[O(ie),O({h:(se+72)%360,s:de.s,l:de.l}),O({h:(se+216)%360,s:de.s,l:de.l})]}function m(ie,de,se){de=de||6,se=se||30;var Oe=O(ie).toHsl(),ke=360/se,Te=[O(ie)];for(Oe.h=(Oe.h-(ke*de>>1)+720)%360;--de;)Oe.h=(Oe.h+ke)%360,Te.push(O(Oe));return Te}function E(ie,de){de=de||6;for(var se=O(ie).toHsv(),Oe=se.h,ke=se.s,Te=se.v,Ae=[],Le=1/de;de--;)Ae.push(O({h:Oe,s:ke,v:Te})),Te=(Te+Le)%1;return Ae}O.mix=function(ie,de,se){se=se===0?0:se||50;var Oe=O(ie).toRgb(),ke=O(de).toRgb(),Te=se/100,Ae={r:(ke.r-Oe.r)*Te+Oe.r,g:(ke.g-Oe.g)*Te+Oe.g,b:(ke.b-Oe.b)*Te+Oe.b,a:(ke.a-Oe.a)*Te+Oe.a};return O(Ae)},O.readability=function(ie,de){var se=O(ie),Oe=O(de);return(J.max(se.getLuminance(),Oe.getLuminance())+.05)/(J.min(se.getLuminance(),Oe.getLuminance())+.05)},O.isReadable=function(ie,de,se){var Oe=O.readability(ie,de),ke,Te;Te=!1,ke=ue(se);switch(ke.level+ke.size){case"AAsmall":case"AAAlarge":Te=Oe>=4.5;break;case"AAlarge":Te=Oe>=3;break;case"AAAsmall":Te=Oe>=7;break}return Te},O.mostReadable=function(ie,de,se){var Oe=null,ke=0,Te,Ae,Le,Be;se=se||{},Ae=se.includeFallbackColors,Le=se.level,Be=se.size;for(var Fe=0;Fe<de.length;Fe++)Te=O.readability(ie,de[Fe]),Te>ke&&(ke=Te,Oe=O(de[Fe]));return O.isReadable(ie,Oe,{level:Le,size:Be})||!Ae?Oe:(se.includeFallbackColors=!1,O.mostReadable(ie,["#fff","#000"],se))};var N=O.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"},D=O.hexNames=B(N);function B(ie){var de={};for(var se in ie)ie.hasOwnProperty(se)&&(de[ie[se]]=se);return de}function j(ie){return ie=parseFloat(ie),(isNaN(ie)||ie<0||ie>1)&&(ie=1),ie}function I(ie,de){Y(ie)&&(ie="100%");var se=re(ie);return ie=z(de,W(0,parseFloat(ie))),se&&(ie=parseInt(ie*de,10)/100),J.abs(ie-de)<1e-6?1:ie%de/parseFloat(de)}function v(ie){return z(1,W(0,ie))}function G(ie){return parseInt(ie,16)}function Y(ie){return typeof ie=="string"&&ie.indexOf(".")!=-1&&parseFloat(ie)===1}function re(ie){return typeof ie=="string"&&ie.indexOf("%")!=-1}function oe(ie){return ie.length==1?"0"+ie:""+ie}function we(ie){return ie<=1&&(ie=ie*100+"%"),ie}function pe(ie){return J.round(parseFloat(ie)*255).toString(16)}function xe(ie){return G(ie)/255}var _e=function(){var ie="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",se="(?:"+de+")|(?:"+ie+")",Oe="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",ke="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+Oe),rgba:new RegExp("rgba"+ke),hsl:new RegExp("hsl"+Oe),hsla:new RegExp("hsla"+ke),hsv:new RegExp("hsv"+Oe),hsva:new RegExp("hsva"+ke),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Se(ie){return!!_e.CSS_UNIT.exec(ie)}function ce(ie){ie=ie.replace(P,"").replace(Q,"").toLowerCase();var de=!1;if(N[ie])ie=N[ie],de=!0;else if(ie=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=_e.rgb.exec(ie))?{r:se[1],g:se[2],b:se[3]}:(se=_e.rgba.exec(ie))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=_e.hsl.exec(ie))?{h:se[1],s:se[2],l:se[3]}:(se=_e.hsla.exec(ie))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=_e.hsv.exec(ie))?{h:se[1],s:se[2],v:se[3]}:(se=_e.hsva.exec(ie))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=_e.hex8.exec(ie))?{r:G(se[1]),g:G(se[2]),b:G(se[3]),a:xe(se[4]),format:de?"name":"hex8"}:(se=_e.hex6.exec(ie))?{r:G(se[1]),g:G(se[2]),b:G(se[3]),format:de?"name":"hex"}:(se=_e.hex4.exec(ie))?{r:G(se[1]+""+se[1]),g:G(se[2]+""+se[2]),b:G(se[3]+""+se[3]),a:xe(se[4]+""+se[4]),format:de?"name":"hex8"}:(se=_e.hex3.exec(ie))?{r:G(se[1]+""+se[1]),g:G(se[2]+""+se[2]),b:G(se[3]+""+se[3]),format:de?"name":"hex"}:!1}function ue(ie){var de,se;return ie=ie||{level:"AA",size:"small"},de=(ie.level||"AA").toUpperCase(),se=(ie.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:de,size:se}}ct.exports?ct.exports=O:!(le=function(){return O}.call(Ye,ae,Ye,ct),le!==void 0&&(ct.exports=le))})(Math)},bT9E:function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return J});var le=ae("VTBJ");function J(P,Q){var H=Object(le.a)({},P);return Array.isArray(Q)&&Q.forEach(function(F){delete H[F]}),H}},c5Ni:function(ct,Ye,ae){},dejd:function(ct,Ye,ae){},dmUQ:function(ct,Ye,ae){"use strict";var le=ae("Ff2n"),J=ae("rePB"),P=ae("1OyB"),Q=ae("vuIU"),H=ae("Ji7U"),F=ae("md7G"),z=ae("foSv"),W=ae("q1tI"),M=ae.n(W),O=ae("TSYQ"),g=ae.n(O),p=ae("4IlW");function f(_,o){var b=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);o&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),b.push.apply(b,m)}return b}function h(_){for(var o=1;o<arguments.length;o++){var b=arguments[o]!=null?arguments[o]:{};o%2?f(Object(b),!0).forEach(function(m){Object(J.a)(_,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(b)):f(Object(b)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(b,m))})}return _}function n(_){var o=d();return function(){var m=Object(z.a)(_),E;if(o){var N=Object(z.a)(this).constructor;E=Reflect.construct(m,arguments,N)}else E=m.apply(this,arguments);return Object(F.a)(this,E)}}function d(){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(_){return!1}}function l(){}function a(_){_.preventDefault()}var u=function(o){return o.replace(/[^\w.-]+/g,"")},c=200,L=600,S=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(o){return o!=null},R=function(o,b){return b===o||typeof b=="number"&&typeof o=="number"&&isNaN(b)&&isNaN(o)},C=function(_){Object(H.a)(b,_);var o=n(b);function b(m){var E;Object(P.a)(this,b),E=o.call(this,m),E.onKeyDown=function(B){var j=E.props,I=j.onKeyDown,v=j.onPressEnter;if(B.keyCode===p.a.UP){var G=E.getRatio(B);E.up(B,G,null),E.stop()}else if(B.keyCode===p.a.DOWN){var Y=E.getRatio(B);E.down(B,Y,null),E.stop()}else B.keyCode===p.a.ENTER&&v&&v(B);if(E.recordCursorPosition(),E.lastKeyCode=B.keyCode,I){for(var re=arguments.length,oe=new Array(re>1?re-1:0),we=1;we<re;we++)oe[we-1]=arguments[we];I.apply(void 0,[B].concat(oe))}},E.onKeyUp=function(B){var j=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),j){for(var I=arguments.length,v=new Array(I>1?I-1:0),G=1;G<I;G++)v[G-1]=arguments[G];j.apply(void 0,[B].concat(v))}},E.onChange=function(B){var j=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(B)),E.setState({inputValue:E.rawInput}),j(E.toNumber(E.rawInput))},E.onMouseUp=function(){var B=E.props.onMouseUp;E.recordCursorPosition(),B&&B.apply(void 0,arguments)},E.onFocus=function(){var B;E.setState({focused:!0}),(B=E.props).onFocus.apply(B,arguments)},E.onBlur=function(){var B=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var j=E.getCurrentValidValue(E.state.inputValue),I=E.setValue(j,l);if(B){var v=E.input.value,G=E.getInputDisplayValue({focus:!1,value:I});E.input.value=G&&Number(G),B.apply(void 0,arguments),E.input.value=v}},E.getRatio=function(B){var j=1;return B.metaKey||B.ctrlKey?j=.1:B.shiftKey&&(j=10),j},E.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},E.getPrecision=function(B){if(T(E.props.precision))return E.props.precision;var j=String(B);if(j.indexOf("e-")>=0)return parseInt(j.slice(j.indexOf("e-")+2),10);var I=0;return j.indexOf(".")>=0&&(I=j.length-j.indexOf(".")-1),I},E.getInputDisplayValue=function(B){var j=B||E.state,I=j.focused,v=j.inputValue,G=j.value,Y;I?Y=v:Y=E.toPrecisionAsStep(G),Y==null&&(Y="");var re=E.formatWrapper(Y);return T(E.props.decimalSeparator)&&(re=re.toString().replace(".",E.props.decimalSeparator)),re},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(B){}},E.restoreByAfter=function(B){if(B===void 0)return!1;var j=E.input.value,I=j.lastIndexOf(B);if(I===-1)return!1;var v=E.cursorBefore.length;return E.lastKeyCode===p.a.DELETE&&E.cursorBefore.charAt(v-1)===B[0]?(E.fixCaret(v,v),!0):I+B.length===j.length?(E.fixCaret(I,I),!0):!1},E.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(j,I){var v=B.substring(I);return E.restoreByAfter(v)})},E.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(B,j,I){E.pressingUpOrDown=!0,E.step("down",B,j,I)},E.up=function(B,j,I){E.pressingUpOrDown=!0,E.step("up",B,j,I)},E.saveInput=function(B){E.input=B};var N=m.value;N===void 0&&(N=m.defaultValue),E.state={focused:m.autoFocus};var D=E.getValidValue(E.toNumber(N));return E.state=h(h({},E.state),{},{inputValue:E.toPrecisionAsStep(D),value:D}),E}return Object(Q.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,D=N.value,B=N.onChange,j=N.max,I=N.min,v=this.state.focused;if(E){if(!R(E.value,D)||!R(E.max,j)||!R(E.min,I)){var G=v?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=G:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Y})}var re="value"in this.props?D:this.state.value;"max"in this.props&&E.max!==j&&typeof re=="number"&&re>j&&B&&B(j),"min"in this.props&&E.min!==I&&typeof re=="number"&&re<I&&B&&B(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(we){}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 T(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,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(E);return isNaN(B)?E:(B<N&&(B=N),B>D&&(B=D),B)}},{key:"setValue",value:function(E,N){var D=this.props.precision,B=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),j=this.state.value,I=j===void 0?null:j,v=this.state.inputValue,G=v===void 0?null:v,Y=typeof B=="number"?B.toFixed(D):"".concat(B),re=B!==I||Y!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},N)):this.setState({value:B,inputValue:this.toPrecisionAsStep(E)},N),re&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,B=D.precision,j=D.step;if(T(B))return B;var I=this.getPrecision(N),v=this.getPrecision(j),G=this.getPrecision(E);return E?Math.max(G,I+v):I+v}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(E,N);return Math.pow(10,D)}},{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,D=this.state.focused,B=E&&E.length>16&&D;return this.isNotCompleteNumber(E)||B?E:T(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var D=this.props.step,B=this.getPrecisionFactor(E,N),j=Math.abs(this.getMaxPrecision(E,N)),I=((B*E+B*D*N)/B).toFixed(j);return this.toNumber(I)}},{key:"downStep",value:function(E,N){var D=this.props.step,B=this.getPrecisionFactor(E,N),j=Math.abs(this.getMaxPrecision(E,N)),I=((B*E-B*D*N)/B).toFixed(j);return this.toNumber(I)}},{key:"step",value:function(E,N){var D=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var I=this.props;if(I.disabled)return;var v=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(v))return;var G=this["".concat(E,"Step")](v,B),Y=G>I.max||G<I.min;if(G>I.max?G=I.max:G<I.min&&(G=I.min),this.setValue(G,null),this.setState({focused:!0},function(){D.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){D[E](N,B,!0)},j?c:L)}},{key:"fixCaret",value:function(E,N){if(E===void 0||N===void 0||!this.input||!this.input.value)return;try{var D=this.input.selectionStart,B=this.input.selectionEnd;(E!==D||N!==B)&&this.input.setSelectionRange(E,N)}catch(j){}}},{key:"render",value:function(){var E,N=this.props,D=N.prefixCls,B=N.disabled,j=N.readOnly,I=N.useTouch,v=N.autoComplete,G=N.upHandler,Y=N.downHandler,re=N.className,oe=N.max,we=N.min,pe=N.style,xe=N.title,_e=N.onMouseEnter,Se=N.onMouseLeave,ce=N.onMouseOver,ue=N.onMouseOut,ie=N.required,de=N.onClick,se=N.tabIndex,Oe=N.type,ke=N.placeholder,Te=N.id,Ae=N.inputMode,Le=N.pattern,Be=N.step,Fe=N.maxLength,De=N.autoFocus,Ne=N.name,Xe=N.onPaste,Ze=N.onInput,Je=Object(le.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,lt=$e.value,tt=$e.focused,it=g()(D,(E={},Object(J.a)(E,re,!!re),Object(J.a)(E,"".concat(D,"-disabled"),B),Object(J.a)(E,"".concat(D,"-focused"),tt),E)),Ue={};Object.keys(Je).forEach(function(me){(me.substr(0,5)==="data-"||me.substr(0,5)==="aria-"||me==="role")&&(Ue[me]=Je[me])});var dt=!j&&!B,rt=this.getInputDisplayValue(null),Me=(lt||lt===0)&&(isNaN(lt)||Number(lt)>=oe),ze=(lt||lt===0)&&(isNaN(lt)||Number(lt)<=we),Ce=Me||B||j,ve=ze||B||j,Ee=g()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(J.a)({},"".concat(D,"-handler-up-disabled"),Ce)),te=g()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(J.a)({},"".concat(D,"-handler-down-disabled"),ve)),ne=I?{onTouchStart:Ce?l:this.up,onTouchEnd:this.stop}:{onMouseDown:Ce?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=I?{onTouchStart:ve?l:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:it,style:pe,title:xe,onMouseEnter:_e,onMouseLeave:Se,onMouseOver:ce,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(D,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":Ce,className:Ee}),G||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:a})),M.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:te}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:a}))),M.a.createElement("div",{className:"".concat(D,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":we,"aria-valuemax":oe,"aria-valuenow":lt,required:ie,type:Oe,placeholder:ke,onPaste:Xe,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:se,autoComplete:v,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:dt?this.onKeyDown:l,onKeyUp:dt?this.onKeyUp:l,autoFocus:De,maxLength:Fe,readOnly:j,disabled:B,max:oe,min:we,step:Be,name:Ne,title:xe,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(rt),pattern:Le,inputMode:Ae,onInput:Ze},Ue))))}}]),b}(M.a.Component);C.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:u,required:!1,autoComplete:"off"};var w=C,x=Ye.a=w},gMzb:function(ct,Ye,ae){"use strict";var le=ae("k1fw"),J=ae("oBTY"),P=ae("9og8"),Q=ae("tJVT"),H=ae("sRBo"),F=ae("kaz8"),z=ae("WmNS"),W=ae.n(z),M=ae("q1tI"),O=ae.n(M),g=ae("9kvl"),p=ae("wlus"),f=ae("w5pM"),h=ae("ErOA"),n=ae("OaEy"),d=ae("2fM7"),l=ae("y8nQ"),a=ae("Vl3Y"),u=ae("Ty5D"),c=ae("yQHh"),L=ae.n(c),S=F.a.Group,T=function(o){var b,m,E,N,D,B,j,I,v=o.classroomList,G=o.loading,Y=o.user,re=o.exercise_id,oe=re===void 0?null:re,we=o.homework_common_id,pe=we===void 0?null:we,xe=o.setitem,_e=o.item,Se=o.type,ce=o.rz,ue=o.dispatch,ie=Object(M.useState)([]),de=Object(Q.a)(ie,2),se=de[0],Oe=de[1],ke=Object(M.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),Te=Object(Q.a)(ke,2),Ae=Te[0],Le=Te[1],Be=Object(u.i)(),Fe=Object(M.useState)(!1),De=Object(Q.a)(Fe,2),Ne=De[0],Xe=De[1],Ze=Object(M.useState)(!1),Je=Object(Q.a)(Ze,2),$e=Je[0],lt=Je[1],tt=a.a.useForm(),it=Object(Q.a)(tt,1),Ue=it[0];Object(M.useEffect)(function(){ce&&(Ae.zydatas=ce,Le(Object(le.a)({},Ae)),_e!=null&&_e.ec_course_id&&dt())},[_e,ce]);function dt(){return rt.apply(this,arguments)}function rt(){return rt=Object(P.a)(W.a.mark(function te(){return W.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return console.log("----",_e),he.next=3,Me(_e==null?void 0:_e.ec_major_school_id);case 3:return he.next=5,Ce(_e==null?void 0:_e.ec_year_id);case 5:return he.next=7,Ee(_e==null?void 0:_e.ec_course_id);case 7:Ue.setFieldsValue({ec_course_id:_e==null?void 0:_e.ec_course_id,ec_major_school_id:_e==null?void 0:_e.ec_major_school_id,ec_point_ids:_e==null?void 0:_e.ec_point_ids,ec_year_id:_e==null?void 0:_e.ec_year_id});case 8:case"end":return he.stop()}},te)})),rt.apply(this,arguments)}function Me(te){return ze.apply(this,arguments)}function ze(){return ze=Object(P.a)(W.a.mark(function te(ne){var he;return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:return be.next=2,Object(h.a)("/api/ec_major_schools/".concat(ne,"/ec_years/get_year_list.json"),{method:"get"});case 2:he=be.sent,Ae.jbdatas=he==null?void 0:he.data,Le(Object(le.a)({},Ae)),Ue.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return be.stop()}},te)})),ze.apply(this,arguments)}function Ce(te){return ve.apply(this,arguments)}function ve(){return ve=Object(P.a)(W.a.mark(function te(ne){var he;return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:return be.next=2,Object(h.a)("/api/ec_years/".concat(ne,"/ec_courses/get_courses.json"),{method:"get"});case 2:he=be.sent,Ae.kcdatas=he==null?void 0:he.data,Le(Object(le.a)({},Ae)),Ue.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return be.stop()}},te)})),ve.apply(this,arguments)}var Ee=function(){var te=Object(P.a)(W.a.mark(function ne(he){var me;return W.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,Object(h.a)("/api/ec_courses/".concat(he,"/ec_points.json"),{method:"get",params:{ec_course_id:he}});case 2:me=Pe.sent,Ae.zsdatas=me==null?void 0:me.data,Le(Object(le.a)({},Ae));case 5:case"end":return Pe.stop()}},ne)}));return function(he){return te.apply(this,arguments)}}();return O.a.createElement("div",{className:L.a.from},O.a.createElement(a.a,{form:Ue,layout:"inline",onValuesChange:function(ne){console.log("----",ne),ne.ec_major_school_id&&(Ae.jbdatas=[],Ae.kcdatas=[],Ae.zsdatas=[],Le(Object(le.a)({},Ae)),Me(ne.ec_major_school_id)),ne.ec_year_id&&(Ae.kcdatas=[],Ae.zsdatas=[],Le(Object(le.a)({},Ae)),Ce(ne.ec_year_id)),ne.ec_course_id&&(Ae.zsdatas=[],Le(Object(le.a)({},Ae)),Ee(ne.ec_course_id))},onFinish:function(){var te=Object(P.a)(W.a.mark(function ne(he){return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:xe(he);case 1:case"end":return be.stop()}},ne)}));return function(ne){return te.apply(this,arguments)}}()},O.a.createElement(a.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},O.a.createElement(d.a,{style:{width:150},disabled:((b=Ae.zydatas)===null||b===void 0?void 0:b.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},Ae==null||((m=Ae.zydatas)===null||m===void 0)?void 0:m.map(function(te,ne){return O.a.createElement(d.a.Option,{key:ne,value:te==null?void 0:te.ec_major_school_id},te==null?void 0:te.name)}))),O.a.createElement(a.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},O.a.createElement(d.a,{style:{width:150},disabled:((E=Ae.jbdatas)===null||E===void 0?void 0:E.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},Ae==null||((N=Ae.jbdatas)===null||N===void 0)?void 0:N.map(function(te,ne){return O.a.createElement(d.a.Option,{key:ne,value:te==null?void 0:te.ec_year_id},te==null?void 0:te.year)}))),O.a.createElement(a.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},O.a.createElement(d.a,{style:{width:150},disabled:((D=Ae.kcdatas)===null||D===void 0?void 0:D.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},Ae==null||((B=Ae.kcdatas)===null||B===void 0)?void 0:B.map(function(te,ne){return O.a.createElement(d.a.Option,{key:ne,value:te==null?void 0:te.id},te==null?void 0:te.name)}))),O.a.createElement(a.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},O.a.createElement(d.a,{onChange:function(){Ue.submit()},style:{width:150},mode:"multiple",disabled:((j=Ae.zsdatas)===null||j===void 0?void 0:j.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},Ae==null||((I=Ae.zsdatas)===null||I===void 0)?void 0:I.map(function(te,ne){return O.a.createElement(d.a.Option,{key:ne,value:te==null?void 0:te.id},te==null?void 0:te.name)})))))},R=Object(g.a)(function(_){var o=_.classroomList,b=_.loading,m=_.globalSetting,E=_.user;return{classroomList:o,globalSetting:m,loading:b.effects,user:E}})(T),C=F.a.Group,w=function(o){var b,m,E,N=o.classroomList,D=o.loading,B=o.user,j=o.exercise_id,I=j===void 0?null:j,v=o.homework_common_id,G=v===void 0?null:v,Y=o.setitem,re=o.type,oe=o.dispatch,we=Object(M.useState)([{}]),pe=Object(Q.a)(we,2),xe=pe[0],_e=pe[1],Se=Object(M.useState)([]),ce=Object(Q.a)(Se,2),ue=ce[0],ie=ce[1];function de(){return se.apply(this,arguments)}function se(){return se=Object(P.a)(W.a.mark(function Te(){var Ae,Le,Be,Fe,De;return W.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Object(h.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:I,homework_common_id:G}});case 2:Le=Xe.sent,(Le==null||((Ae=Le.data)===null||Ae===void 0)?void 0:Ae.length)>0&&(De=[],Le==null||((Be=Le.data)===null||Be===void 0)||Be.map(function(Ze){var Je;Ze==null||((Je=Ze.ec_point_ids)===null||Je===void 0)||Je.map(function($e){De.push($e)})}),Y(Object(le.a)(Object(le.a)({},Le==null||((Fe=Le.data)===null||Fe===void 0)?void 0:Fe[0]),{},{ec_point_ids:De})),_e(Le==null?void 0:Le.data));case 4:case"end":return Xe.stop()}},Te)})),se.apply(this,arguments)}Object(M.useEffect)(function(){var Te,Ae;B!=null&&(Te=B.userInfo)!==null&&Te!==void 0&&(Ae=Te.course)!==null&&Ae!==void 0&&Ae.course_school_id&&Oe()},[B==null||((b=B.userInfo)===null||b===void 0||((m=b.course)===null||m===void 0))?void 0:m.course_school_id]);function Oe(){return ke.apply(this,arguments)}function ke(){return ke=Object(P.a)(W.a.mark(function Te(){var Ae,Le,Be;return W.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,Object(h.a)("/api/schools/".concat(B==null||((Ae=B.userInfo)===null||Ae===void 0||((Le=Ae.course)===null||Le===void 0))?void 0:Le.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Be=De.sent,ie(Be==null?void 0:Be.data),(G||I)&&de();case 5:case"end":return De.stop()}},Te)})),ke.apply(this,arguments)}return console.log(xe),O.a.createElement("div",{style:{display:(E=B.userInfo.course)!==null&&E!==void 0&&E.is_openengineering?"":"none"}},O.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),xe==null?void 0:xe.map(function(Te,Ae){return O.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},O.a.createElement(R,{rz:ue,item:Te,type:Ae,setitem:function(Be){xe.splice(Ae,1,Be),_e(Object(J.a)(xe));var Fe=[];xe==null||xe.map(function(De){var Ne;De==null||((Ne=De.ec_point_ids)===null||Ne===void 0)||Ne.map(function(Xe){Fe.push(Xe)})}),Y(Object(le.a)(Object(le.a)({},Be),{},{ec_point_ids:Fe}))}}),Ae!=0&&O.a.createElement(p.a,{onClick:function(){xe.splice(Ae,1),_e(Object(J.a)(xe))},style:{marginLeft:10,fontSize:"20px"}}),O.a.createElement(f.a,{onClick:function(){xe.push({}),_e(Object(J.a)(xe))},style:{marginLeft:10,fontSize:"20px"}}))}))},x=Ye.a=Object(g.a)(function(_){var o=_.classroomList,b=_.loading,m=_.globalSetting,E=_.user;return{classroomList:o,globalSetting:m,loading:b.effects,user:E}})(w)},gnOq:function(ct,Ye,ae){"use strict";ae.r(Ye);var le=ae("+L6B"),J=ae("2/Rp"),P=ae("5NDa"),Q=ae("5rEg"),H=ae("sPJy"),F=ae("bE4q"),z=ae("k1fw"),W=ae("9og8"),M=ae("y8nQ"),O=ae("Vl3Y"),g=ae("tJVT"),p=ae("WmNS"),f=ae.n(p),h=ae("q1tI"),n=ae.n(h),d=ae("9kvl"),l=ae("55Ip"),a=ae("Ot1p"),u=ae("XYT7"),c=ae("we55"),L=ae.n(c),S=ae("500L"),T=ae("1vsH"),R=ae("gMzb"),C=ae("ErOA"),w=function(_){var o,b=_.shixunHomeworks,m=_.newCourse,E=_.globalSetting,N=_.loading,D=_.dispatch,B=_.match,j=O.a.useForm(),I=Object(g.a)(j,1),v=I[0],G=Object(h.useState)({}),Y=Object(g.a)(G,2),re=Y[0],oe=Y[1],we=Object(h.useState)(),pe=Object(g.a)(we,2),xe=pe[0],_e=pe[1],Se=Object(h.useRef)(),ce=b.commonHomeWorkAddDefaultData,ue=Object(h.useState)({}),ie=Object(g.a)(ue,2),de=ie[0],se=ie[1];Object(h.useEffect)(function(){var Le;setTimeout(function(){document.body.scrollIntoView()},300);var Be=B.params,Fe=Be.coursesId,De=Be.categoryId;Se.current=(Le=B.params)===null||Le===void 0?void 0:Le.courseId,_e(!!Se.current),Se.current&&Oe(),D({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:De,coursesId:Fe,type:1}})},[]);var Oe=function(){var Le=Object(W.a)(f.a.mark(function Be(){var Fe;return f.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return Ne.next=2,D({type:"newCourse/getEditCourseData",payload:{id:Se.current}});case 2:Fe=Ne.sent,Fe&&(v.setFieldsValue({name:Fe.name}),v.setFieldsValue({intro:Fe.description}),v.setFieldsValue({notice:Fe.learning_notes}),oe({name:Fe.name,intro:Fe.description,notice:Fe.learning_notes}));case 4:case"end":return Ne.stop()}},Be)}));return function(){return Le.apply(this,arguments)}}(),ke=function(){var Le=Object(W.a)(f.a.mark(function Be(Fe){var De,Ne,Xe,Ze,Je,$e,lt;return f.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:return De=Object(z.a)({},re),De.attachment_ids&&(De.attachment_ids=De==null||((Ne=De.attachment_ids)===null||Ne===void 0)?void 0:Ne.map(function(Ue){return Ue.response.id})),De.reference_attachment_ids&&(De.reference_attachment_ids=De==null||((Xe=De.reference_attachment_ids)===null||Xe===void 0)?void 0:Xe.map(function(Ue){return Ue.response.id})),Ze=B.params,Je=Ze.coursesId,$e=Ze.categoryId,it.next=6,Object(u.a)(Object(z.a)(Object(z.a)({coursesId:Je,category:$e},De),{},{base_on_project:!0,type:1}));case 6:lt=it.sent,(lt==null?void 0:lt.status)===0&&(Te(lt.homework_id),Object(T.cb)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),d.d.push("/classrooms/".concat(B.params.coursesId,"/common_homework/").concat(lt.homework_id,"/detail")));case 8:case"end":return it.stop()}},Be)}));return function(Fe){return Le.apply(this,arguments)}}();function Te(Le){return Ae.apply(this,arguments)}function Ae(){return Ae=Object(W.a)(f.a.mark(function Le(Be){var Fe;return f.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(de!=null&&de.ec_point_ids){Ne.next=2;break}return Ne.abrupt("return");case 2:return Ne.next=4,Object(C.a)("/api/ec_courses/".concat(de==null?void 0:de.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(z.a)({homework_common_id:Be},de)});case 4:Fe=Ne.sent;case 5:case"end":return Ne.stop()}},Le)})),Ae.apply(this,arguments)}return n.a.createElement("section",{className:L.a.bg},ce.course_name&&n.a.createElement("section",{className:"animated fadeIn"},n.a.createElement("aside",{className:"mt10"},ce.category&&n.a.createElement(F.a,{separator:">"},n.a.createElement(F.a.Item,null,n.a.createElement(l.a,{to:"/classrooms/".concat(ce.course_id,"/common_homework")},ce.course_name)),n.a.createElement(F.a.Item,null,n.a.createElement(l.a,{to:"/classrooms/".concat(ce.course_id,"/common_homework")},ce.category.category_name)),n.a.createElement(F.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),n.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),n.a.createElement(O.a,{form:v,className:L.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",v.getFieldsValue()),oe(Object(z.a)({},v.getFieldsValue()))},onFinish:ke},n.a.createElement("div",{className:L.a.fieldWrap},n.a.createElement(O.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},n.a.createElement(Q.a,{maxLength:60,suffix:"".concat(((o=re.name)===null||o===void 0?void 0:o.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),n.a.createElement("div",{className:L.a.mdWrap},n.a.createElement(O.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"}]},n.a.createElement(a.a,{watch:!0,defaultValue:re.intro})),n.a.createElement("div",null,n.a.createElement(O.a.Item,{name:"attachment_ids"},n.a.createElement(S.b,null)))),n.a.createElement("div",{className:L.a.mdWrap},n.a.createElement(O.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},n.a.createElement(a.a,{watch:!0,defaultValue:re.notice})),n.a.createElement("div",null,n.a.createElement(O.a.Item,{name:"reference_attachment_ids"},n.a.createElement(S.b,null))))),n.a.createElement("div",{className:L.a.mdWrap},n.a.createElement(R.a,{setitem:function(Be){return se(Object(z.a)({},Be))}})),n.a.createElement("div",{className:L.a.backgroundFa},n.a.createElement("div",{className:"pt40 mb30"},n.a.createElement(O.a.Item,null,n.a.createElement(J.a,{size:"large",type:"primary",className:"".concat(L.a.button," mr20"),htmlType:"submit",onClick:function(){v.submit()},loading:N["newCourse/editCourse"]||N["newCourse/submitCourse"]},"\u63D0\u4EA4"),n.a.createElement(J.a,{size:"large",type:"primary",ghost:!0,className:L.a.button,onClick:function(){return d.d.push("/classrooms/".concat(B.params.coursesId,"/common_homework"))}},"\u53D6\u6D88")))))};Ye.default=Object(d.a)(function(x){var _=x.shixunHomeworks,o=x.newCourse,b=x.loading,m=x.globalSetting;return{shixunHomeworks:_,newCourse:o,globalSetting:m,loading:b.effects}})(w)},h78n:function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return E});var le=ae("q1tI"),J=ae.n(le),P=ae("TSYQ"),Q=ae.n(P),H={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},F=function(B){var j=B.map(function(){return Object(le.useRef)()}),I=Object(le.useRef)();return Object(le.useEffect)(function(){var v=Date.now(),G=!1;Object.keys(j).forEach(function(Y){var re=j[Y].current;if(!re)return;G=!0;var oe=re.style;oe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&v-I.current<100&&(oe.transitionDuration="0s, 0s")}),G&&(I.current=Date.now())}),[j]};function z(){return z=Object.assign||function(D){for(var B=1;B<arguments.length;B++){var j=arguments[B];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},z.apply(this,arguments)}function W(D,B){return f(D)||p(D,B)||O(D,B)||M()}function M(){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 O(D,B){if(!D)return;if(typeof D=="string")return g(D,B);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return g(D,B)}function g(D,B){(B==null||B>D.length)&&(B=D.length);for(var j=0,I=new Array(B);j<B;j++)I[j]=D[j];return I}function p(D,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,v=!1,G=void 0;try{for(var Y=D[Symbol.iterator](),re;!(I=(re=Y.next()).done)&&!(j.push(re.value),B&&j.length===B);I=!0);}catch(oe){v=!0,G=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(v)throw G}}return j}function f(D){if(Array.isArray(D))return D}function h(D,B){if(D==null)return{};var j=n(D,B),I,v;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(D);for(v=0;v<G.length;v++){if(I=G[v],B.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function n(D,B){if(D==null)return{};var j={},I=Object.keys(D),v,G;for(G=0;G<I.length;G++){if(v=I[G],B.indexOf(v)>=0)continue;j[v]=D[v]}return j}var d=function(B){var j=B.className,I=B.percent,v=B.prefixCls,G=B.strokeColor,Y=B.strokeLinecap,re=B.strokeWidth,oe=B.style,we=B.trailColor,pe=B.trailWidth,xe=B.transition,_e=h(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete _e.gapPosition;var Se=Array.isArray(I)?I:[I],ce=Array.isArray(G)?G:[G],ue=F(Se),ie=W(ue,1),de=ie[0],se=re/2,Oe=100-re/2,ke="M ".concat(Y==="round"?se:0,",").concat(se,`
L `).concat(Y==="round"?Oe:100,",").concat(se),Te="0 0 100 ".concat(re),Ae=0;return J.a.createElement("svg",z({className:Q()("".concat(v,"-line"),j),viewBox:Te,preserveAspectRatio:"none",style:oe},_e),J.a.createElement("path",{className:"".concat(v,"-line-trail"),d:ke,strokeLinecap:Y,stroke:we,strokeWidth:pe||re,fillOpacity:"0"}),Se.map(function(Le,Be){var Fe={strokeDasharray:"".concat(Le,"px, 100px"),strokeDashoffset:"-".concat(Ae,"px"),transition:xe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ce[Be]||ce[ce.length-1];return Ae+=Le,J.a.createElement("path",{key:Be,className:"".concat(v,"-line-path"),d:ke,strokeLinecap:Y,stroke:De,strokeWidth:re,fillOpacity:"0",ref:de[Be],style:Fe})}))};d.defaultProps=H;var l=d;function a(){return a=Object.assign||function(D){for(var B=1;B<arguments.length;B++){var j=arguments[B];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},a.apply(this,arguments)}function u(D,B){return R(D)||T(D,B)||L(D,B)||c()}function c(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(D,B){if(!D)return;if(typeof D=="string")return S(D,B);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return S(D,B)}function S(D,B){(B==null||B>D.length)&&(B=D.length);for(var j=0,I=new Array(B);j<B;j++)I[j]=D[j];return I}function T(D,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,v=!1,G=void 0;try{for(var Y=D[Symbol.iterator](),re;!(I=(re=Y.next()).done)&&!(j.push(re.value),B&&j.length===B);I=!0);}catch(oe){v=!0,G=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(v)throw G}}return j}function R(D){if(Array.isArray(D))return D}function C(D,B){if(D==null)return{};var j=w(D,B),I,v;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(D);for(v=0;v<G.length;v++){if(I=G[v],B.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function w(D,B){if(D==null)return{};var j={},I=Object.keys(D),v,G;for(G=0;G<I.length;G++){if(v=I[G],B.indexOf(v)>=0)continue;j[v]=D[v]}return j}var x=0;function _(D){return+D.replace("%","")}function o(D){return Array.isArray(D)?D:[D]}function b(D,B,j,I){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,Y=50-I/2,re=0,oe=-Y,we=0,pe=-2*Y;switch(G){case"left":re=-Y,oe=0,we=2*Y,pe=0;break;case"right":re=Y,oe=0,we=-2*Y,pe=0;break;case"bottom":oe=Y,pe=2*Y;break;default:}var xe="M 50,50 m ".concat(re,",").concat(oe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(we,",").concat(-pe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-we,",").concat(pe),_e=Math.PI*2*Y,Se={stroke:j,strokeDasharray:"".concat(B/100*(_e-v),"px ").concat(_e,"px"),strokeDashoffset:"-".concat(v/2+D/100*(_e-v),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:xe,pathStyle:Se}}var m=function(B){var j=B.prefixCls,I=B.strokeWidth,v=B.trailWidth,G=B.gapDegree,Y=B.gapPosition,re=B.trailColor,oe=B.strokeLinecap,we=B.style,pe=B.className,xe=B.strokeColor,_e=B.percent,Se=C(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(le.useMemo)(function(){return x+=1,x},[]),ue=b(0,100,re,I,G,Y),ie=ue.pathString,de=ue.pathStyle,se=o(_e),Oe=o(xe),ke=Oe.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),Te=F(se),Ae=u(Te,1),Le=Ae[0],Be=function(){var De=0;return se.map(function(Ne,Xe){var Ze=Oe[Xe]||Oe[Oe.length-1],Je=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(j,"-gradient-").concat(ce,")"):"",$e=b(De,Ne,Ze,I,G,Y);return De+=Ne,J.a.createElement("path",{key:Xe,className:"".concat(j,"-circle-path"),d:$e.pathString,stroke:Je,strokeLinecap:oe,strokeWidth:I,opacity:Ne===0?0:1,fillOpacity:"0",style:$e.pathStyle,ref:Le[Xe]})})};return J.a.createElement("svg",a({className:Q()("".concat(j,"-circle"),pe),viewBox:"0 0 100 100",style:we},Se),ke&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(j,"-gradient-").concat(ce),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ke).sort(function(Fe,De){return _(Fe)-_(De)}).map(function(Fe,De){return J.a.createElement("stop",{key:De,offset:Fe,stopColor:ke[Fe]})}))),J.a.createElement("path",{className:"".concat(j,"-circle-trail"),d:ie,stroke:re,strokeLinecap:oe,strokeWidth:v||I,fillOpacity:"0",style:de}),Be().reverse())};m.defaultProps=H;var E=m,N={Line:l,Circle:E}},kSUc:function(ct,Ye,ae){},lZu9:function(ct,Ye,ae){(function(le){le(ae("VrN/"),ae("1eCo"),ae("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(J,P){var Q=le.getMode(J,"text/html"),H=Q.name=="null";function F(I){if(le.findModeByName){var v=le.findModeByName(I);v&&(I=v.mime||v.mimes[0])}var G=le.getMode(J,I);return G.name=="null"?null:G}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.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 W in z)z.hasOwnProperty(W)&&P.tokenTypeOverrides[W]&&(z[W]=P.tokenTypeOverrides[W]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,n=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function u(I,v,G){return v.f=v.inline=G,G(I,v)}function c(I,v,G){return v.f=v.block=G,G(I,v)}function L(I){return!I||!/\S/.test(I.string)}function S(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==R){var v=H;if(!v){var G=le.innerMode(Q,I.htmlState);v=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}v&&(I.f=_,I.block=T,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function T(I,v){var G=I.column()===v.indentation,Y=L(v.prevLine.stream),re=v.indentedCode,oe=v.prevLine.hr,we=v.list!==!1,pe=(v.listStack[v.listStack.length-1]||0)+3;v.indentedCode=!1;var xe=v.indentation;if(v.indentationDiff===null&&(v.indentationDiff=v.indentation,we)){for(v.list=null;xe<v.listStack[v.listStack.length-1];)v.listStack.pop(),v.listStack.length?v.indentation=v.listStack[v.listStack.length-1]:v.list=!1;v.list!==!1&&(v.indentationDiff=xe-v.listStack[v.listStack.length-1])}var _e=!Y&&!oe&&!v.prevLine.header&&(!we||!re)&&!v.prevLine.fencedCodeEnd,Se=(v.list===!1||oe||Y)&&v.indentation<=pe&&I.match(M),ce=null;if(v.indentationDiff>=4&&(re||v.prevLine.fencedCodeEnd||v.prevLine.header||Y))return I.skipToEnd(),v.indentedCode=!0,z.code;if(I.eatSpace())return null;if(G&&v.indentation<=pe&&(ce=I.match(p))&&ce[1].length<=6)return v.quote=0,v.header=ce[1].length,v.thisLine.header=!0,P.highlightFormatting&&(v.formatting="header"),v.f=v.inline,w(v);if(v.indentation<=pe&&I.eat(">"))return v.quote=G?1:v.quote+1,P.highlightFormatting&&(v.formatting="quote"),I.eatSpace(),w(v);if(!Se&&!v.setext&&G&&v.indentation<=pe&&(ce=I.match(O))){var ue=ce[1]?"ol":"ul";return v.indentation=xe+I.current().length,v.list=!0,v.quote=0,v.listStack.push(v.indentation),v.em=!1,v.strong=!1,v.code=!1,v.strikethrough=!1,P.taskLists&&I.match(g,!1)&&(v.taskList=!0),v.f=v.inline,P.highlightFormatting&&(v.formatting=["list","list-"+ue]),w(v)}else{if(G&&v.indentation<=pe&&(ce=I.match(n,!0)))return v.quote=0,v.fencedEndRE=new RegExp(ce[1]+"+ *$"),v.localMode=P.fencedCodeBlockHighlighting&&F(ce[2]||P.fencedCodeBlockDefaultMode),v.localMode&&(v.localState=le.startState(v.localMode)),v.f=v.block=C,P.highlightFormatting&&(v.formatting="code-block"),v.code=-1,w(v);if(v.setext||(!_e||!we)&&!v.quote&&v.list===!1&&!v.code&&!Se&&!d.test(I.string)&&(ce=I.lookAhead(1))&&(ce=ce.match(f)))return v.setext?(v.header=v.setext,v.setext=0,I.skipToEnd(),P.highlightFormatting&&(v.formatting="header")):(v.header=ce[0].charAt(0)=="="?1:2,v.setext=v.header),v.thisLine.header=!0,v.f=v.inline,w(v);if(Se)return I.skipToEnd(),v.hr=!0,v.thisLine.hr=!0,z.hr;if(I.peek()==="[")return u(I,v,N)}return u(I,v,v.inline)}function R(I,v){var G=Q.token(I,v.htmlState);if(!H){var Y=le.innerMode(Q,v.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||v.md_inside&&I.current().indexOf(">")>-1)&&(v.f=_,v.block=T,v.htmlState=null)}return G}function C(I,v){var G=v.listStack[v.listStack.length-1]||0,Y=v.indentation<G,re=G+3;if(v.fencedEndRE&&v.indentation<=re&&(Y||I.match(v.fencedEndRE))){P.highlightFormatting&&(v.formatting="code-block");var oe;return Y||(oe=w(v)),v.localMode=v.localState=null,v.block=T,v.f=_,v.fencedEndRE=null,v.code=0,v.thisLine.fencedCodeEnd=!0,Y?c(I,v,v.block):oe}else return v.localMode?v.localMode.token(I,v.localState):(I.skipToEnd(),z.code)}function w(I){var v=[];if(I.formatting){v.push(z.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var G=0;G<I.formatting.length;G++)v.push(z.formatting+"-"+I.formatting[G]),I.formatting[G]==="header"&&v.push(z.formatting+"-"+I.formatting[G]+"-"+I.header),I.formatting[G]==="quote"&&(!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?v.push(z.formatting+"-"+I.formatting[G]+"-"+I.quote):v.push("error"))}if(I.taskOpen)return v.push("meta"),v.length?v.join(" "):null;if(I.taskClosed)return v.push("property"),v.length?v.join(" "):null;if(I.linkHref?v.push(z.linkHref,"url"):(I.strong&&v.push(z.strong),I.em&&v.push(z.em),I.strikethrough&&v.push(z.strikethrough),I.emoji&&v.push(z.emoji),I.linkText&&v.push(z.linkText),I.code&&v.push(z.code),I.image&&v.push(z.image),I.imageAltText&&v.push(z.imageAltText,"link"),I.imageMarker&&v.push(z.imageMarker)),I.header&&v.push(z.header,z.header+"-"+I.header),I.quote&&(v.push(z.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?v.push(z.quote+"-"+I.quote):v.push(z.quote+"-"+P.maxBlockquoteDepth)),I.list!==!1){var Y=(I.listStack.length-1)%3;Y?Y===1?v.push(z.list2):v.push(z.list3):v.push(z.list1)}return I.trailingSpaceNewLine?v.push("trailing-space-new-line"):I.trailingSpace&&v.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),v.length?v.join(" "):null}function x(I,v){return I.match(h,!0)?w(v):void 0}function _(I,v){var G=v.text(I,v);if(typeof G!="undefined")return G;if(v.list)return v.list=null,w(v);if(v.taskList){var Y=I.match(g,!0)[1]===" ";return Y?v.taskOpen=!0:v.taskClosed=!0,P.highlightFormatting&&(v.formatting="task"),v.taskList=!1,w(v)}if(v.taskOpen=!1,v.taskClosed=!1,v.header&&I.match(/^#+$/,!0))return P.highlightFormatting&&(v.formatting="header"),w(v);var re=I.next();if(v.linkTitle){v.linkTitle=!1;var oe=re;re==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(I.match(new RegExp(we),!0))return z.linkHref}if(re==="`"){var pe=v.formatting;P.highlightFormatting&&(v.formatting="code"),I.eatWhile("`");var xe=I.current().length;if(v.code==0&&(!v.quote||xe==1))return v.code=xe,w(v);if(xe==v.code){var _e=w(v);return v.code=0,_e}else return v.formatting=pe,w(v)}else if(v.code)return w(v);if(re==="\\"&&(I.next(),P.highlightFormatting)){var Se=w(v),ce=z.formatting+"-escape";return Se?Se+" "+ce:ce}if(re==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return v.imageMarker=!0,v.image=!0,P.highlightFormatting&&(v.formatting="image"),w(v);if(re==="["&&v.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return v.imageMarker=!1,v.imageAltText=!0,P.highlightFormatting&&(v.formatting="image"),w(v);if(re==="]"&&v.imageAltText){P.highlightFormatting&&(v.formatting="image");var Se=w(v);return v.imageAltText=!1,v.image=!1,v.inline=v.f=b,Se}if(re==="["&&!v.image)return v.linkText&&I.match(/^.*?\]/)||(v.linkText=!0,P.highlightFormatting&&(v.formatting="link")),w(v);if(re==="]"&&v.linkText){P.highlightFormatting&&(v.formatting="link");var Se=w(v);return v.linkText=!1,v.inline=v.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?b:_,Se}if(re==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=o,P.highlightFormatting&&(v.formatting="link");var Se=w(v);return Se?Se+=" ":Se="",Se+z.linkInline}if(re==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=o,P.highlightFormatting&&(v.formatting="link");var Se=w(v);return Se?Se+=" ":Se="",Se+z.linkEmail}if(P.xml&&re==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var ie=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ie)&&(v.md_inside=!0)}return I.backUp(1),v.htmlState=le.startState(Q),c(I,v,R)}if(P.xml&&re==="<"&&I.match(/^\/\w*?>/))return v.md_inside=!1,"tag";if(re==="*"||re==="_"){for(var de=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);de<3&&I.eat(re);)de++;var Oe=I.peek()||" ",ke=!/\s/.test(Oe)&&(!l.test(Oe)||/\s/.test(se)||l.test(se)),Te=!/\s/.test(se)&&(!l.test(se)||/\s/.test(Oe)||l.test(Oe)),Ae=null,Le=null;if(de%2&&(!v.em&&ke&&(re==="*"||!Te||l.test(se))?Ae=!0:v.em==re&&Te&&(re==="*"||!ke||l.test(Oe))&&(Ae=!1)),de>1&&(!v.strong&&ke&&(re==="*"||!Te||l.test(se))?Le=!0:v.strong==re&&Te&&(re==="*"||!ke||l.test(Oe))&&(Le=!1)),Le!=null||Ae!=null){P.highlightFormatting&&(v.formatting=Ae==null?"strong":Le==null?"em":"strong em"),Ae===!0&&(v.em=re),Le===!0&&(v.strong=re);var _e=w(v);return Ae===!1&&(v.em=!1),Le===!1&&(v.strong=!1),_e}}else if(re===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return w(v);I.backUp(1)}if(P.strikethrough){if(re==="~"&&I.eatWhile(re)){if(v.strikethrough){P.highlightFormatting&&(v.formatting="strikethrough");var _e=w(v);return v.strikethrough=!1,_e}else if(I.match(/^[^\s]/,!1))return v.strikethrough=!0,P.highlightFormatting&&(v.formatting="strikethrough"),w(v)}else if(re===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return w(v);I.backUp(2)}}if(P.emoji&&re===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){v.emoji=!0,P.highlightFormatting&&(v.formatting="emoji");var Be=w(v);return v.emoji=!1,Be}return re===" "&&(I.match(/^ +$/,!1)?v.trailingSpace++:v.trailingSpace&&(v.trailingSpaceNewLine=!0)),w(v)}function o(I,v){var G=I.next();if(G===">"){v.f=v.inline=_,P.highlightFormatting&&(v.formatting="link");var Y=w(v);return Y?Y+=" ":Y="",Y+z.linkInline}return I.match(/^[^>]+/,!0),z.linkInline}function b(I,v){if(I.eatSpace())return null;var G=I.next();return G==="("||G==="["?(v.f=v.inline=E(G==="("?")":"]"),P.highlightFormatting&&(v.formatting="link-string"),v.linkHref=!0,w(v)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(I){return function(v,G){var Y=v.next();if(Y===I){G.f=G.inline=_,P.highlightFormatting&&(G.formatting="link-string");var re=w(G);return G.linkHref=!1,re}return v.match(m[I]),G.linkHref=!0,w(G)}}function N(I,v){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(v.f=D,I.next(),P.highlightFormatting&&(v.formatting="link"),v.linkText=!0,w(v)):u(I,v,_)}function D(I,v){if(I.match(/^\]:/,!0)){v.f=v.inline=B,P.highlightFormatting&&(v.formatting="link");var G=w(v);return v.linkText=!1,G}return I.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function B(I,v){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?v.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),v.f=v.inline=_,z.linkHref+" url")}var j={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:_,text:x,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&le.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?le.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,v){if(v.formatting=!1,I!=v.thisLine.stream){if(v.header=0,v.hr=!1,I.match(/^\s*$/,!0))return S(v),null;if(v.prevLine=v.thisLine,v.thisLine={stream:I},v.taskList=!1,v.trailingSpace=0,v.trailingSpaceNewLine=!1,!v.localState&&(v.f=v.block,v.f!=R)){var G=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(v.indentation=G,v.indentationDiff=null,G>0)return null}}return v.f(I,v)},innerMode:function(I){return I.block==R?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:j}},indent:function(I,v,G){return I.block==R&&Q.indent?Q.indent(I.htmlState,v,G):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,v,G):le.Pass},blankLine:S,getType:w,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return j},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(ct,Ye,ae){(function(le){le(ae("VrN/"))})(function(le){"use strict";var J=le.Pos;function P(l,a){return l.line-a.line||l.ch-a.ch}var Q="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",H=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F=new RegExp("<(/?)(["+Q+"]["+H+"]*)","g");function z(l,a,u,c){this.line=a,this.ch=u,this.cm=l,this.text=l.getLine(a),this.min=c?Math.max(c.from,l.firstLine()):l.firstLine(),this.max=c?Math.min(c.to-1,l.lastLine()):l.lastLine()}function W(l,a){var u=l.cm.getTokenTypeAt(J(l.line,a));return u&&/\btag\b/.test(u)}function M(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function O(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function g(l){for(;;){var a=l.text.indexOf(">",l.ch);if(a==-1){if(M(l))continue;return}if(!W(l,a+1)){l.ch=a+1;continue}var u=l.text.lastIndexOf("/",a),c=u>-1&&!/\S/.test(l.text.slice(u+1,a));return l.ch=a+1,c?"selfClose":"regular"}}function p(l){for(;;){var a=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(a==-1){if(O(l))continue;return}if(!W(l,a+1)){l.ch=a;continue}F.lastIndex=a,l.ch=a;var u=F.exec(l.text);if(u&&u.index==a)return u}}function f(l){for(;;){F.lastIndex=l.ch;var a=F.exec(l.text);if(!a){if(M(l))continue;return}if(!W(l,a.index+1)){l.ch=a.index+1;continue}return l.ch=a.index+a[0].length,a}}function h(l){for(;;){var a=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(a==-1){if(O(l))continue;return}if(!W(l,a+1)){l.ch=a;continue}var u=l.text.lastIndexOf("/",a),c=u>-1&&!/\S/.test(l.text.slice(u+1,a));return l.ch=a+1,c?"selfClose":"regular"}}function n(l,a){for(var u=[];;){var c=f(l),L,S=l.line,T=l.ch-(c?c[0].length:0);if(!c||!(L=g(l)))return;if(L=="selfClose")continue;if(c[1]){for(var R=u.length-1;R>=0;--R)if(u[R]==c[2]){u.length=R;break}if(R<0&&(!a||a==c[2]))return{tag:c[2],from:J(S,T),to:J(l.line,l.ch)}}else u.push(c[2])}}function d(l,a){for(var u=[];;){var c=h(l);if(!c)return;if(c=="selfClose"){p(l);continue}var L=l.line,S=l.ch,T=p(l);if(!T)return;if(T[1])u.push(T[2]);else{for(var R=u.length-1;R>=0;--R)if(u[R]==T[2]){u.length=R;break}if(R<0&&(!a||a==T[2]))return{tag:T[2],from:J(l.line,l.ch),to:J(L,S)}}}}le.registerHelper("fold","xml",function(l,a){for(var u=new z(l,a.line,0);;){var c=f(u);if(!c||u.line!=a.line)return;var L=g(u);if(!L)return;if(!c[1]&&L!="selfClose"){var S=J(u.line,u.ch),T=n(u,c[2]);return T&&P(T.from,S)>0?{from:S,to:T.from}:null}}}),le.findMatchingTag=function(l,a,u){var c=new z(l,a.line,a.ch,u);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var L=g(c),S=L&&J(c.line,c.ch),T=L&&p(c);if(!L||!T||P(c,a)>0)return;var R={from:J(c.line,c.ch),to:S,tag:T[2]};return L=="selfClose"?{open:R,close:null,at:"open"}:T[1]?{open:d(c,T[2]),close:R,at:"close"}:(c=new z(l,S.line,S.ch,u),{open:R,close:n(c,T[2]),at:"open"})},le.findEnclosingTag=function(l,a,u,c){for(var L=new z(l,a.line,a.ch,u);;){var S=d(L,c);if(!S)break;var T=new z(l,a.line,a.ch,u),R=n(T,S.tag);if(R)return{open:S,close:R}}},le.scanForClosingTag=function(l,a,u,c){var L=new z(l,a.line,a.ch,c?{from:0,to:c}:null);return n(L,u)}})},p5ED:function(ct,Ye,ae){"use strict";var le=ae("+L6B"),J=ae("2/Rp"),P=ae("5Dmo"),Q=ae("3S7+"),H=ae("k1fw"),F=ae("tJVT"),z=ae("q1tI"),W=ae.n(z),M=ae("vHTk"),O=ae.n(M),g=ae("yEEn"),p=ae("ZW9T"),f=ae("1vsH");Ye.a=function(h){var n=h.name,d=h.data,l=h.theme,a=h.type,u=h.filename,c=h.monacoEditor,L=h.className,S=h.style,T=h.close,R=h.onClose,C=h.hasMask,w=Object(z.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),x=Object(F.a)(w,2),_=x[0],o=x[1],b=Object(z.useState)(""),m=Object(F.a)(b,2),E=m[0],N=m[1],D,B=1024*1024,j=10*B,I=Object(z.useRef)();a==="office"&&(D=Object(f.T)(d).filesize,D>j&&(a="other")),u&&(c.filename=u),Object(z.useEffect)(function(){var Y,re,oe=(Y=document.cookie)===null||Y===void 0||((re=Y.replace(/\s/g,""))===null||re===void 0)?void 0:re.split(";");oe==null||oe.map(function(we){var pe=we.split("=");pe[0]==="_educoder_session"&&N(pe[1])})},[]);var v=function(){if(d.startsWith("http")||d.startsWith("/")){G();return}Object(f.z)(u||"educoder",d,u)},G=function(){Object(f.x)(u||n,d)};return console.log("data:",d,"fileanme:",u," name:",n),W.a.createElement("div",{style:Object(H.a)({},S||{}),className:"".concat(C&&O.a.bgBlack," ").concat(a?O.a.wrp:"hide")},T&&W.a.createElement("div",{className:O.a.close,ref:I},W.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},W.a.createElement("span",{onClick:G},W.a.createElement("i",{className:"icon-quxiaozhiding"}))),W.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},W.a.createElement("span",{className:"",onClick:R},W.a.createElement("i",{className:"icon-guanbi1"})))),W.a.createElement("div",{className:"".concat(O.a[L]," ").concat(L," ").concat(O.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&W.a.createElement(p.b,c)),a==="audio"&&W.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),a==="video"&&W.a.createElement(W.a.Fragment,null,d!=null&&d.startsWith("/")?W.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):W.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),a==="html"&&W.a.createElement("iframe",{src:d+"&disposition=inline"}),a==="pdf"&&W.a.createElement("embed",{className:O.a.embed,src:d}),a==="image"&&W.a.createElement(W.a.Fragment,null,W.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),a==="other"&&W.a.createElement("div",null,W.a.createElement(J.a,{type:"primary",size:"large",onClick:v},W.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&W.a.createElement(J.a,{type:"primary",size:"large",onClick:v},W.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ct,Ye,ae){},psGv:function(ct,Ye,ae){var le,J;(function(){var P;(function(){"use strict";var z=[,,function(g){function p(n){this.__parent=n,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var n=new p(this.__parent);return n.set_indent(this.__indent_count,this.__alignment_count),n},p.prototype.item=function(n){return n<0?this.__items[this.__items.length+n]:this.__items[n]},p.prototype.has_match=function(n){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(n))return!0;return!1},p.prototype.set_indent=function(n,d){this.is_empty()&&(this.__indent_count=n||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var n=this.__parent.current_line;return n.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),n.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),n.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,n.__items[0]===" "&&(n.__items.splice(0,1),n.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(n){this.__items.push(n);var d=n.lastIndexOf(`
`);d!==-1?this.__character_count=n.length-d:this.__character_count+=n.length},p.prototype.pop=function(){var n=null;return this.is_empty()||(n=this.__items.pop(),this.__character_count-=n.length),n},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var n="";return this.is_empty()?this.__parent.indent_empty_lines&&(n=this.__parent.get_indent_string(this.__indent_count)):(n=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),n+=this.__items.join("")),n};function f(n,d){this.__cache=[""],this.__indent_size=n.indent_size,this.__indent_string=n.indent_char,n.indent_with_tabs||(this.__indent_string=new Array(n.indent_size+1).join(n.indent_char)),d=d||"",n.indent_level>0&&(d=new Array(n.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(n,d){var l=this.__base_string_length;return d=d||0,n<0&&(l=0),l+=n*this.__indent_size,l+=d,l},f.prototype.get_indent_string=function(n,d){var l=this.__base_string;return d=d||0,n<0&&(n=0,l=""),d+=n*this.__indent_size,this.__ensure_cache(d),l+=this.__cache[d],l},f.prototype.__ensure_cache=function(n){for(;n>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var n=this.__cache.length,d=0,l="";this.__indent_size&&n>=this.__indent_size&&(d=Math.floor(n/this.__indent_size),n-=d*this.__indent_size,l=new Array(d+1).join(this.__indent_string)),n&&(l+=new Array(n+1).join(" ")),this.__cache.push(l)};function h(n,d){this.__indent_cache=new f(n,d),this.raw=!1,this._end_with_newline=n.end_with_newline,this.indent_size=n.indent_size,this.wrap_line_length=n.wrap_line_length,this.indent_empty_lines=n.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(n,d){return this.__indent_cache.get_indent_string(n,d)},h.prototype.get_indent_size=function(n,d){return this.__indent_cache.get_indent_size(n,d)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(n){return this.is_empty()||!n&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(n){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
`);return n!==`
`&&(l=l.replace(/[\n]/g,n)),l},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(n,d){return n=n||0,d=d||0,this.next_line.set_indent(n,d),this.__lines.length>1?(this.current_line.set_indent(n,d),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(n){for(var d=0;d<n.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(n.whitespace_before),this.current_line.push(n.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(n){this.__add_space_before_token(),this.current_line.push(n),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(n){for(var d=this.__lines.length;n<d;)this.__lines[n]._remove_indent(),n++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(n){for(n=n===void 0?!1:n,this.current_line.trim();n&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(n,d){for(var l=this.__lines.length-2;l>=0;){var a=this.__lines[l];if(a.is_empty())break;if(a.item(0).indexOf(n)!==0&&a.item(-1)!==d){this.__lines.splice(l+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},g.exports.Output=h},function(g){function p(f,h,n,d){this.type=f,this.text=h,this.comments_before=null,this.newlines=n||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(n,d){this.raw_options=f(n,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(n,d){var l=this.raw_options[n],a=d||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(a=l.concat()):typeof l=="string"&&(a=l.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(n,d){var l=this.raw_options[n],a=l===void 0?!!d:!!l;return a},p.prototype._get_characters=function(n,d){var l=this.raw_options[n],a=d||"";return typeof l=="string"&&(a=l.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),a},p.prototype._get_number=function(n,d){var l=this.raw_options[n];d=parseInt(d,10),isNaN(d)&&(d=0);var a=parseInt(l,10);return isNaN(a)&&(a=d),a},p.prototype._get_selection=function(n,d,l){var a=this._get_selection_list(n,d,l);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+n+`' can only be one of the following values:
`+d+`
You passed in: '`+this.raw_options[n]+"'");return a[0]},p.prototype._get_selection_list=function(n,d,l){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[d[0]],!this._is_valid_selection(l,d))throw new Error("Invalid Default Value!");var a=this._get_array(n,l);if(!this._is_valid_selection(a,d))throw new Error("Invalid Option Value: The option '"+n+`' can contain only the following values:
`+d+`
You passed in: '`+this.raw_options[n]+"'");return a},p.prototype._is_valid_selection=function(n,d){return n.length&&d.length&&!n.some(function(l){return d.indexOf(l)===-1})};function f(n,d){var l={};n=h(n);var a;for(a in n)a!==d&&(l[a]=n[a]);if(d&&n[d])for(a in n[d])l[a]=n[d][a];return l}function h(n){var d={},l;for(l in n){var a=l.replace(/-/g,"_");d[a]=n[l]}return d}g.exports.Options=p,g.exports.normalizeOpts=h,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},f.prototype.peek=function(h){var n=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(n=this.__input.charAt(h)),n},f.prototype.__match=function(h,n){h.lastIndex=n;var d=h.exec(this.__input);return d&&!(p&&h.sticky)&&(d.index!==n&&(d=null)),d},f.prototype.test=function(h,n){return n=n||0,n+=this.__position,n>=0&&n<this.__input_length?!!this.__match(h,n):!1},f.prototype.testChar=function(h,n){var d=this.peek(n);return h.lastIndex=0,d!==null&&h.test(d)},f.prototype.match=function(h){var n=this.__match(h,this.__position);return n?this.__position+=n[0].length:n=null,n},f.prototype.read=function(h,n,d){var l="",a;return h&&(a=this.match(h),a&&(l+=a[0])),n&&(a||!h)&&(l+=this.readUntil(n,d)),l},f.prototype.readUntil=function(h,n){var d="",l=this.__position;h.lastIndex=this.__position;var a=h.exec(this.__input);return a?(l=a.index,n&&(l+=a[0].length)):l=this.__input_length,d=this.__input.substring(this.__position,l),this.__position=l,d},f.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},f.prototype.get_regexp=function(h,n){var d=null,l="g";return n&&p&&(l="y"),typeof h=="string"&&h!==""?d=new RegExp(h,l):h&&(d=new RegExp(h.source,l)),d},f.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(h){var n=this.__position,d=this.readUntilAfter(h);return this.__position=n,d},f.prototype.lookBack=function(h){var n=this.__position-1;return n>=h.length&&this.__input.substring(n-h.length,n).toLowerCase()===h},g.exports.InputScanner=f},function(g,p,f){var h=f(8).InputScanner,n=f(3).Token,d=f(10).TokenStream,l=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},u=function(c,L){this._input=new h(c),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};u.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var c,L=new n(a.START,""),S=null,T=[],R=new d;L.type!==a.EOF;){for(c=this._get_next_token(L,S);this._is_comment(c);)R.add(c),c=this._get_next_token(L,S);R.isEmpty()||(c.comments_before=R,R=new d),c.parent=S,this._is_opening(c)?(T.push(S),S=c):S&&this._is_closing(c,S)&&(c.opened=S,S.closed=c,S=T.pop(),c.parent=S),c.previous=L,L.next=c,this.__tokens.add(c),L=c}return this.__tokens},u.prototype._is_first_token=function(){return this.__tokens.isEmpty()},u.prototype._reset=function(){},u.prototype._get_next_token=function(c,L){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(a.RAW,S):this._create_token(a.EOF,"")},u.prototype._is_comment=function(c){return!1},u.prototype._is_opening=function(c){return!1},u.prototype._is_closing=function(c,L){return!1},u.prototype._create_token=function(c,L){var S=new n(c,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},u.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=u,g.exports.TOKEN=a},function(g){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},p.prototype.peek=function(f){var h=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(h=this.__tokens[f]),h},p.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},g.exports.TokenStream=p},function(g,p,f){var h=f(12).Pattern;function n(d,l){h.call(this,d,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}n.prototype=new h,n.prototype.__set_whitespace_patterns=function(d,l){d+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},n.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var l=this.__split(this._newline_regexp,d);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return d},n.prototype.matching=function(d,l){var a=this._create();return a.__set_whitespace_patterns(d,l),a._update(),a},n.prototype._create=function(){return new n(this._input,this)},n.prototype.__split=function(d,l){d.lastIndex=0;for(var a=0,u=[],c=d.exec(l);c;)u.push(l.substring(a,c.index)),a=c.index+c[0].length,c=d.exec(l);return a<l.length?u.push(l.substring(a,l.length)):u.push(""),u},g.exports.WhitespacePattern=n},function(g){function p(f,h){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}p.prototype.read=function(){var f=this._input.read(this._starting_pattern);return(!this._starting_pattern||f)&&(f+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),f},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(f){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.until=function(f){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.starting_with=function(f){var h=this._create();return h._starting_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype.matching=function(f){var h=this._create();return h._match_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},g.exports.Pattern=p},function(g){function p(f,h){f=typeof f=="string"?f:f.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+h,"g")}p.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(f);n;)h[n[1]]=n[2],n=this.__directive_pattern.exec(f);return h},p.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=p},function(g,p,f){var h=f(12).Pattern,n={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(l,a){h.call(this,l,a),this.__template_pattern=null,this._disabled=Object.assign({},n),this._excluded=Object.assign({},n),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var u=new h(l);this.__patterns={handlebars_comment:u.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:u.starting_with(/{{{/).until_after(/}}}/),handlebars:u.starting_with(/{{/).until_after(/}}/),php:u.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:u.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:u.starting_with(/{%/).until_after(/%}/),django_value:u.starting_with(/{{/).until_after(/}}/),django_comment:u.starting_with(/{#/).until_after(/#}/),smarty:u.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:u.starting_with(/{\*/).until_after(/\*}/),smarty_literal:u.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new h,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(l){var a=this._create();return a._disabled[l]=!0,a._update(),a},d.prototype.read_options=function(l){var a=this._create();for(var u in n)a._disabled[u]=l.templating.indexOf(u)===-1;return a._update(),a},d.prototype.exclude=function(l){var a=this._create();return a._excluded[l]=!0,a._update(),a},d.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),l+=a,a=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},d.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},d.prototype._read_template=function(){var l="",a=this._input.peek();if(a==="<"){var u=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&u==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&u==="%"&&(l=l||this.__patterns.erb.read())}else a==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},g.exports.TemplatablePattern=d},,,,function(g,p,f){var h=f(19).Beautifier,n=f(20).Options;function d(l,a,u,c){var L=new h(l,a,u,c);return L.beautify()}g.exports=d,g.exports.defaultOptions=function(){return new n}},function(g,p,f){var h=f(20).Options,n=f(2).Output,d=f(21).Tokenizer,l=f(21).TOKEN,a=/\r\n|[\r\n]/,u=/\r\n|[\r\n]/g,c=function(b,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=b.max_preserve_newlines,this.preserve_newlines=b.preserve_newlines,this._output=new n(b,m)};c.prototype.current_line_has_match=function(b){return this._output.current_line.has_match(b)},c.prototype.set_space_before_token=function(b,m){this._output.space_before_token=b,this._output.non_breaking_space=m},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(b){this._output.add_raw_token(b)},c.prototype.print_preserved_newlines=function(b){var m=0;b.type!==l.TEXT&&b.previous.type!==l.TEXT&&(m=b.newlines?1:0),this.preserve_newlines&&(m=b.newlines<this.max_preserve_newlines+1?b.newlines:this.max_preserve_newlines+1);for(var E=0;E<m;E++)this.print_newline(E>0);return m!==0},c.prototype.traverse_whitespace=function(b){return b.whitespace_before||b.newlines?(this.print_preserved_newlines(b)||(this._output.space_before_token=!0),!0):!1},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(b){this._output.add_new_line(b)},c.prototype.print_token=function(b){b.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(b.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(b){return b=this.indent_level+(b||0),b<1?"":this._output.get_indent_string(b)};var L=function(b){for(var m=null,E=b.next;E.type!==l.EOF&&b.closed!==E;){if(E.type===l.ATTRIBUTE&&E.text==="type"){E.next&&E.next.type===l.EQUALS&&E.next.next&&E.next.next.type===l.VALUE&&(m=E.next.next.text);break}E=E.next}return m},S=function(b,m){var E=null,N=null;return m.closed?(b==="script"?E="text/javascript":b==="style"&&(E="text/css"),E=L(m)||E,E.search("text/css")>-1?N="css":E.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":E.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":E.search(/test\/null/)>-1&&(N="null"),N):null};function T(b,m){return m.indexOf(b)!==-1}function R(b,m,E){this.parent=b||null,this.tag=m?m.tag_name:"",this.indent_level=E||0,this.parser_token=m||null}function C(b){this._printer=b,this._current_frame=null}C.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},C.prototype.record_tag=function(b){var m=new R(this._current_frame,b,this._printer.indent_level);this._current_frame=m},C.prototype._try_pop_frame=function(b){var m=null;return b&&(m=b.parser_token,this._printer.indent_level=b.indent_level,this._current_frame=b.parent),m},C.prototype._get_frame=function(b,m){for(var E=this._current_frame;E&&!(b.indexOf(E.tag)!==-1);){if(m&&m.indexOf(E.tag)!==-1){E=null;break}E=E.parent}return E},C.prototype.try_pop=function(b,m){var E=this._get_frame([b],m);return this._try_pop_frame(E)},C.prototype.indent_to_tag=function(b){var m=this._get_frame(b);m&&(this._printer.indent_level=m.indent_level)};function w(b,m,E,N){this._source_text=b||"",m=m||{},this._js_beautify=E,this._css_beautify=N,this._tag_stack=null;var D=new h(m,"html");this._options=D,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}w.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
`,b&&a.test(b)&&(m=b.match(a)[0])),b=b.replace(u,`
`);var E=b.match(/^[\t ]*/)[0],N={text:"",type:""},D=new x,B=new c(this._options,E),j=new d(b,this._options).tokenize();this._tag_stack=new C(B);for(var I=null,v=j.next();v.type!==l.EOF;)v.type===l.TAG_OPEN||v.type===l.COMMENT?(I=this._handle_tag_open(B,v,D,N),D=I):v.type===l.ATTRIBUTE||v.type===l.EQUALS||v.type===l.VALUE||v.type===l.TEXT&&!D.tag_complete?I=this._handle_inside_tag(B,v,D,j):v.type===l.TAG_CLOSE?I=this._handle_tag_close(B,v,D):v.type===l.TEXT?I=this._handle_text(B,v,D):B.add_raw_token(v),N=I,v=j.next();var G=B._output.get_code(m);return G},w.prototype._handle_tag_close=function(b,m,E){var N={text:m.text,type:m.type};return b.alignment_size=0,E.tag_complete=!0,b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),E.is_unformatted?b.add_raw_token(m):(E.tag_start_char==="<"&&(b.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&E.has_wrapped_attrs&&b.print_newline(!1)),b.print_token(m)),E.indent_content&&!(E.is_unformatted||E.is_content_unformatted)&&(b.indent(),E.indent_content=!1),!E.is_inline_element&&!(E.is_unformatted||E.is_content_unformatted)&&b.set_wrap_point(),N},w.prototype._handle_inside_tag=function(b,m,E,N){var D=E.has_wrapped_attrs,B={text:m.text,type:m.type};if(b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),E.is_unformatted)b.add_raw_token(m);else if(E.tag_start_char==="{"&&m.type===l.TEXT)b.print_preserved_newlines(m)?(m.newlines=0,b.add_raw_token(m)):b.print_token(m);else{if(m.type===l.ATTRIBUTE?(b.set_space_before_token(!0),E.attr_count+=1):(m.type===l.EQUALS||m.type===l.VALUE&&m.previous.type===l.EQUALS)&&b.set_space_before_token(!1),m.type===l.ATTRIBUTE&&E.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(b.traverse_whitespace(m),D=D||m.newlines!==0),this._is_wrap_attributes_force)){var j=E.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&E.attr_count===1){var I=!0,v=0,G;do{if(G=N.peek(v),G.type===l.ATTRIBUTE){I=!1;break}v+=1}while(v<4&&G.type!==l.EOF&&G.type!==l.TAG_CLOSE);j=!I}j&&(b.print_newline(!1),D=!0)}b.print_token(m),D=D||b.previous_token_wrapped(),E.has_wrapped_attrs=D}return B},w.prototype._handle_text=function(b,m,E){var N={text:m.text,type:"TK_CONTENT"};return E.custom_beautifier_name?this._print_custom_beatifier_text(b,m,E):E.is_unformatted||E.is_content_unformatted?b.add_raw_token(m):(b.traverse_whitespace(m),b.print_token(m)),N},w.prototype._print_custom_beatifier_text=function(b,m,E){var N=this;if(m.text!==""){var D=m.text,B,j=1,I="",v="";E.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:E.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:E.custom_beautifier_name==="html"&&(B=function(pe,xe){var _e=new w(pe,xe,N._js_beautify,N._css_beautify);return _e.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-b.indent_level);var G=b.get_full_indent(j);if(D=D.replace(/\n[ \t]*$/,""),E.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(<!--|<!\[CDATA\[)/)){var Y=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(D);if(!Y){b.add_raw_token(m);return}I=G+Y[1]+`
`,D=Y[4],Y[5]&&(v=G+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(`
`)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(m.whitespace_before=Y[0]))}if(D)if(B){var re=function(){this.eol=`
`};re.prototype=this._options.raw_options;var oe=new re;D=B(G+D,oe)}else{var we=m.whitespace_before;we&&(D=D.replace(new RegExp(`
(`+we+")?","g"),`
`)),D=G+D.replace(/\n/g,`
`+G)}I&&(D?D=I+D+`
`+v:D=I+v),b.print_newline(!1),D&&(m.text=D,m.whitespace_before="",m.newlines=0,b.add_raw_token(m),b.print_newline(!0))}},w.prototype._handle_tag_open=function(b,m,E,N){var D=this._get_tag_open_token(m);return(E.is_unformatted||E.is_content_unformatted)&&!E.is_empty_element&&m.type===l.TAG_OPEN&&m.text.indexOf("</")===0?(b.add_raw_token(m),D.start_tag_token=this._tag_stack.try_pop(D.tag_name)):(b.traverse_whitespace(m),this._set_tag_position(b,m,D,E,N),D.is_inline_element||b.set_wrap_point(),b.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(D.alignment_size=m.text.length+1),!D.tag_complete&&!D.is_unformatted&&(b.alignment_size=D.alignment_size),D};var x=function(b,m){if(this.parent=b||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!m)this.tag_complete=!0;else{var E;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(E=m.text.match(/^<([^\s>]*)/),this.tag_check=E?E[1]:""):(E=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=E?E[1]:"",(m.text.startsWith("{{#>")||m.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&m.next!==null?this.tag_check=m.next.text.split(" ")[0]:this.tag_check=m.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),m.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||m.closed&&m.closed.text==="/>";var N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};w.prototype._get_tag_open_token=function(b){var m=new x(this._tag_stack.get_parser_token(),b);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||T(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&T(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&T(m.tag_check,this._options.content_unformatted),m.is_inline_element=T(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},w.prototype._set_tag_position=function(b,m,E,N,D){if(E.is_empty_element||(E.is_end_tag?E.start_tag_token=this._tag_stack.try_pop(E.tag_name):(this._do_optional_end_element(E)&&(E.is_inline_element||b.print_newline(!1)),this._tag_stack.record_tag(E),(E.tag_name==="script"||E.tag_name==="style")&&!(E.is_unformatted||E.is_content_unformatted)&&(E.custom_beautifier_name=S(E.tag_check,m)))),T(E.tag_check,this._options.extra_liners)&&(b.print_newline(!1),b._output.just_added_blankline()||b.print_newline(!0)),E.is_empty_element){if(E.tag_start_char==="{"&&E.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),E.indent_content=!0;var B=b.current_line_has_match(/{{#if/);B||b.print_newline(!1)}E.tag_name==="!--"&&D.type===l.TAG_CLOSE&&N.is_end_tag&&E.text.indexOf(`
`)===-1||(E.is_inline_element||E.is_unformatted||b.print_newline(!1),this._calcluate_parent_multiline(b,E))}else if(E.is_end_tag){var j=!1;j=E.start_tag_token&&E.start_tag_token.multiline_content,j=j||!E.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(D.type===l.TAG_CLOSE&&E.start_tag_token===N)&&D.type!=="TK_CONTENT",(E.is_content_unformatted||E.is_unformatted)&&(j=!1),j&&b.print_newline(!1)}else E.indent_content=!E.custom_beautifier_name,E.tag_start_char==="<"&&(E.tag_name==="html"?E.indent_content=this._options.indent_inner_html:E.tag_name==="head"?E.indent_content=this._options.indent_head_inner_html:E.tag_name==="body"&&(E.indent_content=this._options.indent_body_inner_html)),!(E.is_inline_element||E.is_unformatted)&&(D.type!=="TK_CONTENT"||E.is_content_unformatted)&&b.print_newline(!1),this._calcluate_parent_multiline(b,E)},w.prototype._calcluate_parent_multiline=function(b,m){m.parent&&b._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var _=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],o=["a","audio","del","ins","map","noscript","video"];w.prototype._do_optional_end_element=function(b){var m=null;if(b.is_empty_element||!b.is_start_tag||!b.parent)return;if(b.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(b.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(b.tag_name==="dd"||b.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(b.parent.tag_name==="p"&&_.indexOf(b.tag_name)!==-1){var E=b.parent.parent;(!E||o.indexOf(E.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else b.tag_name==="rp"||b.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):b.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):b.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):b.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):b.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):b.tag_name==="tbody"||b.tag_name==="tfoot"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("thead",["table"]),m=m||this._tag_stack.try_pop("tbody",["table"])):b.tag_name==="tr"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(b.tag_name==="th"||b.tag_name==="td")&&(m=m||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),m=m||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return b.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=w},function(g,p,f){var h=f(6).Options;function n(d){h.call(this,d,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}n.prototype=new h,g.exports.Options=n},function(g,p,f){var h=f(9).Tokenizer,n=f(9).TOKEN,d=f(13).Directives,l=f(14).TemplatablePattern,a=f(12).Pattern,u={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:n.START,RAW:n.RAW,EOF:n.EOF},c=new d(/<\!--/,/-->/),L=function(S,T){h.call(this,S,T),this._current_tag_name="";var R=new l(this._input).read_options(this._options),C=new a(this._input);if(this.__patterns={word:R.until(/[\n\r\t <]/),single_quote:R.until_after(/'/),double_quote:R.until_after(/"/),attribute:R.until(/[\n\r\t =>]|\/>/),element_name:R.until(/[\n\r\t >\/]/),handlebars_comment:C.starting_with(/{{!--/).until_after(/--}}/),handlebars:C.starting_with(/{{/).until_after(/}}/),handlebars_open:C.until(/[\n\r\t }]/),handlebars_raw_close:C.until(/}}/),comment:C.starting_with(/<!--/).until_after(/-->/),cdata:C.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:C.starting_with(/<!\[/).until_after(/]>/),processing:C.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var w=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=C.matching(w).until_after(w)}};L.prototype=new h,L.prototype._is_comment=function(S){return!1},L.prototype._is_opening=function(S){return S.type===u.TAG_OPEN},L.prototype._is_closing=function(S,T){return S.type===u.TAG_CLOSE&&T&&((S.text===">"||S.text==="/>")&&T.text[0]==="<"||S.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},L.prototype._reset=function(){this._current_tag_name=""},L.prototype._get_next_token=function(S,T){var R=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(u.EOF,""):(R=R||this._read_open_handlebars(C,T),R=R||this._read_attribute(C,S,T),R=R||this._read_close(C,T),R=R||this._read_raw_content(C,S,T),R=R||this._read_content_word(C),R=R||this._read_comment_or_cdata(C),R=R||this._read_processing(C),R=R||this._read_open(C,T),R=R||this._create_token(u.UNKNOWN,this._input.next()),R)},L.prototype._read_comment_or_cdata=function(S){var T=null,R=null,C=null;if(S==="<"){var w=this._input.peek(1);w==="!"&&(R=this.__patterns.comment.read(),R?(C=c.get_directives(R),C&&C.ignore==="start"&&(R+=c.readIgnored(this._input))):R=this.__patterns.cdata.read()),R&&(T=this._create_token(u.COMMENT,R),T.directives=C)}return T},L.prototype._read_processing=function(S){var T=null,R=null,C=null;if(S==="<"){var w=this._input.peek(1);(w==="!"||w==="?")&&(R=this.__patterns.conditional_comment.read(),R=R||this.__patterns.processing.read()),R&&(T=this._create_token(u.COMMENT,R),T.directives=C)}return T},L.prototype._read_open=function(S,T){var R=null,C=null;return T||S==="<"&&(R=this._input.next(),this._input.peek()==="/"&&(R+=this._input.next()),R+=this.__patterns.element_name.read(),C=this._create_token(u.TAG_OPEN,R)),C},L.prototype._read_open_handlebars=function(S,T){var R=null,C=null;return T||this._options.indent_handlebars&&S==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(R=this.__patterns.handlebars_comment.read(),R=R||this.__patterns.handlebars.read(),C=this._create_token(u.COMMENT,R)):(R=this.__patterns.handlebars_open.read(),C=this._create_token(u.TAG_OPEN,R))),C},L.prototype._read_close=function(S,T){var R=null,C=null;return T&&(T.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(R=this._input.next(),S==="/"&&(R+=this._input.next()),C=this._create_token(u.TAG_CLOSE,R)):T.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),C=this._create_token(u.TAG_CLOSE,"}}"))),C},L.prototype._read_attribute=function(S,T,R){var C=null,w="";if(R&&R.text[0]==="<")if(S==="=")C=this._create_token(u.EQUALS,this._input.next());else if(S==='"'||S==="'"){var x=this._input.next();S==='"'?x+=this.__patterns.double_quote.read():x+=this.__patterns.single_quote.read(),C=this._create_token(u.VALUE,x)}else w=this.__patterns.attribute.read(),w&&(T.type===u.EQUALS?C=this._create_token(u.VALUE,w):C=this._create_token(u.ATTRIBUTE,w));return C},L.prototype._is_content_unformatted=function(S){return this._options.void_elements.indexOf(S)===-1&&(this._options.content_unformatted.indexOf(S)!==-1||this._options.unformatted.indexOf(S)!==-1)},L.prototype._read_raw_content=function(S,T,R){var C="";if(R&&R.text[0]==="{")C=this.__patterns.handlebars_raw_close.read();else if(T.type===u.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var w=T.opened.text.substr(1).toLowerCase();if(w==="script"||w==="style"){var x=this._read_comment_or_cdata(S);if(x)return x.type=u.TEXT,x;C=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(w)&&(C=this._input.readUntil(new RegExp("</"+w+"[\\n\\r\\t ]*?>","ig")))}return C?this._create_token(u.TEXT,C):null},L.prototype._read_content_word=function(S){var T="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(u.TEXT,T)},g.exports.Tokenizer=L,g.exports.TOKEN=u}],W={};function M(g){var p=W[g];if(p!==void 0)return p.exports;var f=W[g]={exports:{}};return z[g](f,f.exports,M),f.exports}var O=M(18);P=O})();var Q=P;if(!0)!(le=[ae,ae("6UM0"),ae("TXwP")],J=function(z){var W=ae("6UM0"),M=ae("TXwP");return{html_beautify:function(O,g){return Q(O,g,W.js_beautify,M.css_beautify)}}}.apply(Ye,le),J!==void 0&&(ct.exports=J));else var H,F})()},"rAM+":function(ct,Ye,ae){"use strict";ae.d(Ye,"a",function(){return J});var le=ae("Qw5x");function J(P,Q){var H;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(H=Object(le.a)(P))||Q&&P&&typeof P.length=="number"){H&&(P=H);var F=0,z=function(){};return{s:z,n:function(){return F>=P.length?{done:!0}:{done:!1,value:P[F++]}},e:function(p){throw p},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 W=!0,M=!1,O;return{s:function(){H=P[Symbol.iterator]()},n:function(){var p=H.next();return W=p.done,p},e:function(p){M=!0,O=p},f:function(){try{!W&&H.return!=null&&H.return()}finally{if(M)throw O}}}}},rUJ1:function(ct,Ye){const ae=/[&<>"']/,le=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},H=C=>Q[C];function F(C,w){if(w){if(ae.test(C))return C.replace(le,H)}else if(J.test(C))return C.replace(P,H);return C}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(C){return C.replace(z,(w,x)=>(x=x.toLowerCase(),x==="colon"?":":x.charAt(0)==="#"?x.charAt(1)==="x"?String.fromCharCode(parseInt(x.substring(2),16)):String.fromCharCode(+x.substring(1)):""))}const M=/(^|[^\[])\^/g;function O(C,w){C=C.source||C,w=w||"";const x={replace:(_,o)=>(o=o.source||o,o=o.replace(M,"$1"),C=C.replace(_,o),x),getRegex:()=>new RegExp(C,w)};return x}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(C,w,x){if(C){let _;try{_=decodeURIComponent(W(x)).replace(g,"").toLowerCase()}catch(o){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}w&&!p.test(x)&&(x=a(w,x));try{x=encodeURI(x).replace(/%25/g,"%")}catch(_){return null}return x}const h={},n=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(C,w){h[" "+C]||(n.test(C)?h[" "+C]=C+"/":h[" "+C]=S(C,"/",!0)),C=h[" "+C];const x=C.indexOf(":")===-1;return w.substring(0,2)==="//"?x?w:C.replace(d,"$1")+w:w.charAt(0)==="/"?x?w:C.replace(l,"$1")+w:C+w}const u={exec:function(){}};function c(C){let w=1,x,_;for(;w<arguments.length;w++){x=arguments[w];for(_ in x)Object.prototype.hasOwnProperty.call(x,_)&&(C[_]=x[_])}return C}function L(C,w){const x=C.replace(/\|/g,(b,m,E)=>{let N=!1,D=m;for(;--D>=0&&E[D]==="\\";)N=!N;return N?"|":" |"}),_=x.split(/ \|/);let o=0;if(_.length>w)_.splice(w);else for(;_.length<w;)_.push("");for(;o<_.length;o++)_[o]=_[o].trim().replace(/\\\|/g,"|");return _}function S(C,w,x){const _=C.length;if(_===0)return"";let o=0;for(;o<_;){const b=C.charAt(_-o-1);if(b===w&&!x)o++;else if(b!==w&&x)o++;else break}return C.substr(0,_-o)}function T(C,w){if(C.indexOf(w[1])===-1)return-1;const x=C.length;let _=0,o=0;for(;o<x;o++)if(C[o]==="\\")o++;else if(C[o]===w[0])_++;else if(C[o]===w[1]&&(_--,_<0))return o;return-1}function R(C){C&&C.sanitize&&!C.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")}ct.exports={escape:F,unescape:W,edit:O,cleanUrl:f,resolveUrl:a,noopTest:u,merge:c,splitCells:L,rtrim:S,findClosingBracket:T,checkSanitizeDeprecation:R}},ulZh:function(ct,Ye,ae){typeof window!="undefined"&&function(J,P){ct.exports=P()}(this,function(){return function(le){var J={};function P(Q){if(J[Q])return J[Q].exports;var H=J[Q]={i:Q,l:!1,exports:{}};return le[Q].call(H.exports,H,H.exports,P),H.l=!0,H.exports}return P.m=le,P.c=J,P.d=function(Q,H,F){P.o(Q,H)||Object.defineProperty(Q,H,{enumerable:!0,get:F})},P.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},P.t=function(Q,H){if(H&1&&(Q=P(Q)),H&8)return Q;if(H&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var F=Object.create(null);if(P.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:Q}),H&2&&typeof Q!="string")for(var z in Q)P.d(F,z,function(W){return Q[W]}.bind(null,z));return F},P.n=function(Q){var H=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return P.d(H,"a",H),H},P.o=function(Q,H){return Object.prototype.hasOwnProperty.call(Q,H)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,J,P){"use strict";var Q=Object.prototype.hasOwnProperty,H="~";function F(){}Object.create&&(F.prototype=Object.create(null),new F().__proto__||(H=!1));function z(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function W(g,p,f,h,n){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new z(f,h||g,n),l=H?H+p:p;return g._events[l]?g._events[l].fn?g._events[l]=[g._events[l],d]:g._events[l].push(d):(g._events[l]=d,g._eventsCount++),g}function M(g,p){--g._eventsCount===0?g._events=new F:delete g._events[p]}function O(){this._events=new F,this._eventsCount=0}O.prototype.eventNames=function(){var p=[],f,h;if(this._eventsCount===0)return p;for(h in f=this._events)Q.call(f,h)&&p.push(H?h.slice(1):h);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},O.prototype.listeners=function(p){var f=H?H+p:p,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var n=0,d=h.length,l=new Array(d);n<d;n++)l[n]=h[n].fn;return l},O.prototype.listenerCount=function(p){var f=H?H+p:p,h=this._events[f];return h?h.fn?1:h.length:0},O.prototype.emit=function(p,f,h,n,d,l){var a=H?H+p:p;if(!this._events[a])return!1;var u=this._events[a],c=arguments.length,L,S;if(u.fn){u.once&&this.removeListener(p,u.fn,void 0,!0);switch(c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,f),!0;case 3:return u.fn.call(u.context,f,h),!0;case 4:return u.fn.call(u.context,f,h,n),!0;case 5:return u.fn.call(u.context,f,h,n,d),!0;case 6:return u.fn.call(u.context,f,h,n,d,l),!0}for(S=1,L=new Array(c-1);S<c;S++)L[S-1]=arguments[S];u.fn.apply(u.context,L)}else{var T=u.length,R;for(S=0;S<T;S++){u[S].once&&this.removeListener(p,u[S].fn,void 0,!0);switch(c){case 1:u[S].fn.call(u[S].context);break;case 2:u[S].fn.call(u[S].context,f);break;case 3:u[S].fn.call(u[S].context,f,h);break;case 4:u[S].fn.call(u[S].context,f,h,n);break;default:if(!L)for(R=1,L=new Array(c-1);R<c;R++)L[R-1]=arguments[R];u[S].fn.apply(u[S].context,L)}}}return!0},O.prototype.on=function(p,f,h){return W(this,p,f,h,!1)},O.prototype.once=function(p,f,h){return W(this,p,f,h,!0)},O.prototype.removeListener=function(p,f,h,n){var d=H?H+p:p;if(!this._events[d])return this;if(!f)return M(this,d),this;var l=this._events[d];if(l.fn)l.fn===f&&(!n||l.once)&&(!h||l.context===h)&&M(this,d);else{for(var a=0,u=[],c=l.length;a<c;a++)(l[a].fn!==f||n&&!l[a].once||h&&l[a].context!==h)&&u.push(l[a]);u.length?this._events[d]=u.length===1?u[0]:u:M(this,d)}return this},O.prototype.removeAllListeners=function(p){var f;return p?(f=H?H+p:p,this._events[f]&&M(this,f)):(this._events=new F,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=H,O.EventEmitter=O,le.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,J,P){(function(Q){var H=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,F=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(O,g,p){if(p=p||{},O=O.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return O;var f=M.parseURL(O);if(!f)throw new Error("Error trying to parse base URL.");return f.path=M.normalizePath(f.path),M.buildURLFromParts(f)}var h=M.parseURL(g);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return p.alwaysNormalize?(h.path=M.normalizePath(h.path),M.buildURLFromParts(h)):g;var n=M.parseURL(O);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&n.path[0]!=="/"){var d=F.exec(n.path);n.netLoc=d[1],n.path=d[2]}n.netLoc&&!n.path&&(n.path="/");var l={scheme:n.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(l.netLoc=n.netLoc,h.path[0]!=="/"))if(!h.path)l.path=n.path,h.params||(l.params=n.params,h.query||(l.query=n.query));else{var a=n.path,u=a.substring(0,a.lastIndexOf("/")+1)+h.path;l.path=M.normalizePath(u)}return l.path===null&&(l.path=p.alwaysNormalize?M.normalizePath(h.path):h.path),M.buildURLFromParts(l)},parseURL:function(O){var g=H.exec(O);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(z,"");O.length!==(O=O.replace(W,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};le.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(le,J,P){function Q(p){var f={};function h(d){if(f[d])return f[d].exports;var l=f[d]={i:d,l:!1,exports:{}};return p[d].call(l.exports,l,l.exports,h),l.l=!0,l.exports}h.m=p,h.c=f,h.i=function(d){return d},h.d=function(d,l,a){h.o(d,l)||Object.defineProperty(d,l,{configurable:!1,enumerable:!0,get:a})},h.r=function(d){Object.defineProperty(d,"__esModule",{value:!0})},h.n=function(d){var l=d&&d.__esModule?function(){return d.default}:function(){return d};return h.d(l,"a",l),l},h.o=function(d,l){return Object.prototype.hasOwnProperty.call(d,l)},h.p="/",h.oe=function(d){throw console.error(d),d};var n=h(h.s=ENTRY_MODULE);return n.default||n}var H="[\\.|\\-|\\+|\\w|/|@]+",F="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+H+").*?\\)";function z(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(p){return!isNaN(1*p)}function M(p,f,h){var n={};n[h]=[];var d=f.toString(),l=d.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return n;for(var a=l[1],u=new RegExp("(\\\\n|\\W)"+z(a)+F,"g"),c;c=u.exec(d);){if(c[3]==="dll-reference")continue;n[h].push(c[3])}for(u=new RegExp("\\("+z(a)+'\\("(dll-reference\\s('+H+'))"\\)\\)'+F,"g");c=u.exec(d);)p[c[2]]||(n[h].push(c[1]),p[c[2]]=P(c[1]).m),n[c[2]]=n[c[2]]||[],n[c[2]].push(c[4]);for(var L=Object.keys(n),S=0;S<L.length;S++)for(var T=0;T<n[L[S]].length;T++)W(n[L[S]][T])&&(n[L[S]][T]=1*n[L[S]][T]);return n}function O(p){var f=Object.keys(p);return f.reduce(function(h,n){return h||p[n].length>0},!1)}function g(p,f){for(var h={main:[f]},n={main:[]},d={main:{}};O(h);)for(var l=Object.keys(h),a=0;a<l.length;a++){var u=l[a],c=h[u],L=c.pop();if(d[u]=d[u]||{},d[u][L]||!p[u][L])continue;d[u][L]=!0,n[u]=n[u]||[],n[u].push(L);for(var S=M(p,p[u][L],u),T=Object.keys(S),R=0;R<T.length;R++)h[T[R]]=h[T[R]]||[],h[T[R]]=h[T[R]].concat(S[T[R]])}return n}le.exports=function(p,f){f=f||{};var h={main:P.m},n=f.all?{main:Object.keys(h.main)}:g(h,p),d="";Object.keys(n).filter(function(L){return L!=="main"}).forEach(function(L){for(var S=0;n[L][S];)S++;n[L].push(S),h[L][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",d=d+"var "+L+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+n[L].map(function(T){return""+JSON.stringify(T)+": "+h[L][T].toString()}).join(",")+`});
`}),d=d+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+n.main.map(function(L){return""+JSON.stringify(L)+": "+h.main[L].toString()}).join(",")+"}))(self);";var l=new window.Blob([d],{type:"text/javascript"});if(f.bare)return l;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,u=a.createObjectURL(l),c=new window.Worker(u);return c.objectURL=u,c}},"./src/config.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"hlsDefaultConfig",function(){return R}),P.d(J,"mergeConfig",function(){return w}),P.d(J,"enableStreamingMode",function(){return x});var Q=P("./src/controller/abr-controller.ts"),H=P("./src/controller/audio-stream-controller.ts"),F=P("./src/controller/audio-track-controller.ts"),z=P("./src/controller/subtitle-stream-controller.ts"),W=P("./src/controller/subtitle-track-controller.ts"),M=P("./src/controller/buffer-controller.ts"),O=P("./src/controller/timeline-controller.ts"),g=P("./src/controller/cap-level-controller.ts"),p=P("./src/controller/fps-controller.ts"),f=P("./src/controller/eme-controller.ts"),h=P("./src/controller/cmcd-controller.ts"),n=P("./src/utils/xhr-loader.ts"),d=P("./src/utils/fetch-loader.ts"),l=P("./src/utils/cues.ts"),a=P("./src/utils/mediakeys-helper.ts"),u=P("./src/utils/logger.ts");function c(){return c=Object.assign||function(_){for(var o=1;o<arguments.length;o++){var b=arguments[o];for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m])}return _},c.apply(this,arguments)}function L(_,o){var b=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);o&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),b.push.apply(b,m)}return b}function S(_){for(var o=1;o<arguments.length;o++){var b=arguments[o]!=null?arguments[o]:{};o%2?L(Object(b),!0).forEach(function(m){T(_,m,b[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(b)):L(Object(b)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(b,m))})}return _}function T(_,o,b){return o in _?Object.defineProperty(_,o,{value:b,enumerable:!0,configurable:!0,writable:!0}):_[o]=b,_}var R=S(S({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:n.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:M.default,capLevelController:g.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},C()),{},{subtitleStreamController:z.SubtitleStreamController,subtitleTrackController:W.default,timelineController:O.TimelineController,audioStreamController:H.default,audioTrackController:F.default,emeController:f.default,cmcdController:h.default});function C(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function w(_,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},_,o)}function x(_){var o=_.loader;if(o!==d.default&&o!==n.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),_.progressive=!1;else{var b=Object(d.fetchSupported)();b&&(_.loader=d.default,_.progressive=!0,_.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/ewma-bandwidth-estimator.ts"),F=P("./src/events.ts"),z=P("./src/utils/buffer-helper.ts"),W=P("./src/errors.ts"),M=P("./src/types/loader.ts"),O=P("./src/utils/logger.ts");function g(h,n){for(var d=0;d<n.length;d++){var l=n[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function p(h,n,d){return n&&g(h.prototype,n),d&&g(h,d),h}var f=function(){function h(d){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=d;var l=d.config;this.bwEstimator=new H.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var n=h.prototype;return n.registerListeners=function(){var l=this.hls;l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(F.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var l=this.hls;l.off(F.Events.FRAG_LOADING,this.onFragLoading,this),l.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(F.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},n.onFragLoading=function(l,a){var u=a.frag;if(u.type===M.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=u,this.partCurrent=(c=a.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},n.onLevelLoaded=function(l,a){var u=this.hls.config;a.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},n._abandonRulesCheck=function(){var l=this.fragCurrent,a=this.partCurrent,u=this.hls,c=u.autoLevelEnabled,L=u.config,S=u.media;if(!l||!S)return;var T=a?a.stats:l.stats,R=a?a.duration:l.duration;if(T.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||S.paused||!S.playbackRate||!S.readyState)return;var C=performance.now()-T.loading.start,w=Math.abs(S.playbackRate);if(C<=500*R/w)return;var x=u.levels,_=u.minAutoLevel,o=x[l.level],b=T.total||Math.max(T.loaded,Math.round(R*o.maxBitrate/8)),m=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/C),E=(b-T.loaded)/m,N=S.currentTime,D=(z.BufferHelper.bufferInfo(S,N,L.maxBufferHole).end-N)/w;if(D>=2*R/w||E<=D)return;var B=Number.POSITIVE_INFINITY,j;for(j=l.level-1;j>_;j--){var I=x[j].maxBitrate;if(B=R*I/(8*.8*m),B<D)break}if(B>=E)return;var v=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+l.sn+(a?" part "+a.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
Current BW estimate: `+(Object(Q.isFiniteNumber)(v)?(v/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+B.toFixed(3)+` s
Time to underbuffer: `+D.toFixed(3)+" s"),u.nextLoadLevel=j,this.bwEstimator.sample(C,T.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),u.trigger(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:a,stats:T})},n.onFragLoaded=function(l,a){var u=a.frag,c=a.part;if(u.type===M.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(u.sn)){var L=c?c.stats:u.stats,S=c?c.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[u.level],R=(T.loaded?T.loaded.bytes:0)+L.loaded,C=(T.loaded?T.loaded.duration:0)+S;T.loaded={bytes:R,duration:C},T.realBitrate=Math.round(8*R/C)}if(u.bitrateTest){var w={stats:L,frag:u,part:c,id:u.type};this.onFragBuffered(F.Events.FRAG_BUFFERED,w),u.bitrateTest=!1}}},n.onFragBuffered=function(l,a){var u=a.frag,c=a.part,L=c?c.stats:u.stats;if(L.aborted)return;if(u.type!==M.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var S=L.parsing.end-L.loading.start;this.bwEstimator.sample(S,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},n.onError=function(l,a){switch(a.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},n.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},n.getNextABRAutoLevel=function(){var l=this.fragCurrent,a=this.partCurrent,u=this.hls,c=u.maxAutoLevel,L=u.config,S=u.minAutoLevel,T=u.media,R=a?a.duration:l?l.duration:0,C=T?T.currentTime:0,w=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,x=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,_=(z.BufferHelper.bufferInfo(T,C,L.maxBufferHole).end-C)/w,o=this.findBestLevel(x,S,c,_,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(o>=0)return o;O.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=R?Math.min(R,L.maxStarvationDelay):L.maxStarvationDelay,m=L.abrBandWidthFactor,E=L.abrBandWidthUpFactor;if(!_){var N=this.bitrateTestDelay;if(N){var D=R?Math.min(R,L.maxLoadingDelay):L.maxLoadingDelay;b=D-N,O.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),m=E=1}}return o=this.findBestLevel(x,S,c,_+b,m,E),Math.max(o,0)},n.findBestLevel=function(l,a,u,c,L,S){for(var T,R=this.fragCurrent,C=this.partCurrent,w=this.lastLoadedFragLevel,x=this.hls.levels,_=x[w],o=!!(_!=null&&(T=_.details)!==null&&T!==void 0&&T.live),b=_==null?void 0:_.codecSet,m=C?C.duration:R?R.duration:0,E=u;E>=a;E--){var N=x[E];if(!N||b&&N.codecSet!==b)continue;var D=N.details,B=(C?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||m,j=void 0;E<=w?j=L*l:j=S*l;var I=x[E].maxBitrate,v=I*B/j;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(j)+"/"+I+"/"+B+"/"+c+"/"+v),j>I&&(!v||o&&!this.bitrateTestDelay||v<c))return E}return-1},p(h,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,a=this.bwEstimator;if(l!==-1&&(!a||!a.canEstimate()))return l;var u=this.getNextABRAutoLevel();return l!==-1&&(u=Math.min(l,u)),u},set:function(l){this._nextAutoLevel=l}}]),h}();J.default=f},"./src/controller/audio-stream-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/polyfills/number.ts"),H=P("./src/controller/base-stream-controller.ts"),F=P("./src/events.ts"),z=P("./src/utils/buffer-helper.ts"),W=P("./src/controller/fragment-tracker.ts"),M=P("./src/types/level.ts"),O=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/chunk-cache.ts"),f=P("./src/demux/transmuxer-interface.ts"),h=P("./src/types/transmuxer.ts"),n=P("./src/controller/fragment-finders.ts"),d=P("./src/utils/discontinuities.ts"),l=P("./src/errors.ts"),a=P("./src/utils/logger.ts");function u(){return u=Object.assign||function(R){for(var C=1;C<arguments.length;C++){var w=arguments[C];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(R[x]=w[x])}return R},u.apply(this,arguments)}function c(R,C){R.prototype=Object.create(C.prototype),R.prototype.constructor=R,L(R,C)}function L(R,C){return L=Object.setPrototypeOf||function(x,_){return x.__proto__=_,x},L(R,C)}var S=100,T=function(R){c(C,R);function C(x,_){var o;return o=R.call(this,x,_,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var w=C.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var _=this.hls;_.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.on(F.Events.ERROR,this.onError,this),_.on(F.Events.BUFFER_RESET,this.onBufferReset,this),_.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var _=this.hls;_.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(F.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.off(F.Events.ERROR,this.onError,this),_.off(F.Events.BUFFER_RESET,this.onBufferReset,this),_.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onInitPtsFound=function(_,o){var b=o.frag,m=o.id,E=o.initPTS;if(m==="main"){var N=b.cc;this.initPTS[b.cc]=E,this.log("InitPTS for cc: "+N+" found from main: "+E),this.videoTrackCC=N,this.state===H.State.WAITING_INIT_PTS&&this.tick()}},w.startLoad=function(_){if(!this.levels){this.startPosition=_,this.state=H.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(S),this.fragLoadError=0,o>0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=H.State.IDLE):(this.loadedmetadata=!1,this.state=H.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},w.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_TRACK:{var _,o=this.levels,b=this.trackId,m=o==null||((_=o[b])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=H.State.WAITING_INIT_PTS}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),D=this.retryDate;(!D||N>=D||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=H.State.IDLE);break}case H.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var j=B.frag,I=B.part,v=B.cache,G=B.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.FRAG_LOADING;var Y=v.flush(),re={frag:j,part:I,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(re),G&&R.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),we=z.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),pe=Object(n.fragmentWithinToleranceTest)(we.end,this.config.maxFragLookUpTolerance,j);pe<0&&(a.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+we.end+" is needed"),this.clearWaitingFragment())}}else this.state=H.State.IDLE}}this.onTickEnd()},w.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.IDLE)},w.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:_,b=o.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},w.doTickIdle=function(){var _,o,b=this.hls,m=this.levels,E=this.media,N=this.trackId,D=b.config;if(!m||!m[N])return;if(!E&&(this.startFragRequested||!D.startFragPrefetch))return;var B=m[N],j=B.details;if(!j||j.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(j)){this.state=H.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(I===null)return;var v=I.len,G=this.getMaxBufferLength(),Y=this.audioSwitch;if(v>=G&&!Y)return;if(!Y&&this._streamEnded(I,j)){b.trigger(F.Events.BUFFER_EOS,{type:"audio"}),this.state=H.State.ENDED;return}var re=j.fragments,oe=re[0].start,we=I.end;if(Y){var pe=this.getLoadPosition();we=pe,j.PTSKnown&&pe<oe&&((I.end>oe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var xe=this.getNextFragment(we,j);if(!xe){this.bufferFlushed=!0;return}((_=xe.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((o=xe.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(xe,j):this.loadFragment(xe,j,we)},w.getMaxBufferLength=function(){var _=R.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return o===null?_:Math.max(_,o.len)},w.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(_,o){var b=o.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(m){return new M.Level(m)})},w.onAudioTrackSwitching=function(_,o){var b=!!o.url;this.trackId=o.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(S):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=H.State.IDLE):this.state=H.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(_,o){this.mainDetails=o.details},w.onAudioTrackLoaded=function(_,o){var b,m=this.levels,E=o.details,N=o.id;if(!m){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var D=m[N],B=0;if(E.live||(b=D.details)!==null&&b!==void 0&&b.live){var j=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!j)return;!D.details&&E.hasProgramDateTime&&j.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(E,j),B=E.fragments[0].start):B=this.alignPlaylists(E,D.details)}D.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(D.details,B),this.state===H.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=H.State.IDLE),this.tick()},w._handleFragmentLoadProgress=function(_){var o,b=_.frag,m=_.part,E=_.payload,N=this.config,D=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var j=B[D];console.assert(j,"Audio track is defined on fragment load progress");var I=j.details;console.assert(I,"Audio track details are defined on fragment load progress");var v=N.defaultAudioCodec||j.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new f.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[b.cc],re=(o=b.initSegment)===null||o===void 0?void 0:o.data;if(Y!==void 0){var oe=!1,we=m?m.index:-1,pe=we!==-1,xe=new h.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,E.byteLength,we,pe);G.push(E,re,v,"",b,m,I.totalduration,oe,xe,Y)}else{a.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+D);var _e=this.waitingData=this.waitingData||{frag:b,part:m,cache:new p.default,complete:!1},Se=_e.cache;Se.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=H.State.WAITING_INIT_PTS}},w._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,_)},w.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},w.onBufferCreated=function(_,o){var b=o.tracks.audio;b&&(this.mediaBuffer=b.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},w.onFragBuffered=function(_,o){var b=o.frag,m=o.part;if(b.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(m?" p: "+m.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,m)},w.onError=function(_,o){switch(o.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,o);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==H.State.ERROR&&this.state!==H.State.STOPPED&&(this.state=o.fatal?H.State.ERROR:H.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var b=!0,m=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);m&&m.len>.5&&(b=!this.reduceMaxBufferLength(m.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},w.onBufferFlushed=function(_,o){var b=o.type;b===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},w._handleTransmuxComplete=function(_){var o,b="audio",m=this.hls,E=_.remuxResult,N=_.chunkMeta,D=this.getCurrentContext(N);if(!D){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 B=D.frag,j=D.part,I=E.audio,v=E.text,G=E.id3,Y=E.initSegment;if(this.fragContextChanged(B))return;if(this.state=H.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,B,N),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:b,tracks:Y.tracks})),I){var re=I.startPTS,oe=I.endPTS,we=I.startDTS,pe=I.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:oe,startDTS:we,endDTS:pe}),B.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,re,oe,we,pe),this.bufferFragmentData(I,B,j,N)}if(G!=null&&(o=G.samples)!==null&&o!==void 0&&o.length){var xe=u({frag:B,id:b},G);m.trigger(F.Events.FRAG_PARSING_METADATA,xe)}if(v){var _e=u({frag:B,id:b},v);m.trigger(F.Events.FRAG_PARSING_USERDATA,_e)}},w._bufferInitSegment=function(_,o,b){if(this.state!==H.State.PARSING)return;_.video&&delete _.video;var m=_.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,_);var E=m.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:o,part:null,chunkMeta:b,parent:o.type,data:E};this.hls.trigger(F.Events.BUFFER_APPENDING,N)}this.tick()},w.loadFragment=function(_,o,b){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===W.FragmentState.NOT_LOADED||m===W.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):o.live&&!Object(Q.isFiniteNumber)(this.initPTS[_.cc])?(this.log("Waiting for video PTS in continuity counter "+_.cc+" of live stream before loading audio fragment "+_.sn+" of level "+this.trackId),this.state=H.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,_,o,b)))},w.completeAudioSwitch=function(){var _=this.hls,o=this.media,b=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:b})},C}(H.default);J.default=T},"./src/controller/audio-track-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/controller/base-playlist-controller.ts"),z=P("./src/types/loader.ts");function W(f,h){for(var n=0;n<h.length;n++){var d=h[n];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function M(f,h,n){return h&&W(f.prototype,h),n&&W(f,n),f}function O(f,h){f.prototype=Object.create(h.prototype),f.prototype.constructor=f,g(f,h)}function g(f,h){return g=Object.setPrototypeOf||function(d,l){return d.__proto__=l,d},g(f,h)}var p=function(f){O(h,f);function h(d){var l;return l=f.call(this,d,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var n=h.prototype;return n.registerListeners=function(){var l=this.hls;l.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(Q.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var l=this.hls;l.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(Q.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},n.onManifestParsed=function(l,a){this.tracks=a.audioTracks||[]},n.onAudioTrackLoaded=function(l,a){var u=a.id,c=a.details,L=this.tracksInGroup[u];if(!L){this.warn("Invalid audio track id "+u);return}var S=L.details;L.details=a.details,this.log("audioTrack "+u+" loaded ["+c.startSN+"-"+c.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,a,S))},n.onLevelLoading=function(l,a){this.switchLevel(a.level)},n.onLevelSwitching=function(l,a){this.switchLevel(a.level)},n.switchLevel=function(l){var a=this.hls.levels[l];if(!(a!=null&&a.audioGroupIds))return;var u=a.audioGroupIds[a.urlId];if(this.groupId!==u){this.groupId=u;var c=this.tracks.filter(function(S){return!u||S.groupId===u});this.selectDefaultTrack&&!c.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var L={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},n.onError=function(l,a){if(f.prototype.onError.call(this,l,a),a.fatal||!a.context)return;a.context.type===z.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},n.setAudioTrack=function(l){var a=this.tracksInGroup;if(l<0||l>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=a[this.trackId];this.log("Now switching to audio-track index "+l);var c=a[l],L=c.id,S=c.groupId,T=S===void 0?"":S,R=c.name,C=c.type,w=c.url;if(this.trackId=l,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:T,name:R,type:C,url:w}),c.details&&!c.details.live)return;var x=this.switchParams(c.url,u==null?void 0:u.details);this.loadPlaylist(x)},n.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,u=this.findTrackId(a)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},n.findTrackId=function(l){for(var a=this.tracksInGroup,u=0;u<a.length;u++){var c=a[u];if((!this.selectDefaultTrack||c.default)&&(!l||l===c.name))return c.id}return-1},n.loadPlaylist=function(l){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var u=a.id,c=a.groupId,L=a.url;if(l)try{L=l.addDirectives(L)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:L,id:u,groupId:c,deliveryDirectives:l||null})}},M(h,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),h}(F.default);J.default=p},"./src/controller/base-playlist-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return M});var Q=P("./src/polyfills/number.ts"),H=P("./src/types/level.ts"),F=P("./src/controller/level-helper.ts"),z=P("./src/utils/logger.ts"),W=P("./src/errors.ts"),M=function(){function O(p,f){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,f+":"),this.warn=z.logger.warn.bind(z.logger,f+":"),this.hls=p}var g=O.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,h){h.fatal&&h.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(f,h){var n=h==null?void 0:h.renditionReports;if(n)for(var d=0;d<n.length;d++){var l=n[d],a=""+l.URI;if(a===f.substr(-a.length)){var u=parseInt(l["LAST-MSN"]),c=parseInt(l["LAST-PART"]);if(h&&this.hls.config.lowLatencyMode){var L=Math.min(h.age-h.partTarget,h.targetduration);c!==void 0&&L>h.partTarget&&(c+=1)}if(Object(Q.isFiniteNumber)(u))return new H.HlsUrlParameters(u,Object(Q.isFiniteNumber)(c)?c:void 0,H.HlsSkip.No)}}},g.loadPlaylist=function(f){},g.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},g.playlistLoaded=function(f,h,n){var d=this,l=h.details,a=h.stats,u=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(l.advancedDateTime=Date.now()-u,l.live||n!=null&&n.live){if(l.reloaded(n),n&&this.log("live playlist "+f+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),n&&l.fragments.length>0&&Object(F.mergeDetails)(n,l),!this.canLoad||!l.live)return;var c,L=void 0,S=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var T=this.hls.config.lowLatencyMode,R=l.lastPartSn,C=l.endSN,w=l.lastPartIndex,x=w!==-1,_=R===C,o=T?0:w;x?(L=_?C+1:R,S=_?o:w+1):L=C+1;var b=l.age,m=b+l.ageHeader,E=Math.min(m-l.partTarget,l.targetduration*1.5);if(E>0){if(n&&E>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+E+" with playlist age: "+l.age),E=0;else{var N=Math.floor(E/l.targetduration);if(L+=N,S!==void 0){var D=Math.round(E%l.targetduration/l.partTarget);S+=D}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+S)}l.tuneInGoal=E}if(c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,S),T||!_){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,S);var B=Object(F.computeReloadInterval)(l,a);L!==void 0&&l.canBlockReload&&(B-=l.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(c)},B)}else this.clearTimer()},g.getDeliveryDirectives=function(f,h,n,d){var l=Object(H.getSkipValue)(f,n);return h!=null&&h.skip&&f.deltaUpdateFailed&&(n=h.msn,d=h.part,l=H.HlsSkip.No),new H.HlsUrlParameters(n,d,l)},g.retryLoadingOrFail=function(f){var h=this,n=this.hls.config,d=this.retryCount<n.levelLoadingMaxRetry;if(d){var l;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(l=f.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return h.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return d},O}()},"./src/controller/base-stream-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"State",function(){return C}),P.d(J,"default",function(){return w});var Q=P("./src/polyfills/number.ts"),H=P("./src/task-loop.ts"),F=P("./src/controller/fragment-tracker.ts"),z=P("./src/utils/buffer-helper.ts"),W=P("./src/utils/logger.ts"),M=P("./src/events.ts"),O=P("./src/errors.ts"),g=P("./src/types/transmuxer.ts"),p=P("./src/utils/mp4-tools.ts"),f=P("./src/utils/discontinuities.ts"),h=P("./src/controller/fragment-finders.ts"),n=P("./src/controller/level-helper.ts"),d=P("./src/loader/fragment-loader.ts"),l=P("./src/crypt/decrypter.ts"),a=P("./src/utils/time-ranges.ts"),u=P("./src/types/loader.ts");function c(x,_){for(var o=0;o<_.length;o++){var b=_[o];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(x,b.key,b)}}function L(x,_,o){return _&&c(x.prototype,_),o&&c(x,o),x}function S(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function T(x,_){x.prototype=Object.create(_.prototype),x.prototype.constructor=x,R(x,_)}function R(x,_){return R=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},R(x,_)}var C={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"},w=function(x){T(_,x);function _(b,m,E){var N;return N=x.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=C.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=W.logger.log.bind(W.logger,E+":"),N.warn=W.logger.warn.bind(W.logger,E+":"),N.hls=b,N.fragmentLoader=new d.default(b.config),N.fragmentTracker=m,N.config=b.config,N.decrypter=new l.default(b,b.config),b.on(M.Events.KEY_LOADED,N.onKeyLoaded,S(N)),N}var o=_.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(m){},o.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED},o._streamEnded=function(m,E){var N=this.fragCurrent,D=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!m.nextStart){var B=D.getState(N);return B===F.FragmentState.PARTIAL||B===F.FragmentState.OK}return!1},o.onMediaAttached=function(m,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 D=this.config;this.levels&&D.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(D.startPosition)},o.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,N=this.media,D=this.mediaBuffer,B=this.state,j=N?N.currentTime:0,I=z.BufferHelper.bufferInfo(D||N,j,m.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+B),B===C.ENDED)this.resetLoadingState();else if(E&&!I.len){var v=m.maxFragLookUpTolerance,G=E.start-v,Y=E.start+E.duration+v,re=j>Y;(j<G||re)&&(re&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=j),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(m,E){if(this.state!==C.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=C.IDLE;var N=this.levels[E.frag.level].details;N&&this.loadFragment(E.frag,N,E.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),x.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=C.STOPPED,this.hls.off(M.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,x.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=C.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(M.Events.KEY_LOADING,{frag:m})},o.loadFragment=function(m,E,N){this._loadFragForPlayback(m,E,N)},o._loadFragForPlayback=function(m,E,N){var D=this,B=function(I){if(D.fragContextChanged(m)){D.warn("Fragment "+m.sn+(I.part?" p: "+I.part.index:"")+" of level "+m.level+" was dropped during download."),D.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,D._handleFragmentLoadProgress(I)};this._doFragLoad(m,E,N,B).then(function(j){if(!j)return;D.fragLoadError=0;var I=D.state;if(D.fragContextChanged(m)){(I===C.FRAG_LOADING||I===C.BACKTRACKING||!D.fragCurrent&&I===C.PARSING)&&(D.fragmentTracker.removeFragment(m),D.state=C.IDLE);return}if("payload"in j&&(D.log("Loaded fragment "+m.sn+" of level "+m.level),D.hls.trigger(M.Events.FRAG_LOADED,j),D.state===C.BACKTRACKING)){D.fragmentTracker.backtrack(m,j),D.resetFragmentLoading(m);return}D._handleFragmentLoadComplete(j)}).catch(function(j){D.warn(j),D.resetFragmentLoading(m)})},o.flushMainBuffer=function(m,E,N){if(N===void 0&&(N=null),!(m-E))return;var D={startOffset:m,endOffset:E,type:N};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,D)},o._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(N){if(!N||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return N}).then(function(N){var D=E.hls,B=N.payload,j=m.decryptdata;if(B&&B.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var I=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(B),j.key.buffer,j.iv.buffer).then(function(v){var G=self.performance.now();return D.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:I,tdecrypt:G}}),N.payload=v,N})}return N}).then(function(N){var D=E.fragCurrent,B=E.hls,j=E.levels;if(!j)throw new Error("init load aborted, missing levels");var I=j[m.level].details;console.assert(I,"Level details are defined when init segment is loaded");var v=m.stats;E.state=C.IDLE,E.fragLoadError=0,m.data=new Uint8Array(N.payload),v.parsing.start=v.buffering.start=self.performance.now(),v.parsing.end=v.buffering.end=self.performance.now(),N.frag===D&&B.trigger(M.Events.FRAG_BUFFERED,{stats:v,frag:D,part:null,id:m.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(m)})},o.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},o.fragBufferedComplete=function(m,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(z.BufferHelper.getBuffered(N))),this.state=C.IDLE,this.tick()},o._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var N=m.frag,D=m.part,B=m.partsLoaded,j=!B||B.length===0||B.some(function(v){return!v}),I=new g.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,D?D.index:-1,!j);E.flush(I)},o._handleFragmentLoadProgress=function(m){},o._doFragLoad=function(m,E,N,D){var B=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(m.start,N||0),this.config.lowLatencyMode&&E){var j=E.partList;if(j&&D){N>m.end&&E.fragmentHint&&(m=E.fragmentHint);var I=this.getNextPart(j,m,N);if(I>-1){var v=j[I];return this.log("Loading part sn: "+m.sn+" p: "+v.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+I+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=v.start+v.duration,this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:j[I],targetBufferTime:N}),this.doFragPartsLoad(m,j,I,D).catch(function(G){return B.handleFragLoadError(G)})}else if(!m.url||this.loadedEndOfParts(j,N))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:N}),this.fragmentLoader.load(m,D).catch(function(G){return B.handleFragLoadError(G)})},o.doFragPartsLoad=function(m,E,N,D){var B=this;return new Promise(function(j,I){var v=[],G=function Y(re){var oe=E[re];B.fragmentLoader.loadPart(m,oe,D).then(function(we){v[oe.index]=we;var pe=we.part;B.hls.trigger(M.Events.FRAG_LOADED,we);var xe=E[re+1];if(xe&&xe.fragment===m)Y(re+1);else return j({frag:m,part:pe,partsLoaded:v})}).catch(I)};G(N)})},o.handleFragLoadError=function(m){var E=m.data;return E&&E.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(M.Events.ERROR,E),null},o._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==C.PARSING){this.fragCurrent||(this.state=C.IDLE);return}var N=E.frag,D=E.part,B=E.level,j=self.performance.now();N.stats.parsing.end=j,D&&(D.stats.parsing.end=j),this.updateLevelTiming(N,D,B,m.partial)},o.getCurrentContext=function(m){var E=this.levels,N=m.level,D=m.sn,B=m.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+N+". The current chunk will not be buffered."),null;var j=E[N],I=B>-1?Object(n.getPartWith)(j,D,B):null,v=I?I.fragment:Object(n.getFragmentWithSN)(j,D,this.fragCurrent);return v?{frag:v,part:I,level:j}:null},o.bufferFragmentData=function(m,E,N,D){if(!m||this.state!==C.PARSING)return;var B=m.data1,j=m.data2,I=B;if(B&&j&&(I=Object(p.appendUint8Array)(B,j)),!I||!I.length)return;var v={type:m.type,frag:E,part:N,chunkMeta:D,parent:E.type,data:I};this.hls.trigger(M.Events.BUFFER_APPENDING,v),m.dropped&&m.independent&&!N&&this.flushBufferGap(E)},o.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!z.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var N=E.currentTime,D=z.BufferHelper.bufferInfo(E,N,0),B=m.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),I=Math.max(Math.min(m.start-j,D.end-j),N+j);m.start-I>j&&this.flushMainBuffer(I,m.start)},o.getFwdBufferInfo=function(m,E){var N=this.config,D=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(D))return null;var B=z.BufferHelper.bufferInfo(m,D,N.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(D,E);if(j&&B.nextStart<j.end)return z.BufferHelper.bufferInfo(m,D,Math.max(B.nextStart,N.maxBufferHole))}return B},o.getMaxBufferLength=function(m){var E=this.config,N;return m?N=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):N=E.maxBufferLength,Math.min(N,E.maxMaxBufferLength)},o.reduceMaxBufferLength=function(m){var E=this.config,N=m||E.maxBufferLength;return E.maxMaxBufferLength>=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(m,E){var N,D,B=E.fragments,j=B.length;if(!j)return null;var I=this.config,v=B[0].start,G;if(E.live){var Y=I.initialLiveManifestSize;if(j<Y)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(E,B),this.startPosition=G?this.hls.liveSyncPosition||G.start:m)}else m<=v&&(G=B[0]);if(!G){var re=I.lowLatencyMode?E.partEnd:E.fragmentEnd;G=this.getFragmentAtPosition(m,re,E)}return(N=G)!==null&&N!==void 0&&N.initSegment&&!((D=G)!==null&&D!==void 0&&D.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},o.getNextPart=function(m,E,N){for(var D=-1,B=!1,j=!0,I=0,v=m.length;I<v;I++){var G=m[I];if(j=j&&!G.independent,D>-1&&N<G.start)break;var Y=G.loaded;!Y&&(B||G.independent||j)&&G.fragment===E&&(D=I),B=Y}return D},o.loadedEndOfParts=function(m,E){var N=m[m.length-1];return N&&E>N.start&&N.loaded},o.getInitialLiveFragment=function(m,E){var N=this.fragPrevious,D=null;if(N){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),D=Object(h.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var B=N.sn+1;if(B>=m.startSN&&B<=m.endSN){var j=E[B-m.startSN];N.cc===j.cc&&(D=j,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(h.findFragWithCC)(E,N.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(D=this.getFragmentAtPosition(I,this.bitrateTest?m.fragmentEnd:m.edge,m))}return D},o.getFragmentAtPosition=function(m,E,N){var D=this.config,B=this.fragPrevious,j=N.fragments,I=N.endSN,v=N.fragmentHint,G=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&N.partList&&v);Y&&v&&!this.bitrateTest&&(j=j.concat(v),I=v.sn);var re;if(m<E){var oe=m>E-G?0:G;re=Object(h.findFragmentByPTS)(B,j,m,oe)}else re=j[j.length-1];if(re){var we=re.sn-N.startSN,pe=B&&re.level===B.level,xe=j[we+1],_e=this.fragmentTracker.getState(re);if(_e===F.FragmentState.BACKTRACKED){re=null;for(var Se=we;j[Se]&&this.fragmentTracker.getState(j[Se])===F.FragmentState.BACKTRACKED;)B?re=j[Se--]:re=j[--Se];re||(re=xe)}else B&&re.sn===B.sn&&!Y&&(pe&&(re.sn<I&&this.fragmentTracker.getState(xe)!==F.FragmentState.OK?(this.log("SN "+re.sn+" just loaded, load next one: "+xe.sn),re=xe):re=null))}return re},o.synchronizeToLiveEdge=function(m){var E=this.config,N=this.media;if(!N)return;var D=this.hls.liveSyncPosition,B=N.currentTime,j=m.fragments[0].start,I=m.edge,v=B>=j-E.maxFragLookUpTolerance&&B<=I;if(D!==null&&N.duration>D&&(B<D||!v)){var G=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!v&&N.readyState<4||B<I-G)&&(this.loadedmetadata||(this.nextLoadPosition=D),N.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+D.toFixed(3)),N.currentTime=D))}},o.alignPlaylists=function(m,E){var N=this.levels,D=this.levelLastLoaded,B=this.fragPrevious,j=D!==null?N[D]:null,I=m.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var v=m.fragments[0].start,G=!E,Y=m.alignedSliding&&Object(Q.isFiniteNumber)(v);if(G||!Y&&!v){Object(f.alignStream)(B,j,m);var re=m.fragments[0].start;return this.log("Live playlist sliding: "+re.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+I),re}return v},o.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},o.setStartPosition=function(m,E){var N=this.startPosition;if(N<E&&(N=-1),N===-1||this.lastCurrentTime===-1){var D=m.startTimeOffset;Object(Q.isFiniteNumber)(D)?(N=E+D,D<0&&(N+=m.totalduration),N=Math.min(Math.max(E,N),E+m.totalduration),this.log("Start time offset "+D+" found in playlist, adjust startPosition to "+N),this.startPosition=N):m.live?N=this.hls.liveSyncPosition||E:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},o.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},o.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},o.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=C.IDLE)},o.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var N=E.frag;if(!N||N.type!==m)return;var D=this.fragCurrent;console.assert(D&&N.sn===D.sn&&N.level===D.level&&N.urlId===D.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+m+" "+N.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(W.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)},o.afterBufferFlushed=function(m,E,N){if(!m)return;var D=z.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,D,N),this.state===C.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.IDLE},o.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(m,E,N,D){var B=this,j=N.details;console.assert(!!j,"level.details must be defined");var I=Object.keys(m.elementaryStreams).reduce(function(v,G){var Y=m.elementaryStreams[G];if(Y){var re=Y.endPTS-Y.startPTS;if(re<=0)return B.warn("Could not parse fragment "+m.sn+" "+G+" duration reliably ("+re+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),v||!1;var oe=D?0:Object(n.updateFragPTSDTS)(j,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return B.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:j,level:N,drift:oe,type:G,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return v},!1);I?(this.state=C.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(_,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),_}(H.default)},"./src/controller/buffer-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return h});var Q=P("./src/polyfills/number.ts"),H=P("./src/events.ts"),F=P("./src/utils/logger.ts"),z=P("./src/errors.ts"),W=P("./src/utils/buffer-helper.ts"),M=P("./src/utils/mediasource-helper.ts"),O=P("./src/loader/fragment.ts"),g=P("./src/controller/buffer-operation-queue.ts"),p=Object(M.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function n(l){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=a.hls,c=a.media,L=a.mediaSource;F.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),u.trigger(H.Events.MEDIA_ATTACHED,{media:c})),L&&L.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){F.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){F.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var d=n.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var a=this.hls;a.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(H.Events.BUFFER_RESET,this.onBufferReset,this),a.on(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(H.Events.BUFFER_EOS,this.onBufferEos,this),a.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(H.Events.FRAG_PARSED,this.onFragParsed,this),a.on(H.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(H.Events.BUFFER_RESET,this.onBufferReset,this),a.off(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(H.Events.BUFFER_EOS,this.onBufferEos,this),a.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(H.Events.FRAG_PARSED,this.onFragParsed,this),a.off(H.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(a,u){var c=2;(u.audio&&!u.video||!u.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,F.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(a,u){var c=this.media=u.media;if(c&&p){var L=this.mediaSource=new p;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(L),this._objectUrl=c.src}},d.onMediaDetaching=function(){var a=this.media,u=this.mediaSource,c=this._objectUrl;if(u){if(F.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(L){F.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):F.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(H.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(u){var c=a.sourceBuffer[u];try{c&&(a.removeBufferListeners(u),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[u]=void 0)}catch(L){F.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",L)}}),this._initSourceBuffer()},d.onBufferCodecs=function(a,u){var c=this,L=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(S){if(L){var T=c.tracks[S];if(T&&typeof T.buffer.changeType=="function"){var R=u[S],C=R.codec,w=R.levelCodec,x=R.container,_=(T.levelCodec||T.codec).replace(f,"$1"),o=(w||C).replace(f,"$1");if(_!==o){var b=x+";codecs="+(w||C);c.appendChangeType(S,b)}}}else c.pendingTracks[S]=u[S]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(a,u){var c=this,L=this.operationQueue,S={execute:function(){var R=c.sourceBuffer[a];R&&(F.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+u),R.changeType(u)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(R){F.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",R)}};L.append(S,a)},d.onBufferAppending=function(a,u){var c=this,L=this.hls,S=this.operationQueue,T=this.tracks,R=u.data,C=u.type,w=u.frag,x=u.part,_=u.chunkMeta,o=_.buffering[C],b=self.performance.now();o.start=b;var m=w.stats.buffering,E=x?x.stats.buffering:null;m.start===0&&(m.start=b),E&&E.start===0&&(E.start=b);var N=T.audio,D=C==="audio"&&_.id===1&&(N==null?void 0:N.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),D){var I=c.sourceBuffer[C];if(I){var v=w.start-I.timestampOffset;Math.abs(v)>=.1&&(F.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+w.start+" (delta: "+v+") sn: "+w.sn+")"),I.timestampOffset=w.start)}}c.appendExecutor(R,C)},onStart:function(){},onComplete:function(){var I=self.performance.now();o.executeEnd=o.end=I,m.first===0&&(m.first=I),E&&E.first===0&&(E.first=I);var v=c.sourceBuffer,G={};for(var Y in v)G[Y]=W.BufferHelper.getBuffered(v[Y]);c.appendError=0,c.hls.trigger(H.Events.BUFFER_APPENDED,{type:C,frag:w,part:x,chunkMeta:_,parent:w.type,timeRanges:G})},onError:function(I){F.logger.error("[buffer-controller]: Error encountered while trying to append to the "+C+" SourceBuffer",I);var v={type:z.ErrorTypes.MEDIA_ERROR,parent:w.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?v.details=z.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,v.details=z.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>L.config.appendErrorMaxRetry&&(F.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),v.fatal=!0)),L.trigger(H.Events.ERROR,v)}};S.append(B,C)},d.onBufferFlushing=function(a,u){var c=this,L=this.operationQueue,S=function(R){return{execute:c.removeExecutor.bind(c,R,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(H.Events.BUFFER_FLUSHED,{type:R})},onError:function(w){F.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",w)}}};u.type?L.append(S(u.type),u.type):this.getSourceBufferTypes().forEach(function(T){L.append(S(T),T)})},d.onFragParsed=function(a,u){var c=this,L=u.frag,S=u.part,T=[],R=S?S.elementaryStreams:L.elementaryStreams;R[O.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(R[O.ElementaryStreamTypes.AUDIO]&&T.push("audio"),R[O.ElementaryStreamTypes.VIDEO]&&T.push("video"));var C=function(){var x=self.performance.now();L.stats.buffering.end=x,S&&(S.stats.buffering.end=x);var _=S?S.stats:L.stats;c.hls.trigger(H.Events.FRAG_BUFFERED,{frag:L,part:S,stats:_,id:L.type})};T.length===0&&F.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(C,T)},d.onFragChanged=function(a,u){this.flushBackBuffer()},d.onBufferEos=function(a,u){var c=this,L=this.getSourceBufferTypes().reduce(function(S,T){var R=c.sourceBuffer[T];return(!u.type||u.type===T)&&(R&&!R.ended&&(R.ended=!0,F.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),S&&!!(!R||R.ended)},!0);L&&this.blockBuffers(function(){var S=c.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},d.onLevelUpdated=function(a,u){var c=u.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var a=this.hls,u=this.details,c=this.media,L=this.sourceBuffer;if(!c||u===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var T=u.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(T)||T<0)return;var R=c.currentTime,C=u.levelTargetDuration,w=Math.max(T,C),x=Math.floor(R/C)*C-w;S.forEach(function(_){var o=L[_];if(o){var b=W.BufferHelper.getBuffered(o);b.length>0&&x>b.start(0)&&(a.trigger(H.Events.BACK_BUFFER_REACHED,{bufferEnd:x}),u.live&&a.trigger(H.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:x}),a.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:x,type:_}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,u=this.hls,c=this.media,L=this.mediaSource,S=a.fragments[0].start+a.totalduration,T=c.duration,R=Object(Q.isFiniteNumber)(L.duration)?L.duration:0;a.live&&u.config.liveDurationInfinity?(F.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(S>R&&S>T||!Object(Q.isFiniteNumber)(T))&&(F.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),L.duration=S)},d.updateSeekableRange=function(a){var u=this.mediaSource,c=a.fragments,L=c.length;if(L&&a.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var S=Math.max(0,c[0].start),T=Math.max(S,S+a.totalduration);u.setLiveSeekableRange(S,T)}},d.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,u=this.operationQueue,c=this.pendingTracks,L=Object.keys(c).length;if(L&&!a||L===2){this.createSourceBuffers(c),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(H.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}S.forEach(function(T){u.executeNext(T)})}},d.createSourceBuffers=function(a){var u=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var S in a)if(!u[S]){var T=a[S];if(!T)throw Error("source buffer exists for track "+S+", however track does not");var R=T.levelCodec||T.codec,C=T.container+";codecs="+R;F.logger.log("[buffer-controller]: creating sourceBuffer("+C+")");try{var w=u[S]=c.addSourceBuffer(C),x=S;this.addBufferListener(x,"updatestart",this._onSBUpdateStart),this.addBufferListener(x,"updateend",this._onSBUpdateEnd),this.addBufferListener(x,"error",this._onSBUpdateError),this.tracks[S]={buffer:w,codec:R,container:T.container,levelCodec:T.levelCodec,id:T.id},L++}catch(_){F.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(H.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:C})}}L&&this.hls.trigger(H.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(a){var u=this.operationQueue,c=u.current(a);c.onStart()},d._onSBUpdateEnd=function(a){var u=this.operationQueue,c=u.current(a);c.onComplete(),u.shiftAndExecuteNext(a)},d._onSBUpdateError=function(a,u){F.logger.error("[buffer-controller]: "+a+" SourceBuffer error",u),this.hls.trigger(H.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(u)},d.removeExecutor=function(a,u,c){var L=this.media,S=this.mediaSource,T=this.operationQueue,R=this.sourceBuffer,C=R[a];if(!L||!S||!C){F.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(a);return}var w=Object(Q.isFiniteNumber)(L.duration)?L.duration:Infinity,x=Object(Q.isFiniteNumber)(S.duration)?S.duration:Infinity,_=Math.max(0,u),o=Math.min(c,w,x);o>_?(F.logger.log("[buffer-controller]: Removing ["+_+","+o+"] from the "+a+" SourceBuffer"),console.assert(!C.updating,a+" sourceBuffer must not be updating"),C.remove(_,o)):T.shiftAndExecuteNext(a)},d.appendExecutor=function(a,u){var c=this.operationQueue,L=this.sourceBuffer,S=L[u];if(!S){F.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(u);return}S.ended=!1,console.assert(!S.updating,u+" sourceBuffer must not be updating"),S.appendBuffer(a)},d.blockBuffers=function(a,u){var c=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){F.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,S=u.map(function(T){return L.appendBlocker(T)});Promise.all(S).then(function(){a(),u.forEach(function(T){var R=c.sourceBuffer[T];(!R||!R.updating)&&L.shiftAndExecuteNext(T)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(a,u,c){var L=this.sourceBuffer[a];if(!L)return;var S=c.bind(this,a);this.listeners[a].push({event:u,listener:S}),L.addEventListener(u,S)},d.removeBufferListeners=function(a){var u=this.sourceBuffer[a];if(!u)return;this.listeners[a].forEach(function(c){u.removeEventListener(c.event,c.listener)})},n}()},"./src/controller/buffer-operation-queue.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return H});var Q=P("./src/utils/logger.ts"),H=function(){function F(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var z=F.prototype;return z.append=function(M,O){var g=this.queues[O];g.push(M),g.length===1&&this.buffers[O]&&this.executeNext(O)},z.insertAbort=function(M,O){var g=this.queues[O];g.unshift(M),this.executeNext(O)},z.appendBlocker=function(M){var O,g=new Promise(function(f){O=f}),p={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,M),g},z.executeNext=function(M){var O=this.buffers,g=this.queues,p=O[M],f=g[M];if(f.length){var h=f[0];try{h.execute()}catch(n){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(n),(!p||!p.updating)&&(f.shift(),this.executeNext(M))}}},z.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},z.current=function(M){return this.queues[M][0]},F}()},"./src/controller/cap-level-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts");function H(W,M){for(var O=0;O<M.length;O++){var g=M[O];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(W,g.key,g)}}function F(W,M,O){return M&&H(W.prototype,M),O&&H(W,O),W}var z=function(){function W(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=W.prototype;return M.setStreamController=function(g){this.streamController=g},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var g=this.hls;g.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var g=this.hls;g.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(g,p){W.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},M.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},M.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},M.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(g.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},M.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var h=f.filter(function(n,d){return W.isLevelAllowed(d,p.restrictedLevels)&&d<=g});return this.clientRect=null,W.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var f=g.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||g.width||0,p.height=f.bottom-f.top||g.height||0)}return this.clientRect=p,p},W.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},W.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var h=function(u,c){return c?u.width!==c.width||u.height!==c.height:!0},n=g.length-1,d=0;d<g.length;d+=1){var l=g[d];if((l.width>=p||l.height>=f)&&h(l,g[d+1])){n=d;break}}return n},F(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),W}();J.default=z},"./src/controller/cmcd-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return h});var Q=P("./src/events.ts"),H=P("./src/types/cmcd.ts"),F=P("./src/utils/buffer-helper.ts"),z=P("./src/utils/logger.ts");function W(n,d){for(var l=0;l<d.length;l++){var a=d[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}function M(n,d,l){return d&&W(n.prototype,d),l&&W(n,l),n}function O(n,d){var l=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(l)return(l=l.call(n)).next.bind(l);if(Array.isArray(n)||(l=g(n))||d&&n&&typeof n.length=="number"){l&&(n=l);var a=0;return function(){return a>=n.length?{done:!0}:{done:!1,value:n[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(n,d){if(!n)return;if(typeof n=="string")return p(n,d);var l=Object.prototype.toString.call(n).slice(8,-1);if(l==="Object"&&n.constructor&&(l=n.constructor.name),l==="Map"||l==="Set")return Array.from(n);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return p(n,d)}function p(n,d){(d==null||d>n.length)&&(d=n.length);for(var l=0,a=new Array(d);l<d;l++)a[l]=n[l];return a}function f(){return f=Object.assign||function(n){for(var d=1;d<arguments.length;d++){var l=arguments[d];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(n[a]=l[a])}return n},f.apply(this,arguments)}var h=function(){function n(l){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(L){try{a.apply(L,{ot:H.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(S){z.logger.warn("Could not generate manifest CMCD data.",S)}},this.applyFragmentData=function(L){try{var S=L.frag,T=a.hls.levels[S.level],R=a.getObjectType(S),C={d:S.duration*1e3,ot:R};(R===H.CMCDObjectType.VIDEO||R===H.CMCDObjectType.AUDIO||R==H.CMCDObjectType.MUXED)&&(C.br=T.bitrate/1e3,C.tb=a.getTopBandwidth(R),C.bl=a.getBufferLength(R)),a.apply(L,C)}catch(w){z.logger.warn("Could not generate segment CMCD data.",w)}},this.hls=l;var u=this.config=l.config,c=u.cmcd;c!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||n.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var d=n.prototype;return d.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},d.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},d.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},d.onMediaAttached=function(a,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},d.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},d.onBufferCreated=function(a,u){var c,L;this.audioBuffer=(c=u.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(L=u.tracks.video)===null||L===void 0?void 0:L.buffer},d.createData=function(){var a;return{v:H.CMCDVersion,sf:H.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},d.apply=function(a,u){u===void 0&&(u={}),f(u,this.createData());var c=u.ot===H.CMCDObjectType.INIT||u.ot===H.CMCDObjectType.VIDEO||u.ot===H.CMCDObjectType.MUXED;if(this.starved&&c&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var L=n.toHeaders(u);if(!Object.keys(L).length)return;a.headers||(a.headers={}),f(a.headers,L)}else{var S=n.toQuery(u);if(!S)return;a.url=n.appendQueryToUri(a.url,S)}},d.getObjectType=function(a){var u=a.type;return u==="subtitle"?H.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?H.CMCDObjectType.INIT:u==="audio"?H.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?H.CMCDObjectType.VIDEO:H.CMCDObjectType.MUXED:void 0},d.getTopBandwidth=function(a){for(var u=0,c=a===H.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=O(c),S;!(S=L()).done;){var T=S.value;T.bitrate>u&&(u=T.bitrate)}return u>0?u:NaN},d.getBufferLength=function(a){var u=this.hls.media,c=a===H.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!u)return NaN;var L=F.BufferHelper.bufferInfo(c,u.currentTime,this.config.maxBufferHole);return L.len*1e3},d.createPlaylistLoader=function(){var a=this.config.pLoader,u=this.applyPlaylistData,c=a||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var S=L.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,C,w){u(R),this.loader.load(R,C,w)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},d.createFragmentLoader=function(){var a=this.config.fLoader,u=this.applyFragmentData,c=a||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var S=L.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,C,w){u(R),this.loader.load(R,C,w)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},n.uuid=function(){var a=URL.createObjectURL(new Blob),u=a.toString();return URL.revokeObjectURL(a),u.substr(u.lastIndexOf("/")+1)},n.serialize=function(a){for(var u=[],c=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},L=function(D){return Math.round(D)},S=function(D){return L(D/100)*100},T=function(D){return encodeURIComponent(D)},R={br:L,d:L,bl:S,dl:S,mtp:S,nor:T,rtp:S,tb:L},C=Object.keys(a||{}).sort(),w=O(C),x;!(x=w()).done;){var _=x.value,o=a[_];if(!c(o))continue;if(_==="v"&&o===1)continue;if(_=="pr"&&o===1)continue;var b=R[_];b&&(o=b(o));var m=typeof o,E=void 0;_==="ot"||_==="sf"||_==="st"?E=_+"="+o:m==="boolean"?E=_:m==="number"?E=_+"="+o:E=_+"="+JSON.stringify(o),u.push(E)}return u.join(",")},n.toHeaders=function(a){for(var u=Object.keys(a),c={},L=["Object","Request","Session","Status"],S=[{},{},{},{}],T={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},R=0,C=u;R<C.length;R++){var w=C[R],x=T[w]!=null?T[w]:1;S[x][w]=a[w]}for(var _=0;_<S.length;_++){var o=n.serialize(S[_]);o&&(c["CMCD-"+L[_]]=o)}return c},n.toQuery=function(a){return"CMCD="+encodeURIComponent(n.serialize(a))},n.appendQueryToUri=function(a,u){if(!u)return a;var c=a.includes("?")?"&":"?";return""+a+c+u},n}()},"./src/controller/eme-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),z=P("./src/utils/mediakeys-helper.ts");function W(h,n){for(var d=0;d<n.length;d++){var l=n[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function M(h,n,d){return n&&W(h.prototype,n),d&&W(h,d),h}var O=3,g=function(n,d,l){var a={audioCapabilities:[],videoCapabilities:[]};return n.forEach(function(u){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:l.audioRobustness||""})}),d.forEach(function(u){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:l.videoRobustness||""})}),[a]},p=function(n,d,l,a){switch(n){case z.KeySystems.WIDEVINE:return g(d,l,a);default:throw new Error("Unknown key-system: "+n)}},f=function(){function h(d){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=d,this._config=d.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 n=h.prototype;return n.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},n._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},n._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},n.getLicenseServerUrl=function(l){switch(l){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},n._attemptKeySystemAccess=function(l,a,u){var c=this,L=p(l,a,u,this._drmSystemOptions);F.logger.log("Requesting encrypted media key-system access");var S=this.requestMediaKeySystemAccess(l,L);this.mediaKeysPromise=S.then(function(T){return c._onMediaKeySystemAccessObtained(l,T)}),S.catch(function(T){F.logger.error('Failed to obtain key-system "'+l+'" access:',T)})},n._onMediaKeySystemAccessObtained=function(l,a){var u=this;F.logger.log('Access for key-system "'+l+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:l};this._mediaKeysList.push(c);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(S){return c.mediaKeys=S,F.logger.log('Media-keys created for key-system "'+l+'"'),u._onMediaKeysCreated(),S});return L.catch(function(S){F.logger.error("Failed to create media-keys:",S)}),L},n._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),l._onNewMediaKeySession(a.mediaKeysSession))})},n._onNewMediaKeySession=function(l){var a=this;F.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(u){a._onKeySessionMessage(l,u.message)},!1)},n._onKeySessionMessage=function(l,a){F.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(u){F.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),l.update(u)})},n.onMediaEncrypted=function(l){var a=this;if(F.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(u).catch(u)},n._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){F.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}F.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},n._generateRequestWithPreferredKeySession=function(l,a){var u=this,c=this._mediaKeysList[0];if(!c){F.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){F.logger.warn("Key-Session already initialized but requested again");return}var L=c.mediaKeysSession;if(!L){F.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){F.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}F.logger.log('Generating key-session request for "'+l+'" init data type'),c.mediaKeysSessionInitialized=!0,L.generateRequest(l,a).then(function(){F.logger.debug("Key-session generation succeeded")}).catch(function(S){F.logger.error("Error generating key-session request:",S),u.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},n._createLicenseXhr=function(l,a,u){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,l,a,u);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,c,l),L=void 0}catch(S){F.logger.error(S)}try{c.readyState||c.open("POST",l,!0),L&&L.call(this.hls,c,l)}catch(S){throw new Error("issue setting up KeySystem license XHR "+S)}return c},n._onLicenseRequestReadyStageChange=function(l,a,u,c){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,F.logger.log("License request succeeded");var L=l.response,S=this._licenseResponseCallback;if(S)try{L=S.call(this.hls,l,a)}catch(R){F.logger.error(R)}c(L)}else{if(F.logger.error("License Request XHR failed ("+a+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=O-this._requestLicenseFailureCount+1;F.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(u,c)}break}},n._generateLicenseRequestChallenge=function(l,a){switch(l.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},n._requestLicense=function(l,a){F.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){F.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(u.mediaKeySystemDomain),L=this._createLicenseXhr(c,l,a);F.logger.log("Sending license request to URL: "+c);var S=this._generateLicenseRequestChallenge(u,l);L.send(S)}catch(T){F.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},n.onMediaAttached=function(l,a){if(!this._emeEnabled)return;var u=a.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},n.onMediaDetached=function(){var l=this._media,a=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},n.onManifestParsed=function(l,a){if(!this._emeEnabled)return;var u=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),c=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,u,c)},M(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();J.default=f},"./src/controller/fps-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts"),H=P("./src/utils/logger.ts"),F=function(){function z(M){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=M,this.registerListeners()}var W=z.prototype;return W.setStreamController=function(O){this.streamController=O},W.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(O,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(O,g,p){var f=performance.now();if(g){if(this.lastTime){var h=f-this.lastTime,n=p-this.lastDroppedFrames,d=g-this.lastDecodedFrames,l=1e3*n/h,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:n,currentDecoded:d,totalDroppedFrames:p}),l>0&&n>a.config.fpsDroppedMonitoringThreshold*d){var u=a.currentLevel;H.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=u)&&(u=u-1,a.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:a.currentLevel}),a.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},W.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var g=O.getVideoPlaybackQuality();this.checkFPS(O,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},z}();J.default=F},"./src/controller/fragment-finders.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"findFragmentByPDT",function(){return F}),P.d(J,"findFragmentByPTS",function(){return z}),P.d(J,"fragmentWithinToleranceTest",function(){return W}),P.d(J,"pdtWithinToleranceTest",function(){return M}),P.d(J,"findFragWithCC",function(){return O});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/binary-search.ts");function F(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(Q.isFiniteNumber)(p))return null;var h=g[0].programDateTime;if(p<(h||0))return null;var n=g[g.length-1].endProgramDateTime;if(p>=(n||0))return null;f=f||0;for(var d=0;d<g.length;++d){var l=g[d];if(M(p,f,l))return l}return null}function z(g,p,f,h){f===void 0&&(f=0),h===void 0&&(h=0);var n=null;if(g?n=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(n=p[0]),n&&W(f,h,n)===0)return n;var d=H.default.search(p,W.bind(null,f,h));return d||n}function W(g,p,f){g===void 0&&(g=0),p===void 0&&(p=0);var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-h<=g?1:f.start-h>g&&f.start?-1:0}function M(g,p,f){var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,n=f.endProgramDateTime||0;return n-h>g}function O(g,p){return H.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"FragmentState",function(){return F}),P.d(J,"FragmentTracker",function(){return z});var Q=P("./src/events.ts"),H=P("./src/types/loader.ts"),F;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(F||(F={}));var z=function(){function O(p){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=p,this._registerListeners()}var g=O.prototype;return g._registerListeners=function(){var f=this.hls;f.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,h){if(h===H.PlaylistLevelType.MAIN){var n=this.activeFragment,d=this.activeParts;if(!n)return null;if(d)for(var l=d.length;l--;){var a=d[l],u=a?a.end:n.appendedPTS;if(a.start<=f&&u!==void 0&&f<=u)return l>9&&(this.activeParts=d.slice(l-9)),a}else if(n.start<=f&&n.appendedPTS!==void 0&&f<=n.appendedPTS)return n}return this.getBufferedFrag(f,h)},g.getBufferedFrag=function(f,h){for(var n=this.fragments,d=Object.keys(n),l=d.length;l--;){var a=n[d[l]];if((a==null?void 0:a.body.type)===h&&a.buffered){var u=a.body;if(u.start<=f&&f<=u.end)return u}}return null},g.detectEvictedFragments=function(f,h,n){var d=this;Object.keys(this.fragments).forEach(function(l){var a=d.fragments[l];if(!a)return;if(!a.buffered){a.body.type===n&&d.removeFragment(a.body);return}var u=a.range[f];if(!u)return;u.time.some(function(c){var L=!d.isTimeBuffered(c.startPTS,c.endPTS,h);return L&&d.removeFragment(a.body),L})})},g.detectPartialFragments=function(f){var h=this,n=this.timeRanges,d=f.frag,l=f.part;if(!n||d.sn==="initSegment")return;var a=M(d),u=this.fragments[a];if(!u)return;Object.keys(n).forEach(function(c){var L=d.elementaryStreams[c];if(!L)return;var S=n[c],T=l!==null||L.partial===!0;u.range[c]=h.getBufferedTimes(d,l,T,S)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},g.fragBuffered=function(f){var h=M(f),n=this.fragments[h];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},g.getBufferedTimes=function(f,h,n,d){for(var l={time:[],partial:n},a=h?h.start:f.start,u=h?h.end:f.end,c=f.minEndPTS||u,L=f.maxStartPTS||a,S=0;S<d.length;S++){var T=d.start(S)-this.bufferPadding,R=d.end(S)+this.bufferPadding;if(L>=T&&c<=R){l.time.push({startPTS:Math.max(a,d.start(S)),endPTS:Math.min(u,d.end(S))});break}else if(a<R&&u>T)l.partial=!0,l.time.push({startPTS:Math.max(a,d.start(S)),endPTS:Math.min(u,d.end(S))});else if(u<=T)break}return l},g.getPartialFragment=function(f){var h=null,n,d,l,a=0,u=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(L){var S=c[L];if(!S)return;W(S)&&(d=S.body.start-u,l=S.body.end+u,f>=d&&f<=l&&(n=Math.min(f-d,l-f),a<=n&&(h=S.body,a=n)))}),h},g.getState=function(f){var h=M(f),n=this.fragments[h];return n?n.buffered?W(n)?F.PARTIAL:F.OK:n.backtrack?F.BACKTRACKED:F.APPENDING:F.NOT_LOADED},g.backtrack=function(f,h){var n=M(f),d=this.fragments[n];if(!d||d.backtrack)return null;var l=d.backtrack=h||d.loaded;return d.loaded=null,l},g.getBacktrackData=function(f){var h=M(f),n=this.fragments[h];if(n){var d,l=n.backtrack;if(l!=null&&(d=l.payload)!==null&&d!==void 0&&d.byteLength)return l;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,h,n){for(var d,l,a=0;a<n.length;a++){if(d=n.start(a)-this.bufferPadding,l=n.end(a)+this.bufferPadding,f>=d&&h<=l)return!0;if(h<=d)return!1}return!1},g.onFragLoaded=function(f,h){var n=h.frag,d=h.part;if(n.sn==="initSegment"||n.bitrateTest||d)return;var l=M(n);this.fragments[l]={body:n,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,h){var n=this,d=h.frag,l=h.part,a=h.timeRanges;if(d.type===H.PlaylistLevelType.MAIN)if(this.activeFragment=d,l){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(l)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var L=a[c];if(n.detectEvictedFragments(c,L),!l)for(var S=0;S<L.length;S++)d.appendedPTS=Math.max(L.end(S),d.appendedPTS||0)})},g.onFragBuffered=function(f,h){this.detectPartialFragments(h)},g.hasFragment=function(f){var h=M(f);return!!this.fragments[h]},g.removeFragmentsInRange=function(f,h,n){var d=this;Object.keys(this.fragments).forEach(function(l){var a=d.fragments[l];if(!a)return;if(a.buffered){var u=a.body;u.type===n&&u.start<h&&u.end>f&&d.removeFragment(u)}})},g.removeFragment=function(f){var h=M(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[h]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function W(O){var g,p;return O.buffered&&(((g=O.range.video)===null||g===void 0?void 0:g.partial)||((p=O.range.audio)===null||p===void 0?void 0:p.partial))}function M(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"STALL_MINIMUM_DURATION_MS",function(){return W}),P.d(J,"MAX_START_GAP_JUMP",function(){return M}),P.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),P.d(J,"SKIP_BUFFER_RANGE_START",function(){return g}),P.d(J,"default",function(){return p});var Q=P("./src/utils/buffer-helper.ts"),H=P("./src/errors.ts"),F=P("./src/events.ts"),z=P("./src/utils/logger.ts"),W=250,M=2,O=.1,g=.05,p=function(){function f(n,d,l,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=n,this.media=d,this.fragmentTracker=l,this.hls=a}var h=f.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(d){var l=this.config,a=this.media,u=this.stalled,c=a.currentTime,L=a.seeking,S=this.seeking&&!L,T=!this.seeking&&L;if(this.seeking=L,c!==d){if(this.moved=!0,u!==null){if(this.stallReported){var R=self.performance.now()-u;z.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||S)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var C=Q.BufferHelper.bufferInfo(a,c,0),w=C.len>0,x=C.nextStart||0;if(!w&&!x)return;if(L){var _=C.len>M,o=!x||x-c>M&&!this.fragmentTracker.getPartialFragment(c);if(_||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,m=Math.max(x,C.start||0)-c,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((b=E.details)===null||b===void 0)?void 0:b.live,D=N?E.details.targetduration*2:M;if(m>0&&m<=D){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(u===null){this.stalled=B;return}var j=B-u;!L&&j>=W&&this._reportStall(C.len);var I=Q.BufferHelper.bufferInfo(a,c,l.maxBufferHole);this._tryFixBufferStall(I,j)},h._tryFixBufferStall=function(d,l){var a=this.config,u=this.fragmentTracker,c=this.media,L=c.currentTime,S=u.getPartialFragment(L);if(S){var T=this._trySkipBufferHole(S);if(T)return}d.len>a.maxBufferHole&&l>a.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(d){var l=this.hls,a=this.media,u=this.stallReported;u||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+d+")"),l.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},h._trySkipBufferHole=function(d){for(var l=this.config,a=this.hls,u=this.media,c=u.currentTime,L=0,S=Q.BufferHelper.getBuffered(u),T=0;T<S.length;T++){var R=S.start(T);if(c+l.maxBufferHole>=L&&c<R){var C=Math.max(R+g,u.currentTime+O);return z.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+C),this.moved=!0,this.stalled=null,u.currentTime=C,d&&a.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+C,frag:d}),C}L=S.end(T)}return 0},h._tryNudgeBuffer=function(){var d=this.config,l=this.hls,a=this.media,u=a.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<d.nudgeMaxRetry){var L=u+c*d.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+u+" to "+L),a.currentTime=L,l.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+d.nudgeMaxRetry+" nudges"),l.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts"),H=P("./src/utils/texttrack-utils.ts"),F=P("./src/demux/id3.ts"),z=.25,W=function(){function M(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var O=M.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var p=this.hls;p.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var p=this.hls;p.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(p,f){this.media=f.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(H.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(p){if(!this.media)return;for(var f=0;f<p.length;f++){var h=p[f];if(h.kind==="metadata"&&h.label==="id3")return Object(H.sendAddTrackEvent)(h,this.media),h}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(p,f){if(!this.media)return;var h=f.frag,n=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var d=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<n.length;l++){var a=F.getID3Frames(n[l].data);if(a){var u=n[l].pts,c=l<n.length-1?n[l+1].pts:h.end,L=c-u;L<=0&&(c=u+z);for(var S=0;S<a.length;S++){var T=a[S];if(!F.isTimeStampFrame(T)){var R=new d(u,c,"");R.value=T,this.id3Track.addCue(R)}}}}},O.onBufferFlushing=function(p,f){var h=f.startOffset,n=f.endOffset,d=f.type;if(!d||d==="audio"){var l=this.id3Track;l&&Object(H.removeCuesInRange)(l,h,n)}},M}();J.default=W},"./src/controller/latency-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return M});var Q=P("./src/errors.ts"),H=P("./src/events.ts"),F=P("./src/utils/logger.ts");function z(O,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(O,f.key,f)}}function W(O,g,p){return g&&z(O.prototype,g),p&&z(O,p),O}var M=function(){function O(p){var f=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 f.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var g=O.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(H.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(H.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(H.Events.ERROR,this.onError)},g.onMediaAttached=function(f,h){this.media=h.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(f,h){var n=h.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(f,h){if(h.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,F.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var f=this.media,h=this.levelDetails;if(!f||!h)return;this.currentTime=f.currentTime;var n=this.computeLatency();if(n===null)return;this._latency=n;var d=this.config,l=d.lowLatencyMode,a=d.maxLiveSyncPlaybackRate;if(!l||a===1)return;var u=this.targetLatency;if(u===null)return;var c=n-u,L=Math.min(this.maxLatency,u+h.targetduration),S=c<L;if(h.live&&S&&c>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,a)),R=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;f.playbackRate=Math.min(T,Math.max(1,R))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},g.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},g.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},W(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,h=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:h?f.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var h=f.holdBack,n=f.partHoldBack,d=f.targetduration,l=this.config,a=l.liveSyncDuration,u=l.liveSyncDurationCount,c=l.lowLatencyMode,L=this.hls.userConfig,S=c&&n||h;(L.liveSyncDuration||L.liveSyncDurationCount||S===0)&&(S=a!==void 0?a:u*d);var T=d,R=1;return S+Math.min(this.stallCount*R,T)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),h=this.targetLatency,n=this.levelDetails;if(f===null||h===null||n===null)return null;var d=n.edge,l=f-h-this.edgeStalled,a=d-n.totalduration,u=d-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,l),u)}},{key:"drift",get:function(){var f=this.levelDetails;return f===null?1:f.drift}},{key:"edgeStalled",get:function(){var f=this.levelDetails;if(f===null)return 0;var h=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-h,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,h=this.levelDetails;if(!f||!h)return 0;var n=f.buffered.length;return n?f.buffered.end(n-1):h.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return l});var Q=P("./src/types/level.ts"),H=P("./src/events.ts"),F=P("./src/errors.ts"),z=P("./src/utils/codecs.ts"),W=P("./src/controller/level-helper.ts"),M=P("./src/controller/base-playlist-controller.ts"),O=P("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var u=1;u<arguments.length;u++){var c=arguments[u];for(var L in c)Object.prototype.hasOwnProperty.call(c,L)&&(a[L]=c[L])}return a},g.apply(this,arguments)}function p(a,u){for(var c=0;c<u.length;c++){var L=u[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function f(a,u,c){return u&&p(a.prototype,u),c&&p(a,c),a}function h(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,n(a,u)}function n(a,u){return n=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},n(a,u)}var d=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(a){h(u,a);function u(L){var S;return S=a.call(this,L,"[level-controller]")||this,S._levels=[],S._firstLevel=-1,S._startLevel=void 0,S.currentLevelIndex=-1,S.manualLevelIndex=-1,S.onParsedComplete=void 0,S._registerListeners(),S}var c=u.prototype;return c._registerListeners=function(){var S=this.hls;S.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),S.on(H.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var S=this.hls;S.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),S.off(H.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},c.startLoad=function(){var S=this._levels;S.forEach(function(T){T.loadError=0}),a.prototype.startLoad.call(this)},c.onManifestLoaded=function(S,T){var R=[],C=[],w=[],x,_={},o,b=!1,m=!1,E=!1;if(T.levels.forEach(function(j){var I=j.attrs;b=b||!!(j.width&&j.height),m=m||!!j.videoCodec,E=E||!!j.audioCodec,d&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var v=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;o=_[v],o?o.url.push(j.url):(o=new Q.Level(j),_[v]=o,R.push(o)),I&&(I.AUDIO&&Object(W.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(W.addGroupId)(o,"text",I.SUBTITLES))}),(b||m)&&E&&(R=R.filter(function(j){var I=j.videoCodec,v=j.width,G=j.height;return!!I||!!(v&&G)})),R=R.filter(function(j){var I=j.audioCodec,v=j.videoCodec;return(!I||Object(z.isCodecSupportedInMp4)(I,"audio"))&&(!v||Object(z.isCodecSupportedInMp4)(v,"video"))}),T.audioTracks&&(C=T.audioTracks.filter(function(j){return!j.audioCodec||Object(z.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(C)),T.subtitles&&(w=T.subtitles,Object(W.assignTrackIdsByGroup)(w)),R.length>0){x=R[0].bitrate,R.sort(function(j,I){return j.bitrate-I.bitrate}),this._levels=R;for(var N=0;N<R.length;N++)if(R[N].bitrate===x){this._firstLevel=N,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+x);break}var D=E&&!m,B={levels:R,audioTracks:C,subtitleTracks:w,firstLevel:this._firstLevel,stats:T.stats,audio:E,video:m,altAudio:!D&&C.some(function(j){return!!j.url})};this.hls.trigger(H.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(H.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(S,T){if(a.prototype.onError.call(this,S,T),T.fatal)return;var R=T.context,C=this._levels[this.currentLevelIndex];if(R&&(R.type===O.PlaylistContextType.AUDIO_TRACK&&C.audioGroupIds&&R.groupId===C.audioGroupIds[C.urlId]||R.type===O.PlaylistContextType.SUBTITLE_TRACK&&C.textGroupIds&&R.groupId===C.textGroupIds[C.urlId])){this.redundantFailover(this.currentLevelIndex);return}var w=!1,x=!0,_;switch(T.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:case F.ErrorDetails.KEY_LOAD_ERROR:case F.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var o=this._levels[T.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(_=T.frag.level)):_=T.frag.level}break;case F.ErrorDetails.LEVEL_LOAD_ERROR:case F.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(x=!1),_=R.level),w=!0;break;case F.ErrorDetails.REMUX_ALLOC_ERROR:_=T.level,w=!0;break}_!==void 0&&this.recoverLevel(T,_,w,x)},c.recoverLevel=function(S,T,R,C){var w=S.details,x=this._levels[T];if(x.loadError++,R){var _=this.retryLoadingOrFail(S);if(_)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(C){var o=x.url.length;if(o>1&&x.loadError<o)S.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var b=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(w+": switch to "+b),S.levelRetry=!0,this.hls.nextAutoLevel=b)}}},c.redundantFailover=function(S){var T=this._levels[S],R=T.url.length;if(R>1){var C=(T.urlId+1)%R;this.warn("Switching to redundant URL-id "+C),this._levels.forEach(function(w){w.urlId=C}),this.level=S}},c.onFragLoaded=function(S,T){var R=T.frag;if(R!==void 0&&R.type===O.PlaylistLevelType.MAIN){var C=this._levels[R.level];C!==void 0&&(C.fragmentError=0,C.loadError=0)}},c.onLevelLoaded=function(S,T){var R,C=T.level,w=T.details,x=this._levels[C];if(!x){var _;this.warn("Invalid level index "+C),(_=T.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(w.deltaUpdateFailed=!0);return}C===this.currentLevelIndex?(x.fragmentError===0&&(x.loadError=0,this.retryCount=0),this.playlistLoaded(C,T,x.details)):(R=T.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(w.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(S,T){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var C=-1,w=this.hls.audioTracks[T.id].groupId,x=0;x<R.audioGroupIds.length;x++)if(R.audioGroupIds[x]===w){C=x;break}C!==R.urlId&&(R.urlId=C,this.startLoad())}},c.loadPlaylist=function(S){var T=this.currentLevelIndex,R=this._levels[T];if(this.canLoad&&R&&R.url.length>0){var C=R.urlId,w=R.url[C];if(S)try{w=S.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Attempt loading level index "+T+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+C+" "+w),this.clearTimer(),this.hls.trigger(H.Events.LEVEL_LOADING,{url:w,level:T,id:C,deliveryDirectives:S||null})}},c.removeLevel=function(S,T){var R=function(x,_){return _!==T},C=this._levels.filter(function(w,x){return x!==S?!0:w.url.length>1&&T!==void 0?(w.url=w.url.filter(R),w.audioGroupIds&&(w.audioGroupIds=w.audioGroupIds.filter(R)),w.textGroupIds&&(w.textGroupIds=w.textGroupIds.filter(R)),w.urlId=0,!0):!1}).map(function(w,x){var _=w.details;return _!=null&&_.fragments&&_.fragments.forEach(function(o){o.level=x}),w});this._levels=C,this.hls.trigger(H.Events.LEVELS_UPDATED,{levels:C})},f(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var T,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===S&&(T=R[S])!==null&&T!==void 0&&T.details)return;if(S<0||S>=R.length){var C=S<0;if(this.hls.trigger(H.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:C,reason:"invalid level idx"}),C)return;S=Math.min(S,R.length-1)}this.clearTimer();var w=this.currentLevelIndex,x=R[w],_=R[S];this.log("switching to level "+S+" from "+w),this.currentLevelIndex=S;var o=g({},_,{level:S,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete o._urlId,this.hls.trigger(H.Events.LEVEL_SWITCHING,o);var b=_.details;if(!b||b.live){var m=this.switchParams(_.uri,x==null?void 0:x.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(S){this.manualLevelIndex=S,this._startLevel===void 0&&(this._startLevel=S),S!==-1&&(this.level=S)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(S){this._firstLevel=S}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var S=this.hls.config.startLevel;return S!==void 0?S:this._firstLevel}else return this._startLevel},set:function(S){this._startLevel=S}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(S){this.level=S,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=S)}}]),u}(M.default)},"./src/controller/level-helper.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"addGroupId",function(){return F}),P.d(J,"assignTrackIdsByGroup",function(){return z}),P.d(J,"updatePTS",function(){return W}),P.d(J,"updateFragPTSDTS",function(){return O}),P.d(J,"mergeDetails",function(){return g}),P.d(J,"mapPartIntersection",function(){return p}),P.d(J,"mapFragmentIntersection",function(){return f}),P.d(J,"adjustSliding",function(){return h}),P.d(J,"addSliding",function(){return n}),P.d(J,"computeReloadInterval",function(){return d}),P.d(J,"getFragmentWithSN",function(){return l}),P.d(J,"getPartWith",function(){return a});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/logger.ts");function F(u,c,L){switch(c){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(L);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(L);break}}function z(u){var c={};u.forEach(function(L){var S=L.groupId||"";L.id=c[S]=c[S]||0,c[S]++})}function W(u,c,L){var S=u[c],T=u[L];M(S,T)}function M(u,c){var L=c.startPTS;if(Object(Q.isFiniteNumber)(L)){var S=0,T;c.sn>u.sn?(S=L-u.start,T=u):(S=u.start-L,T=c),T.duration!==S&&(T.duration=S)}else if(c.sn>u.sn){var R=u.cc===c.cc;R&&u.minEndPTS?c.start=u.start+(u.minEndPTS-u.start):c.start=u.start+u.duration}else c.start=Math.max(u.start-c.duration,0)}function O(u,c,L,S,T,R){var C=S-L;C<=0&&(H.logger.warn("Fragment should have a positive duration",c),S=L+c.duration,R=T+c.duration);var w=L,x=S,_=c.startPTS,o=c.endPTS;if(Object(Q.isFiniteNumber)(_)){var b=Math.abs(_-L);Object(Q.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,w=Math.max(L,_),L=Math.min(L,_),T=Math.min(T,c.startDTS),x=Math.min(S,o),S=Math.max(S,o),R=Math.max(R,c.endDTS)}c.duration=S-L;var m=L-c.start;c.appendedPTS=S,c.start=c.startPTS=L,c.maxStartPTS=w,c.startDTS=T,c.endPTS=S,c.minEndPTS=x,c.endDTS=R;var E=c.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var N,D=E-u.startSN,B=u.fragments;for(B[D]=c,N=D;N>0;N--)M(B[N],B[N-1]);for(N=D;N<B.length-1;N++)M(B[N],B[N+1]);return u.fragmentHint&&M(B[B.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function g(u,c){for(var L=null,S=u.fragments,T=S.length-1;T>=0;T--){var R=S[T].initSegment;if(R){L=R;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var C=0,w;if(f(u,c,function(N,D){N.relurl&&(C=N.cc-D.cc),Object(Q.isFiniteNumber)(N.startPTS)&&Object(Q.isFiniteNumber)(N.endPTS)&&(D.start=D.startPTS=N.startPTS,D.startDTS=N.startDTS,D.appendedPTS=N.appendedPTS,D.maxStartPTS=N.maxStartPTS,D.endPTS=N.endPTS,D.endDTS=N.endDTS,D.minEndPTS=N.minEndPTS,D.duration=N.endPTS-N.startPTS,D.duration&&(w=D),c.PTSKnown=c.alignedSliding=!0),D.elementaryStreams=N.elementaryStreams,D.loader=N.loader,D.stats=N.stats,D.urlId=N.urlId,N.initSegment&&(D.initSegment=N.initSegment,L=N.initSegment)}),L){var x=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;x.forEach(function(N){var D;(!N.initSegment||N.initSegment.relurl===((D=L)===null||D===void 0?void 0:D.relurl))&&(N.initSegment=L)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(N){return!N}),c.deltaUpdateFailed)){H.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=c.skippedSegments;_--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var o=c.fragments;if(C){H.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<o.length;b++)o[b].cc+=C}c.skippedSegments&&(c.startCC=c.fragments[0].cc),p(u.partList,c.partList,function(N,D){D.elementaryStreams=N.elementaryStreams,D.stats=N.stats}),w?O(c,w,w.startPTS,w.endPTS,w.startDTS,w.endDTS):h(u,c),o.length&&(c.totalduration=c.edge-o[0].start),c.driftStartTime=u.driftStartTime,c.driftStart=u.driftStart;var m=c.advancedDateTime;if(c.advanced&&m){var E=c.edge;c.driftStart||(c.driftStartTime=m,c.driftStart=E),c.driftEndTime=m,c.driftEnd=E}else c.driftEndTime=u.driftEndTime,c.driftEnd=u.driftEnd,c.advancedDateTime=u.advancedDateTime}function p(u,c,L){if(u&&c)for(var S=0,T=0,R=u.length;T<=R;T++){var C=u[T],w=c[T+S];C&&w&&C.index===w.index&&C.fragment.sn===w.fragment.sn?L(C,w):S--}}function f(u,c,L){for(var S=c.skippedSegments,T=Math.max(u.startSN,c.startSN)-c.startSN,R=(u.fragmentHint?1:0)+(S?c.endSN:Math.min(u.endSN,c.endSN))-c.startSN,C=c.startSN-u.startSN,w=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,x=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,_=T;_<=R;_++){var o=x[C+_],b=w[_];S&&!b&&_<S&&(b=c.fragments[_]=o),o&&b&&L(o,b)}}function h(u,c){var L=c.startSN+c.skippedSegments-u.startSN,S=u.fragments;if(L<0||L>=S.length)return;n(c,S[L].start)}function n(u,c){if(c){for(var L=u.fragments,S=u.skippedSegments;S<L.length;S++)L[S].start+=c;u.fragmentHint&&(u.fragmentHint.start+=c)}}function d(u,c){var L=1e3*u.levelTargetDuration,S=L/2,T=u.age,R=T>0&&T<L*3,C=c.loading.end-c.loading.start,w,x=u.availabilityDelay;if(u.updated===!1)if(R){var _=333*u.misses;w=Math.max(Math.min(S,C*2),_),u.availabilityDelay=(u.availabilityDelay||0)+w}else w=S;else R?(x=Math.min(x||L/2,T),u.availabilityDelay=x,w=x+L-T):w=L-C;return Math.round(w)}function l(u,c,L){if(!u||!u.details)return null;var S=u.details,T=S.fragments[c-S.startSN];return T||(T=S.fragmentHint,T&&T.sn===c?T:c<S.startSN&&L&&L.sn===c?L:null)}function a(u,c,L){if(!u||!u.details)return null;var S=u.details.partList;if(S)for(var T=S.length;T--;){var R=S[T];if(R.index===L&&R.fragment.sn===c)return R}return null}},"./src/controller/stream-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return S});var Q=P("./src/polyfills/number.ts"),H=P("./src/controller/base-stream-controller.ts"),F=P("./src/is-supported.ts"),z=P("./src/events.ts"),W=P("./src/utils/buffer-helper.ts"),M=P("./src/controller/fragment-tracker.ts"),O=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/transmuxer-interface.ts"),f=P("./src/types/transmuxer.ts"),h=P("./src/controller/gap-controller.ts"),n=P("./src/errors.ts"),d=P("./src/utils/logger.ts");function l(T,R){for(var C=0;C<R.length;C++){var w=R[C];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(T,w.key,w)}}function a(T,R,C){return R&&l(T.prototype,R),C&&l(T,C),T}function u(T,R){T.prototype=Object.create(R.prototype),T.prototype.constructor=T,c(T,R)}function c(T,R){return c=Object.setPrototypeOf||function(w,x){return w.__proto__=x,w},c(T,R)}var L=100,S=function(T){u(R,T);function R(w,x){var _;return _=T.call(this,w,x,"[stream-controller]")||this,_.audioCodecSwap=!1,_.gapController=null,_.level=-1,_._forceStartLoad=!1,_.altAudio=!1,_.audioOnly=!1,_.fragPlaying=null,_.onvplaying=null,_.onvseeked=null,_.fragLastKbps=0,_.stalled=!1,_.couldBacktrack=!1,_.audioCodecSwitch=!1,_.videoBuffer=null,_._registerListeners(),_}var C=R.prototype;return C._registerListeners=function(){var x=this.hls;x.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),x.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.on(z.Events.ERROR,this.onError,this),x.on(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.on(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this),x.on(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.on(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var x=this.hls;x.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.off(z.Events.ERROR,this.onError,this),x.off(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.off(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),x.off(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.off(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(x){if(this.levels){var _=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=o.startLevel;b===-1&&(o.config.testBandwidth?(b=0,this.bitrateTest=!0):b=o.nextAutoLevel),this.level=o.nextLoadLevel=b,this.loadedmetadata=!1}_>0&&x===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),x=_),this.state=H.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=x,this.tick()}else this._forceStartLoad=!0,this.state=H.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_LEVEL:{var x,_=this.levels,o=this.level,b=_==null||((x=_[o])===null||x===void 0)?void 0:x.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=H.State.IDLE;break}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=H.State.IDLE)}break;default:break}this.onTickEnd()},C.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var x,_,o=this.hls,b=this.levelLastLoaded,m=this.levels,E=this.media,N=o.config,D=o.nextLoadLevel;if(b===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[D])return;var B=m[D];this.level=o.nextLoadLevel=D;var j=B.details;if(!j||this.state===H.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==D){this.state=H.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,O.PlaylistLevelType.MAIN);if(I===null)return;var v=I.len,G=this.getMaxBufferLength(B.maxBitrate);if(v>=G)return;if(this._streamEnded(I,j)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,Y),this.state=H.State.ENDED;return}var re=I.end,oe=this.getNextFragment(re,j);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var we=oe.sn-j.startSN;we>1&&(oe=j.fragments[we-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===M.FragmentState.OK&&this.nextLoadPosition>re){var pe=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,pe,O.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,j)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((x=oe.decryptdata)===null||x===void 0?void 0:x.keyFormat)==="identity"&&!((_=oe.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(oe,j):this.loadFragment(oe,j,re)},C.loadFragment=function(x,_,o){var b,m=this.fragmentTracker.getState(x);if(this.fragCurrent=x,m===M.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(x);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?x.sn==="initSegment"?this._loadInitSegment(x):this.bitrateTest?(x.bitrateTest=!0,this.log("Fragment "+x.sn+" of level "+x.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(x)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,x,_,o)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(x.duration)&&this.fragmentTracker.removeFragment(x):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(x){var _=this.fragmentTracker.getAppendedFrag(x,O.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},C.getBufferedFrag=function(x){return this.fragmentTracker.getBufferedFrag(x,O.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(x){return x?this.getBufferedFrag(x.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var x=this.levels,_=this.media;if(_!=null&&_.readyState){var o,b=this.getAppendedFrag(_.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!_.paused&&x){var m=this.hls.nextLoadLevel,E=x[m],N=this.fragLastKbps;N&&this.fragCurrent?o=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:o=0}else o=0;var D=this.getBufferedFrag(_.currentTime+o);if(D){var B=this.followingBufferedFrag(D);if(B){this.abortCurrentFrag();var j=B.maxStartPTS?B.maxStartPTS:B.start,I=B.duration,v=Math.max(D.end,j+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var x=this.fragCurrent;this.fragCurrent=null,x!=null&&x.loader&&x.loader.abort(),this.state===H.State.KEY_LOADING&&(this.state=H.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(x,_){T.prototype.flushMainBuffer.call(this,x,_,this.altAudio?"video":null)},C.onMediaAttached=function(x,_){T.prototype.onMediaAttached.call(this,x,_);var o=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,o,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var x=this.media;x&&(x.removeEventListener("playing",this.onvplaying),x.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var x=this.media,_=x?x.currentTime:null;Object(Q.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},C.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},C.onManifestParsed=function(x,_){var o=!1,b=!1,m;_.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(o=!0),m.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=o&&b&&!Object(F.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=_.levels,this.startFragRequested=!1},C.onLevelLoading=function(x,_){var o=this.levels;if(!o||this.state!==H.State.IDLE)return;var b=o[_.level];(!b.details||b.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(b.details))&&(this.state=H.State.WAITING_LEVEL)},C.onLevelLoaded=function(x,_){var o,b=this.levels,m=_.level,E=_.details,N=E.totalduration;if(!b){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var D=this.fragCurrent;D&&(this.state===H.State.FRAG_LOADING||this.state===H.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==_.level&&D.loader&&(this.state=H.State.IDLE,D.loader.abort()));var B=b[m],j=0;if(E.live||(o=B.details)!==null&&o!==void 0&&o.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;j=this.alignPlaylists(E,B.details)}if(B.details=E,this.levelLastLoaded=m,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===H.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=H.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,j),this.tick()},C._handleFragmentLoadProgress=function(x){var _,o=x.frag,b=x.part,m=x.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var N=E[o.level],D=N.details;if(!D){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=N.videoCodec,j=D.PTSKnown||!D.live,I=(_=o.initSegment)===null||_===void 0?void 0:_.data,v=this._getAudioCodec(N),G=this.transmuxer=this.transmuxer||new p.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=b?b.index:-1,re=Y!==-1,oe=new f.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,m.byteLength,Y,re),we=this.initPTS[o.cc];G.push(m,I,v,B,o,b,D.totalduration,j,oe,we)},C.onAudioTrackSwitching=function(x,_){var o=this.altAudio,b=!!_.url,m=_.id;if(!b){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;o&&N.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:m})}},C.onAudioTrackSwitched=function(x,_){var o=_.id,b=!!this.hls.audioTracks[o].url;if(b){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=b,this.tick()},C.onBufferCreated=function(x,_){var o=_.tracks,b,m,E=!1;for(var N in o){var D=o[N];if(D.id==="main"){if(m=N,b=D,N==="video"){var B=o[N];B&&(this.videoBuffer=B.buffer)}}else E=!0}E&&b?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(x,_){var o=_.frag,b=_.part;if(o&&o.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(b?" p: "+b.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===H.State.PARSED&&(this.state=H.State.IDLE);return}var m=b?b.stats:o.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,b)},C.onError=function(x,_){switch(_.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,_);break;case n.ErrorDetails.LEVEL_LOAD_ERROR:case n.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==H.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=H.State.ERROR):!_.levelRetry&&this.state===H.State.WAITING_LEVEL&&(this.state=H.State.IDLE));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var o=!0,b=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);b&&b.len>.5&&(o=!this.reduceMaxBufferLength(b.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var x=this.media,_=this.gapController;if(!x||!_||!x.readyState)return;var o=W.BufferHelper.getBuffered(x);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=x.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=H.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(x,_){var o=_.type;if(o!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(o===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,o,O.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(x,_){this.levels=_.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var x=this.media,_=x.currentTime,o=this.startPosition;if(o>=0&&_<o){if(x.seeking){d.logger.log("could not seek to "+o+", already seeking at "+_);return}var b=W.BufferHelper.getBuffered(x),m=b.length?b.start(0):0,E=m-o;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(d.logger.log("adjusting start position by "+E+" to match buffer start"),o+=E,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+_),x.currentTime=o}},C._getAudioCodec=function(x){var _=this.config.defaultAudioCodec||x.audioCodec;return this.audioCodecSwap&&_&&(this.log("Swapping audio codec"),_.indexOf("mp4a.40.5")!==-1?_="mp4a.40.2":_="mp4a.40.5"),_},C._loadBitrateTestFrag=function(x){var _=this;this._doFragLoad(x).then(function(o){var b=_.hls;if(!o||b.nextLoadLevel||_.fragContextChanged(x))return;_.fragLoadError=0,_.state=H.State.IDLE,_.startFragRequested=!1,_.bitrateTest=!1;var m=x.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),b.trigger(z.Events.FRAG_LOADED,o)})},C._handleTransmuxComplete=function(x){var _,o="main",b=this.hls,m=x.remuxResult,E=x.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 D=N.frag,B=N.part,j=N.level,I=m.video,v=m.text,G=m.id3,Y=m.initSegment,re=this.altAudio?void 0:m.audio;if(this.fragContextChanged(D))return;if(this.state=H.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(j,Y.tracks,D,E),b.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:D,id:o,tracks:Y.tracks}));var oe=Y.initPTS,we=Y.timescale;Object(Q.isFiniteNumber)(oe)&&(this.initPTS[D.cc]=oe,b.trigger(z.Events.INIT_PTS_FOUND,{frag:D,id:o,initPTS:oe,timescale:we}))}if(I&&m.independent!==!1){if(j.details){var pe=I.startPTS,xe=I.endPTS,_e=I.startDTS,Se=I.endDTS;if(B)B.elementaryStreams[I.type]={startPTS:pe,endPTS:xe,startDTS:_e,endDTS:Se};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<pe){this.backtrack(D);return}D.setElementaryStreamInfo(I.type,D.start,xe,D.start,Se,!0)}D.setElementaryStreamInfo(I.type,pe,xe,_e,Se),this.bufferFragmentData(I,D,B,E)}}else if(m.independent===!1){this.backtrack(D);return}if(re){var ue=re.startPTS,ie=re.endPTS,de=re.startDTS,se=re.endDTS;B&&(B.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:ie,startDTS:de,endDTS:se}),D.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ue,ie,de,se),this.bufferFragmentData(re,D,B,E)}if(G!=null&&(_=G.samples)!==null&&_!==void 0&&_.length){var Oe={frag:D,id:o,samples:G.samples};b.trigger(z.Events.FRAG_PARSING_METADATA,Oe)}if(v){var ke={frag:D,id:o,samples:v.samples};b.trigger(z.Events.FRAG_PARSING_USERDATA,ke)}},C._bufferInitSegment=function(x,_,o,b){var m=this;if(this.state!==H.State.PARSING)return;this.audioOnly=!!_.audio&&!_.video,this.altAudio&&!this.audioOnly&&delete _.audio;var E=_.audio,N=_.video,D=_.audiovideo;if(E){var B=x.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),E.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(B="mp4a.40.5")),j.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),x.audioCodec&&x.audioCodec!==B&&this.log('Swapping manifest audio codec "'+x.audioCodec+'" for "'+B+'"'),E.levelCodec=B,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(x.audioCodec||"")+"/"+E.codec+"]")}N&&(N.levelCodec=x.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(x.videoCodec||"")+"/"+N.codec+"]")),D&&this.log("Init audiovideo buffer, container:"+D.container+", codecs[level/parsed]=["+(x.attrs.CODECS||"")+"/"+D.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,_),Object.keys(_).forEach(function(I){var v=_[I],G=v.initSegment;G!=null&&G.byteLength&&m.hls.trigger(z.Events.BUFFER_APPENDING,{type:I,data:G,frag:o,part:null,chunkMeta:b,parent:o.type})}),this.tick()},C.backtrack=function(x){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(x);var _=this.fragmentTracker.backtrack(x);this.fragPrevious=null,this.nextLoadPosition=x.start,_?this.resetFragmentLoading(x):this.state=H.State.BACKTRACKING},C.checkFragmentChanged=function(){var x=this.media,_=null;if(x&&x.readyState>1&&x.seeking===!1){var o=x.currentTime;if(W.BufferHelper.isBuffered(x,o)?_=this.getAppendedFrag(o):W.BufferHelper.isBuffered(x,o+.1)&&(_=this.getAppendedFrag(o+.1)),_){var b=this.fragPlaying,m=_.level;(!b||_.sn!==b.sn||b.level!==m||_.urlId!==b.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:_}),(!b||b.level!==m)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},a(R,[{key:"nextLevel",get:function(){var x=this.nextBufferedFrag;return x?x.level:-1}},{key:"currentLevel",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(H.default)},"./src/controller/subtitle-stream-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"SubtitleStreamController",function(){return u});var Q=P("./src/events.ts"),H=P("./src/utils/logger.ts"),F=P("./src/utils/buffer-helper.ts"),z=P("./src/controller/fragment-finders.ts"),W=P("./src/utils/discontinuities.ts"),M=P("./src/controller/level-helper.ts"),O=P("./src/controller/fragment-tracker.ts"),g=P("./src/controller/base-stream-controller.ts"),p=P("./src/types/loader.ts"),f=P("./src/types/level.ts");function h(c,L){for(var S=0;S<L.length;S++){var T=L[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(c,T.key,T)}}function n(c,L,S){return L&&h(c.prototype,L),S&&h(c,S),c}function d(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,l(c,L)}function l(c,L){return l=Object.setPrototypeOf||function(T,R){return T.__proto__=R,T},l(c,L)}var a=500,u=function(c){d(L,c);function L(T,R){var C;return C=c.call(this,T,R,"[subtitle-stream-controller]")||this,C.levels=[],C.currentTrackId=-1,C.tracksBuffered=[],C.mainDetails=null,C._registerListeners(),C}var S=L.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var R=this.hls;R.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on(Q.Events.ERROR,this.onError,this),R.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var R=this.hls;R.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off(Q.Events.ERROR,this.onError,this),R.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},S.onLevelLoaded=function(R,C){this.mainDetails=C.details},S.onSubtitleFragProcessed=function(R,C){var w=C.frag,x=C.success;if(this.fragPrevious=w,this.state=g.State.IDLE,!x)return;var _=this.tracksBuffered[this.currentTrackId];if(!_)return;for(var o,b=w.start,m=0;m<_.length;m++)if(b>=_[m].start&&b<=_[m].end){o=_[m];break}var E=w.start+w.duration;o?o.end=E:(o={start:b,end:E},_.push(o)),this.fragmentTracker.fragBuffered(w)},S.onBufferFlushing=function(R,C){var w=C.startOffset,x=C.endOffset;if(w===0&&x!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,o=this.levels;if(!o.length||!o[_]||!o[_].details)return;var b=o[_].details,m=b.targetduration,E=x-m;if(E<=0)return;C.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var D=0;D<N.length;){if(N[D].end<=E){N.shift();continue}else if(N[D].start<E)N[D].start=E;else break;D++}}),this.fragmentTracker.removeFragmentsInRange(w,E,p.PlaylistLevelType.SUBTITLE)}},S.onError=function(R,C){var w,x=C.frag;if(!x||x.type!==p.PlaylistLevelType.SUBTITLE)return;(w=this.fragCurrent)!==null&&w!==void 0&&w.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},S.onSubtitleTracksUpdated=function(R,C){var w=this,x=C.subtitleTracks;this.tracksBuffered=[],this.levels=x.map(function(_){return new f.Level(_)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(_){w.tracksBuffered[_.id]=[]}),this.mediaBuffer=null},S.onSubtitleTrackSwitch=function(R,C){if(this.currentTrackId=C.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var w=this.levels[this.currentTrackId];w!=null&&w.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,w&&this.setInterval(a)},S.onSubtitleTrackLoaded=function(R,C){var w,x=C.details,_=C.id,o=this.currentTrackId,b=this.levels;if(!b.length)return;var m=b[o];if(_>=b.length||_!==o||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,x.live||(w=m.details)!==null&&w!==void 0&&w.live){var E=this.mainDetails;if(x.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!m.details)x.hasProgramDateTime&&E.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(x,E):N&&Object(M.addSliding)(x,N.start);else{var D=this.alignPlaylists(x,m.details);D===0&&N&&Object(M.addSliding)(x,N.start)}}if(m.details=x,this.levelLastLoaded=_,this.tick(),x.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var B=Object(z.findFragmentByPTS)(null,x.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},S._handleFragmentLoadComplete=function(R){var C=R.frag,w=R.payload,x=C.decryptdata,_=this.hls;if(this.fragContextChanged(C))return;if(w&&w.byteLength>0&&x&&x.key&&x.iv&&x.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(w),x.key.buffer,x.iv.buffer).then(function(b){var m=performance.now();_.trigger(Q.Events.FRAG_DECRYPTED,{frag:C,payload:b,stats:{tstart:o,tdecrypt:m}})})}},S.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var R,C=this.currentTrackId,w=this.levels;if(!w.length||!w[C]||!w[C].details)return;var x=w[C].details,_=x.targetduration,o=this.config,b=this.media,m=F.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-_,o.maxBufferHole),E=m.end,N=m.len,D=this.getMaxBufferLength()+_;if(N>D)return;console.assert(x,"Subtitle track details are defined on idle subtitle stream controller tick");var B=x.fragments,j=B.length,I=x.edge,v,G=this.fragPrevious;if(E<I){var Y=o.maxFragLookUpTolerance;G&&x.hasProgramDateTime&&(v=Object(z.findFragmentByPDT)(B,G.endProgramDateTime,Y)),v||(v=Object(z.findFragmentByPTS)(G,B,E,Y),!v&&G&&G.start<B[0].start&&(v=B[0]))}else v=B[j-1];(R=v)!==null&&R!==void 0&&R.encrypted?(H.logger.log("Loading key for "+v.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:v})):v&&this.fragmentTracker.getState(v)===O.FragmentState.NOT_LOADED&&this.loadFragment(v,x,E)}},S.loadFragment=function(R,C,w){this.fragCurrent=R,c.prototype.loadFragment.call(this,R,C,w)},n(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(g.default)},"./src/controller/subtitle-track-controller.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/events.ts"),H=P("./src/utils/texttrack-utils.ts"),F=P("./src/controller/base-playlist-controller.ts"),z=P("./src/types/loader.ts");function W(h,n){for(var d=0;d<n.length;d++){var l=n[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function M(h,n,d){return n&&W(h.prototype,n),d&&W(h,d),h}function O(h,n){h.prototype=Object.create(n.prototype),h.prototype.constructor=h,g(h,n)}function g(h,n){return g=Object.setPrototypeOf||function(l,a){return l.__proto__=a,l},g(h,n)}var p=function(h){O(n,h);function n(l){var a;return a=h.call(this,l,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var d=n.prototype;return d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,h.prototype.destroy.call(this)},d.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Q.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Q.Events.ERROR,this.onError,this)},d.onMediaAttached=function(a,u){if(this.media=u.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)},d.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},d.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=f(this.media.textTracks);a.forEach(function(u){Object(H.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(a,u){this.tracks=u.subtitleTracks},d.onSubtitleTrackLoaded=function(a,u){var c=u.id,L=u.details,S=this.trackId,T=this.tracksInGroup[S];if(!T){this.warn("Invalid subtitle track id "+c);return}var R=T.details;T.details=u.details,this.log("subtitle track "+c+" loaded ["+L.startSN+"-"+L.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,u,R))},d.onLevelLoading=function(a,u){this.switchLevel(u.level)},d.onLevelSwitching=function(a,u){this.switchLevel(u.level)},d.switchLevel=function(a){var u=this.hls.levels[a];if(!(u!=null&&u.textGroupIds))return;var c=u.textGroupIds[u.urlId];if(this.groupId!==c){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(C){return!c||C.groupId===c});this.tracksInGroup=S;var T=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=c;var R={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,R),T!==-1&&this.setSubtitleTrack(T,L)}},d.findTrackId=function(a){for(var u=this.tracksInGroup,c=0;c<u.length;c++){var L=u[c];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},d.onError=function(a,u){if(h.prototype.onError.call(this,a,u),u.fatal||!u.context)return;u.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},d.loadPlaylist=function(a){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var c=u.id,L=u.groupId,S=u.url;if(a)try{S=a.addDirectives(S)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:S,id:c,groupId:L,deliveryDirectives:a||null})}},d.toggleTrackModes=function(a){var u=this,c=this.media,L=this.subtitleDisplay,S=this.trackId;if(!c)return;var T=f(c.textTracks),R=T.filter(function(x){return x.groupId===u.groupId});if(a===-1)[].slice.call(T).forEach(function(x){x.mode="disabled"});else{var C=R[S];C&&(C.mode="disabled")}var w=R[a];w&&(w.mode=L?"showing":"hidden")},d.setSubtitleTrack=function(a,u){var c,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(c=L[a])!==null&&c!==void 0&&c.details)||a<-1||a>=L.length)return;this.clearTimer();var S=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,S){var T=S.id,R=S.groupId,C=R===void 0?"":R,w=S.name,x=S.type,_=S.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:C,name:w,type:x,url:_});var o=this.switchParams(S.url,u==null?void 0:u.details);this.loadPlaylist(o)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,u=f(this.media.textTracks),c=0;c<u.length;c++)if(u[c].mode==="hidden")a=c;else if(u[c].mode==="showing"){a=c;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},M(n,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,u)}}]),n}(F.default);function f(h){for(var n=[],d=0;d<h.length;d++){var l=h[d];l.kind==="subtitles"&&l.label&&n.push(h[d])}return n}J.default=p},"./src/controller/timeline-controller.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"TimelineController",function(){return f});var Q=P("./src/polyfills/number.ts"),H=P("./src/events.ts"),F=P("./src/utils/cea-608-parser.ts"),z=P("./src/utils/output-filter.ts"),W=P("./src/utils/webvtt-parser.ts"),M=P("./src/utils/texttrack-utils.ts"),O=P("./src/utils/imsc1-ttml-parser.ts"),g=P("./src/types/loader.ts"),p=P("./src/utils/logger.ts"),f=function(){function l(u){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=d(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 c=new z.default(this,"textTrack1"),L=new z.default(this,"textTrack2"),S=new z.default(this,"textTrack3"),T=new z.default(this,"textTrack4");this.cea608Parser1=new F.default(1,c,L),this.cea608Parser2=new F.default(3,S,T)}u.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(H.Events.FRAG_LOADING,this.onFragLoading,this),u.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=l.prototype;return a.destroy=function(){var c=this.hls;c.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(H.Events.FRAG_LOADING,this.onFragLoading,this),c.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(c,L,S,T,R){for(var C=!1,w=R.length;w--;){var x=R[w],_=n(x[0],x[1],L,S);if(_>=0&&(x[0]=Math.min(x[0],L),x[1]=Math.max(x[1],S),C=!0,_/(S-L)>.5))return}if(C||R.push([L,S]),this.config.renderTextTracksNatively){var o=this.captionsTracks[c];this.Cues.newCue(o,L,S,T)}else{var b=this.Cues.newCue(null,L,S,T);this.hls.trigger(H.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},a.onInitPtsFound=function(c,L){var S=this,T=L.frag,R=L.id,C=L.initPTS,w=L.timescale,x=this.unparsedVttFrags;R==="main"&&(this.initPTS[T.cc]=C,this.timescale[T.cc]=w),x.length&&(this.unparsedVttFrags=[],x.forEach(function(_){S.onFragLoaded(H.Events.FRAG_LOADED,_)}))},a.getExistingTrack=function(c){var L=this.media;if(L)for(var S=0;S<L.textTracks.length;S++){var T=L.textTracks[S];if(T[c])return T}return null},a.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},a.createNativeTrack=function(c){if(this.captionsTracks[c])return;var L=this.captionsProperties,S=this.captionsTracks,T=this.media,R=L[c],C=R.label,w=R.languageCode,x=this.getExistingTrack(c);if(x)S[c]=x,Object(M.clearCurrentCues)(S[c]),Object(M.sendAddTrackEvent)(S[c],T);else{var _=this.createTextTrack("captions",C,w);_&&(_[c]=!0,S[c]=_)}},a.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var L=this.captionsProperties[c];if(!L)return;var S=L.label,T={_id:c,label:S,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[c]=T,this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},a.createTextTrack=function(c,L,S){var T=this.media;return T?T.addTextTrack(c,L,S):void 0},a.onMediaAttaching=function(c,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(L){Object(M.clearCurrentCues)(c[L]),delete c[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var c=this.media;if(!c)return;var L=c.textTracks;if(L)for(var S=0;S<L.length;S++)Object(M.clearCurrentCues)(L[S])},a.onSubtitleTracksUpdated=function(c,L){var S=this;this.textTracks=[];var T=L.subtitleTracks||[],R=T.some(function(_){return _.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var C=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var w=this.media?this.media.textTracks:[];this.tracks.forEach(function(_,o){var b;if(o<w.length){for(var m=null,E=0;E<w.length;E++)if(h(w[E],_)){m=w[E];break}m&&(b=m)}b?Object(M.clearCurrentCues)(b):(b=S.createTextTrack("subtitles",_.name,_.lang),b&&(b.mode="disabled")),b&&(b.groupId=_.groupId,S.textTracks.push(b))})}else if(!C&&this.tracks&&this.tracks.length){var x=this.tracks.map(function(_){return{label:_.name,kind:_.type.toLowerCase(),default:_.default,subtitleTrack:_}});this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:x})}}},a.onManifestLoaded=function(c,L){var S=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(T){var R=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!R)return;var C="textTrack"+R[1],w=S.captionsProperties[C];if(!w)return;w.label=T.name,T.lang&&(w.languageCode=T.lang),w.media=T})},a.onFragLoading=function(c,L){var S=this.cea608Parser1,T=this.cea608Parser2,R=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(S&&T))return;if(L.frag.type===g.PlaylistLevelType.MAIN){var w,x,_=L.frag.sn,o=(w=L==null||((x=L.part)===null||x===void 0)?void 0:x.index)!=null?w:-1;_===R+1||_===R&&o===C+1||(S.reset(),T.reset()),this.lastSn=_,this.lastPartIndex=o}},a.onFragLoaded=function(c,L){var S=L.frag,T=L.payload,R=this.initPTS,C=this.unparsedVttFrags;if(S.type===g.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(Q.isFiniteNumber)(R[S.cc])){C.push(L),R.length&&this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Missing initial subtitle PTS")});return}var w=S.decryptdata;if(w==null||w.key==null||w.method!=="AES-128"){var x=this.tracks[S.level],_=this.vttCCs;_[S.cc]||(_[S.cc]={start:S.start,prevCC:this.prevCC,new:!0},this.prevCC=S.cc),x&&x.textCodec===O.IMSC1_CODEC?this._parseIMSC1(S,T):this._parseVTTs(S,T,_)}}else this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(c,L){var S=this,T=this.hls;Object(O.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(R){S._appendCues(R,c.level),T.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(R){p.logger.log("Failed to parse IMSC1: "+R),T.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:R})})},a._parseVTTs=function(c,L,S){var T=this,R=this.hls;Object(W.parseWebVTT)(L,this.initPTS[c.cc],this.timescale[c.cc],S,c.cc,c.start,function(C){T._appendCues(C,c.level),R.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(C){T._fallbackToIMSC1(c,L),p.logger.log("Failed to parse VTT cue: "+C),R.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:C})})},a._fallbackToIMSC1=function(c,L){var S=this,T=this.tracks[c.level];T.textCodec||Object(O.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(){T.textCodec=O.IMSC1_CODEC,S._parseIMSC1(c,L)},function(){T.textCodec="wvtt"})},a._appendCues=function(c,L){var S=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[L];if(T.mode==="disabled")return;c.forEach(function(w){return Object(M.addCueToTrack)(T,w)})}else{var R=this.tracks[L],C=R.default?"default":"subtitles"+L;S.trigger(H.Events.CUES_PARSED,{type:"subtitles",cues:c,track:C})}},a.onFragDecrypted=function(c,L){var S=L.frag;if(S.type===g.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[S.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(H.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(c,L){var S=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(S&&T))return;for(var R=0;R<L.samples.length;R++){var C=L.samples[R].bytes;if(C){var w=this.extractCea608Data(C);S.addData(L.samples[R].pts,w[0]),T.addData(L.samples[R].pts,w[1])}}},a.onBufferFlushing=function(c,L){var S=L.startOffset,T=L.endOffset,R=L.endOffsetSubtitles,C=L.type,w=this.media;if(!w||w.currentTime<T)return;if(!C||C==="video"){var x=this.captionsTracks;Object.keys(x).forEach(function(o){return Object(M.removeCuesInRange)(x[o],S,T)})}if(this.config.renderTextTracksNatively&&(S===0&&R!==void 0)){var _=this.textTracks;Object.keys(_).forEach(function(o){return Object(M.removeCuesInRange)(_[o],S,R)})}},a.extractCea608Data=function(c){for(var L=c[0]&31,S=2,T=[[],[]],R=0;R<L;R++){var C=c[S++],w=127&c[S++],x=127&c[S++],_=(4&C)!==0,o=3&C;if(w===0&&x===0)continue;_&&((o===0||o===1)&&(T[o].push(w),T[o].push(x)))}return T},l}();function h(l,a){return l&&l.label===a.name&&!(l.textTrack1||l.textTrack2)}function n(l,a,u,c){return Math.min(a,c)-Math.max(l,u)}function d(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return Q});var Q=function(){function H(z,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=W}var F=H.prototype;return F.decrypt=function(W,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,W)},H}()},"./src/crypt/aes-decryptor.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"removePadding",function(){return H}),P.d(J,"default",function(){return F});var Q=P("./src/utils/typed-array.ts");function H(z){var W=z.byteLength,M=W&&new DataView(z.buffer).getUint8(W-1);return M?Object(Q.sliceUint8)(z,0,W-M):z}var F=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 W=z.prototype;return W.uint8ArrayToUint32Array_=function(O){for(var g=new DataView(O),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},W.initTable=function(){var O=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],h=p[1],n=p[2],d=p[3],l=this.invSubMix,a=l[0],u=l[1],c=l[2],L=l[3],S=new Uint32Array(256),T=0,R=0,C=0;for(C=0;C<256;C++)C<128?S[C]=C<<1:S[C]=C<<1^283;for(C=0;C<256;C++){var w=R^R<<1^R<<2^R<<3^R<<4;w=w>>>8^w&255^99,O[T]=w,g[w]=T;var x=S[T],_=S[x],o=S[_],b=S[w]*257^w*16843008;f[T]=b<<24|b>>>8,h[T]=b<<16|b>>>16,n[T]=b<<8|b>>>24,d[T]=b,b=o*16843009^_*65537^x*257^T*16843008,a[w]=b<<24|b>>>8,u[w]=b<<16|b>>>16,c[w]=b<<8|b>>>24,L[w]=b,T?(T=x^S[S[S[o^x]]],R^=S[S[R]]):T=R=1}},W.expandKey=function(O){for(var g=this.uint8ArrayToUint32Array_(O),p=!0,f=0;f<g.length&&p;)p=g[f]===this.key[f],f++;if(p)return;this.key=g;var h=this.keySize=g.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);var n=this.ksRows=(h+6+1)*4,d,l,a=this.keySchedule=new Uint32Array(n),u=this.invKeySchedule=new Uint32Array(n),c=this.sBox,L=this.rcon,S=this.invSubMix,T=S[0],R=S[1],C=S[2],w=S[3],x,_;for(d=0;d<n;d++){if(d<h){x=a[d]=g[d];continue}_=x,d%h===0?(_=_<<8|_>>>24,_=c[_>>>24]<<24|c[_>>>16&255]<<16|c[_>>>8&255]<<8|c[_&255],_^=L[d/h|0]<<24):h>6&&d%h===4&&(_=c[_>>>24]<<24|c[_>>>16&255]<<16|c[_>>>8&255]<<8|c[_&255]),a[d]=x=(a[d-h]^_)>>>0}for(l=0;l<n;l++)d=n-l,l&3?_=a[d]:_=a[d-4],l<4||d<=4?u[l]=_:u[l]=T[c[_>>>24]]^R[c[_>>>16&255]]^C[c[_>>>8&255]]^w[c[_&255]],u[l]=u[l]>>>0},W.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},W.decrypt=function(O,g,p){for(var f=this.keySize+6,h=this.invKeySchedule,n=this.invSBox,d=this.invSubMix,l=d[0],a=d[1],u=d[2],c=d[3],L=this.uint8ArrayToUint32Array_(p),S=L[0],T=L[1],R=L[2],C=L[3],w=new Int32Array(O),x=new Int32Array(w.length),_,o,b,m,E,N,D,B,j,I,v,G,Y,re,oe=this.networkToHostOrderSwap;g<w.length;){for(j=oe(w[g]),I=oe(w[g+1]),v=oe(w[g+2]),G=oe(w[g+3]),E=j^h[0],N=G^h[1],D=v^h[2],B=I^h[3],Y=4,re=1;re<f;re++)_=l[E>>>24]^a[N>>16&255]^u[D>>8&255]^c[B&255]^h[Y],o=l[N>>>24]^a[D>>16&255]^u[B>>8&255]^c[E&255]^h[Y+1],b=l[D>>>24]^a[B>>16&255]^u[E>>8&255]^c[N&255]^h[Y+2],m=l[B>>>24]^a[E>>16&255]^u[N>>8&255]^c[D&255]^h[Y+3],E=_,N=o,D=b,B=m,Y=Y+4;_=n[E>>>24]<<24^n[N>>16&255]<<16^n[D>>8&255]<<8^n[B&255]^h[Y],o=n[N>>>24]<<24^n[D>>16&255]<<16^n[B>>8&255]<<8^n[E&255]^h[Y+1],b=n[D>>>24]<<24^n[B>>16&255]<<16^n[E>>8&255]<<8^n[N&255]^h[Y+2],m=n[B>>>24]<<24^n[E>>16&255]<<16^n[N>>8&255]<<8^n[D&255]^h[Y+3],x[g]=oe(_^S),x[g+1]=oe(m^T),x[g+2]=oe(b^R),x[g+3]=oe(o^C),S=j,T=I,R=v,C=G,g=g+4}return x.buffer},z}()},"./src/crypt/decrypter.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return g});var Q=P("./src/crypt/aes-crypto.ts"),H=P("./src/crypt/fast-aes-key.ts"),F=P("./src/crypt/aes-decryptor.ts"),z=P("./src/utils/logger.ts"),W=P("./src/utils/mp4-tools.ts"),M=P("./src/utils/typed-array.ts"),O=16,g=function(){function p(h,n,d){var l=d===void 0?{}:d,a=l.removePKCS7Padding,u=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=h,this.config=n,this.removePKCS7Padding=u,u)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=p.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var n=this.currentResult;if(!n){this.reset();return}var d=new Uint8Array(n);return this.reset(),this.removePKCS7Padding?Object(F.removePadding)(d):d},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(n,d,l,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(n),d,l);var u=this.flush();u&&a(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(n),d,l).then(a)},f.softwareDecrypt=function(n,d,l){var a=this.currentIV,u=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(n=Object(W.appendUint8Array)(c,n),this.remainderData=null);var L=this.getValidChunk(n);if(!L.length)return null;a&&(l=a);var S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new F.default),S.expandKey(d);var T=u;return this.currentResult=S.decrypt(L.buffer,0,l),this.currentIV=Object(M.sliceUint8)(L,-16).buffer,T||null},f.webCryptoDecrypt=function(n,d,l){var a=this,u=this.subtle;return(this.key!==d||!this.fastAesKey)&&(this.key=d,this.fastAesKey=new H.default(u,d)),this.fastAesKey.expandKey().then(function(c){if(!u)return Promise.reject(new Error("web crypto not initialized"));var L=new Q.default(u,l);return L.decrypt(n.buffer,c)}).catch(function(c){return a.onWebCryptoError(c,n,d,l)})},f.onWebCryptoError=function(n,d,l,a){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",n),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(d,l,a)},f.getValidChunk=function(n){var d=n,l=n.length-n.length%O;return l!==n.length&&(d=Object(M.sliceUint8)(n,0,l),this.remainderData=Object(M.sliceUint8)(n,l)),d},f.logOnce=function(n){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+n),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return Q});var Q=function(){function H(z,W){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=W}var F=H.prototype;return F.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},H}()},"./src/demux/aacdemuxer.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/demux/base-audio-demuxer.ts"),H=P("./src/demux/adts.ts"),F=P("./src/utils/logger.ts"),z=P("./src/demux/id3.ts");function W(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(h,n){return h.__proto__=n,h},M(g,p)}var O=function(g){W(p,g);function p(h,n){var d;return d=g.call(this)||this,d.observer=void 0,d.config=void 0,d.observer=h,d.config=n,d}var f=p.prototype;return f.resetInitSegment=function(n,d,l){g.prototype.resetInitSegment.call(this,n,d,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:n,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var d=z.getID3Data(n,0)||[],l=d.length,a=n.length;l<a;l++)if(H.probe(n,l))return F.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(n,d){return H.canParse(n,d)},f.appendFrame=function(n,d,l){H.initTrackConfig(n,this.observer,d,l,n.manifestCodec);var a=H.appendFrame(n,d,l,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(Q.default);O.minProbeByteLength=9,J.default=O},"./src/demux/adts.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"getAudioConfig",function(){return z}),P.d(J,"isHeaderPattern",function(){return W}),P.d(J,"getHeaderLength",function(){return M}),P.d(J,"getFullFrameLength",function(){return O}),P.d(J,"canGetFrameLength",function(){return g}),P.d(J,"isHeader",function(){return p}),P.d(J,"canParse",function(){return f}),P.d(J,"probe",function(){return h}),P.d(J,"initTrackConfig",function(){return n}),P.d(J,"getFrameDuration",function(){return d}),P.d(J,"parseFrameHeader",function(){return l}),P.d(J,"appendFrame",function(){return a});var Q=P("./src/utils/logger.ts"),H=P("./src/errors.ts"),F=P("./src/events.ts");function z(u,c,L,S){var T,R,C,w,x=navigator.userAgent.toLowerCase(),_=S,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((c[L+2]&192)>>>6)+1;var b=(c[L+2]&60)>>>2;if(b>o.length-1){u.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return C=(c[L+2]&1)<<2,C|=(c[L+3]&192)>>>6,Q.logger.log("manifest codec:"+S+", ADTS type:"+T+", samplingIndex:"+b),/firefox/i.test(x)?b>=6?(T=5,w=new Array(4),R=b-3):(T=2,w=new Array(2),R=b):x.indexOf("android")!==-1?(T=2,w=new Array(2),R=b):(T=5,w=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&b>=6?R=b-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(b>=6&&C===1||/vivaldi/i.test(x))||!S&&C===1)&&(T=2,w=new Array(2)),R=b)),w[0]=T<<3,w[0]|=(b&14)>>1,w[1]|=(b&1)<<7,w[1]|=C<<3,T===5&&(w[1]|=(R&14)>>1,w[2]=(R&1)<<7,w[2]|=2<<2,w[3]=0),{config:w,samplerate:o[b],channelCount:C,codec:"mp4a.40."+T,manifestCodec:_}}function W(u,c){return u[c]===255&&(u[c+1]&246)===240}function M(u,c){return u[c+1]&1?7:9}function O(u,c){return(u[c+3]&3)<<11|u[c+4]<<3|(u[c+5]&224)>>>5}function g(u,c){return c+5<u.length}function p(u,c){return c+1<u.length&&W(u,c)}function f(u,c){return g(u,c)&&W(u,c)&&O(u,c)<=u.length-c}function h(u,c){if(p(u,c)){var L=M(u,c);if(c+L>=u.length)return!1;var S=O(u,c);if(S<=L)return!1;var T=c+S;return T===u.length||p(u,T)}return!1}function n(u,c,L,S,T){if(!u.samplerate){var R=z(c,L,S,T);if(!R)return;u.config=R.config,u.samplerate=R.samplerate,u.channelCount=R.channelCount,u.codec=R.codec,u.manifestCodec=R.manifestCodec,Q.logger.log("parsed codec:"+u.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function d(u){return 1024*9e4/u}function l(u,c,L,S,T){var R=M(u,c),C=O(u,c);if(C-=R,C>0){var w=L+S*T;return{headerLength:R,frameLength:C,stamp:w}}}function a(u,c,L,S,T){var R=d(u.samplerate),C=l(c,L,S,T,R);if(C){var w=C.frameLength,x=C.headerLength,_=C.stamp,o=x+w,b=Math.max(0,L+o-c.length),m;b?(m=new Uint8Array(o-x),m.set(c.subarray(L+x,c.length),0)):m=c.subarray(L+x,L+o);var E={unit:m,pts:_};return b||u.samples.push(E),{sample:E,length:o,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"initPTSFn",function(){return O});var Q=P("./src/polyfills/number.ts"),H=P("./src/demux/id3.ts"),F=P("./src/demux/dummy-demuxed-track.ts"),z=P("./src/utils/mp4-tools.ts"),W=P("./src/utils/typed-array.ts"),M=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=g.prototype;return p.resetInitSegment=function(h,n,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(h,n){return!1},p.appendFrame=function(h,n,d){},p.demux=function(h,n){this.cachedData&&(h=Object(z.appendUint8Array)(this.cachedData,h),this.cachedData=null);var d=H.getID3Data(h,0),l=d?d.length:0,a,u,c=this._audioTrack,L=this._id3Track,S=d?H.getTimeStamp(d):void 0,T=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(S,n)),d&&d.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),u=this.initPTS;l<T;){if(this.canParse(h,l)){var R=this.appendFrame(c,h,l);R?(this.frameIndex++,u=R.sample.pts,l+=R.length,a=l):l=T}else H.canParse(h,l)?(d=H.getID3Data(h,l),L.samples.push({pts:u,dts:u,data:d}),l+=d.length,a=l):l++;if(l===T&&a!==T){var C=Object(W.sliceUint8)(h,a);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:c,avcTrack:Object(F.dummyTrack)(),id3Track:L,textTrack:Object(F.dummyTrack)()}},p.demuxSampleAes=function(h,n,d){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(h){var n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(F.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(F.dummyTrack)()}},p.destroy=function(){},g}(),O=function(p,f){return Object(Q.isFiniteNumber)(p)?p*90:f*9e4};J.default=M},"./src/demux/chunk-cache.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return Q});var Q=function(){function F(){this.chunks=[],this.dataLength=0}var z=F.prototype;return z.push=function(M){this.chunks.push(M),this.dataLength+=M.length},z.flush=function(){var M=this.chunks,O=this.dataLength,g;if(M.length)M.length===1?g=M[0]:g=H(M,O);else return new Uint8Array(0);return this.reset(),g},z.reset=function(){this.chunks.length=0,this.dataLength=0},F}();function H(F,z){for(var W=new Uint8Array(z),M=0,O=0;O<F.length;O++){var g=F[O];W.set(g,M),M+=g.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/utils/logger.ts"),H=function(){function F(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var z=F.prototype;return z.loadWord=function(){var M=this.data,O=this.bytesAvailable,g=M.byteLength-O,p=new Uint8Array(4),f=Math.min(4,O);if(f===0)throw new Error("no bytes available");p.set(M.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},z.skipBits=function(M){var O;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,O=M>>3,M-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},z.readBits=function(M){var O=Math.min(this.bitsAvailable,M),g=this.word>>>32-O;return M>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=M-O,O>0&&this.bitsAvailable?g<<O|this.readBits(O):g},z.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},z.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>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(M){for(var O=8,g=8,p,f=0;f<M;f++)g!==0&&(p=this.readEG(),g=(O+p+256)%256),O=g===0?O:g},z.readSPS=function(){var M=0,O=0,g=0,p=0,f,h,n,d=this.readUByte.bind(this),l=this.readBits.bind(this),a=this.readUEG.bind(this),u=this.readBoolean.bind(this),c=this.skipBits.bind(this),L=this.skipEG.bind(this),S=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);d();var R=d();if(l(5),c(3),d(),S(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var C=a();if(C===3&&c(1),S(),S(),c(1),u())for(h=C!==3?8:12,n=0;n<h;n++)u()&&(n<6?T(16):T(64))}S();var w=a();if(w===0)a();else if(w===1)for(c(1),L(),L(),f=a(),n=0;n<f;n++)L();S(),c(1);var x=a(),_=a(),o=l(1);o===0&&c(1),c(1),u()&&(M=a(),O=a(),g=a(),p=a());var b=[1,1];if(u()&&u()){var m=d();switch(m){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((x+1)*16-M*2-O*2),height:(2-o)*(_+1)*16-(o?2:4)*(g+p),pixelRatio:b}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},F}();J.default=H},"./src/demux/id3.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"isHeader",function(){return Q}),P.d(J,"isFooter",function(){return H}),P.d(J,"getID3Data",function(){return F}),P.d(J,"canParse",function(){return W}),P.d(J,"getTimeStamp",function(){return M}),P.d(J,"isTimeStampFrame",function(){return O}),P.d(J,"getID3Frames",function(){return p}),P.d(J,"decodeFrame",function(){return f}),P.d(J,"utf8ArrayToStr",function(){return a}),P.d(J,"testables",function(){return u});var Q=function(T,R){return R+10<=T.length&&(T[R]===73&&T[R+1]===68&&T[R+2]===51&&(T[R+3]<255&&T[R+4]<255&&(T[R+6]<128&&T[R+7]<128&&T[R+8]<128&&T[R+9]<128)))},H=function(T,R){return R+10<=T.length&&(T[R]===51&&T[R+1]===68&&T[R+2]===73&&(T[R+3]<255&&T[R+4]<255&&(T[R+6]<128&&T[R+7]<128&&T[R+8]<128&&T[R+9]<128)))},F=function(T,R){for(var C=R,w=0;Q(T,R);){w+=10;var x=z(T,R+6);w+=x,H(T,R+10)&&(w+=10),R+=w}return w>0?T.subarray(C,C+w):void 0},z=function(T,R){var C=0;return C=(T[R]&127)<<21,C|=(T[R+1]&127)<<14,C|=(T[R+2]&127)<<7,C|=T[R+3]&127,C},W=function(T,R){return Q(T,R)&&z(T,R+6)+10<=T.length-R},M=function(T){for(var R=p(T),C=0;C<R.length;C++){var w=R[C];if(O(w))return l(w)}return},O=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},g=function(T){var R=String.fromCharCode(T[0],T[1],T[2],T[3]),C=z(T,4),w=10;return{type:R,size:C,data:T.subarray(w,w+C)}},p=function(T){for(var R=0,C=[];Q(T,R);){var w=z(T,R+6);R+=10;for(var x=R+w;R+8<x;){var _=g(T.subarray(R)),o=f(_);o&&C.push(o),R+=_.size+10}H(T,R)&&(R+=10)}return C},f=function(T){return T.type==="PRIV"?h(T):T.type[0]==="W"?d(T):n(T)},h=function(T){if(T.size<2)return;var R=a(T.data,!0),C=new Uint8Array(T.data.subarray(R.length+1));return{key:T.type,info:R,data:C.buffer}},n=function(T){if(T.size<2)return;if(T.type==="TXXX"){var R=1,C=a(T.data.subarray(R),!0);R+=C.length+1;var w=a(T.data.subarray(R));return{key:T.type,info:C,data:w}}var x=a(T.data.subarray(1));return{key:T.type,data:x}},d=function(T){if(T.type==="WXXX"){if(T.size<2)return;var R=1,C=a(T.data.subarray(R),!0);R+=C.length+1;var w=a(T.data.subarray(R));return{key:T.type,info:C,data:w}}var x=a(T.data);return{key:T.type,data:x}},l=function(T){if(T.data.byteLength===8){var R=new Uint8Array(T.data),C=R[3]&1,w=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return w/=45,C&&(w+=4772185884e-2),Math.round(w)}return},a=function(T,R){R===void 0&&(R=!1);var C=L();if(C){var w=C.decode(T);if(R){var x=w.indexOf("\0");return x!==-1?w.substring(0,x):w}return w.replace(/\0/g,"")}for(var _=T.length,o,b,m,E="",N=0;N<_;){if(o=T[N++],o===0&&R)return E;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(o);break;case 12:case 13:b=T[N++],E+=String.fromCharCode((o&31)<<6|b&63);break;case 14:b=T[N++],m=T[N++],E+=String.fromCharCode((o&15)<<12|(b&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:n},c;function L(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/demux/base-audio-demuxer.ts"),H=P("./src/demux/id3.ts"),F=P("./src/utils/logger.ts"),z=P("./src/demux/mpegaudio.ts");function W(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(h,n){return h.__proto__=n,h},M(g,p)}var O=function(g){W(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(n,d,l){g.prototype.resetInitSegment.call(this,n,d,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:n,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var d=H.getID3Data(n,0)||[],l=d.length,a=n.length;l<a;l++)if(z.probe(n,l))return F.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(n,d){return z.canParse(n,d)},f.appendFrame=function(n,d,l){return this.initPTS===null?void 0:z.appendFrame(n,d,l,this.initPTS,this.frameIndex)},p}(Q.default);O.minProbeByteLength=4,J.default=O},"./src/demux/mp4demuxer.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/utils/mp4-tools.ts"),H=P("./src/demux/dummy-demuxed-track.ts"),F=function(){function z(M,O){this.remainderData=null,this.config=void 0,this.config=O}var W=z.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},z.probe=function(O){return Object(Q.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},W.demux=function(O){var g=O,p=Object(H.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(Q.appendUint8Array)(this.remainderData,O));var f=Object(Q.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(H.dummyTrack)(),avcTrack:p,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},W.flush=function(){var O=Object(H.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(H.dummyTrack)(),avcTrack:O,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},W.demuxSampleAes=function(O,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},z}();F.minProbeByteLength=1024,J.default=F},"./src/demux/mpegaudio.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"appendFrame",function(){return M}),P.d(J,"parseHeader",function(){return O}),P.d(J,"isHeaderPattern",function(){return g}),P.d(J,"isHeader",function(){return p}),P.d(J,"canParse",function(){return f}),P.d(J,"probe",function(){return h});var Q=null,H=[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],F=[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]],W=[0,1,1,4];function M(n,d,l,a,u){if(l+24>d.length)return;var c=O(d,l);if(c&&l+c.frameLength<=d.length){var L=c.samplesPerFrame*9e4/c.sampleRate,S=a+u*L,T={unit:d.subarray(l,l+c.frameLength),pts:S,dts:S};return n.config=[],n.channelCount=c.channelCount,n.samplerate=c.sampleRate,n.samples.push(T),{sample:T,length:c.frameLength,missing:0}}}function O(n,d){var l=n[d+1]>>3&3,a=n[d+1]>>1&3,u=n[d+2]>>4&15,c=n[d+2]>>2&3;if(l!==1&&u!==0&&u!==15&&c!==3){var L=n[d+2]>>1&1,S=n[d+3]>>6,T=l===3?3-a:a===3?3:4,R=H[T*14+u-1]*1e3,C=l===3?0:l===2?1:2,w=F[C*3+c],x=S===3?1:2,_=z[l][a],o=W[a],b=_*8*o,m=Math.floor(_*R/w+L)*o;if(Q===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);Q=N?parseInt(N[1]):0}var D=!!Q&&Q<=87;return D&&a===2&&R>=224e3&&S===0&&(n[d+3]=n[d+3]|128),{sampleRate:w,channelCount:x,frameLength:m,samplesPerFrame:b}}}function g(n,d){return n[d]===255&&(n[d+1]&224)===224&&(n[d+1]&6)!==0}function p(n,d){return d+1<n.length&&g(n,d)}function f(n,d){var l=4;return g(n,d)&&l<=n.length-d}function h(n,d){if(d+1<n.length&&g(n,d)){var l=4,a=O(n,d),u=l;a!=null&&a.frameLength&&(u=a.frameLength);var c=d+u;return c===n.length||p(n,c)}return!1}},"./src/demux/sample-aes.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/crypt/decrypter.ts"),H=P("./src/demux/tsdemuxer.ts"),F=function(){function z(M,O,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new Q.default(M,O,{removePKCS7Padding:!1})}var W=z.prototype;return W.decryptBuffer=function(O,g){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,g)},W.decryptAacSample=function(O,g,p,f){var h=O[g].unit,n=h.subarray(16,h.length-h.length%16),d=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),l=this;this.decryptBuffer(d,function(a){var u=new Uint8Array(a);h.set(u,16),f||l.decryptAacSamples(O,g+1,p)})},W.decryptAacSamples=function(O,g,p){for(;;g++){if(g>=O.length){p();return}if(O[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(O,g,p,f),!f)return}},W.getAvcEncryptedData=function(O){for(var g=Math.floor((O.length-48)/160)*16+16,p=new Int8Array(g),f=0,h=32;h<=O.length-16;h+=160,f+=16)p.set(O.subarray(h,h+16),f);return p},W.getAvcDecryptedUnit=function(O,g){for(var p=new Uint8Array(g),f=0,h=32;h<=O.length-16;h+=160,f+=16)O.set(p.subarray(f,f+16),h);return O},W.decryptAvcSample=function(O,g,p,f,h,n){var d=Object(H.discardEPB)(h.data),l=this.getAvcEncryptedData(d),a=this;this.decryptBuffer(l.buffer,function(u){h.data=a.getAvcDecryptedUnit(d,u),n||a.decryptAvcSamples(O,g,p+1,f)})},W.decryptAvcSamples=function(O,g,p,f){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=O.length){f();return}for(var h=O[g].units;!(p>=h.length);p++){var n=h[p];if(n.data.length<=48||n.type!==1&&n.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(O,g,p,f,n,d),!d)return}}},z}();J.default=F},"./src/demux/transmuxer-interface.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return h});var Q=P("./node_modules/webworkify-webpack/index.js"),H=P.n(Q),F=P("./src/events.ts"),z=P("./src/demux/transmuxer.ts"),W=P("./src/utils/logger.ts"),M=P("./src/errors.ts"),O=P("./src/utils/mediasource-helper.ts"),g=P("./node_modules/eventemitter3/index.js"),p=P.n(g),f=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function n(l,a,u,c){var L=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=a,this.onTransmuxComplete=u,this.onFlush=c;var S=l.config,T=function(_,o){o=o||{},o.frag=L.frag,o.id=L.id,l.trigger(_,o)};this.observer=new g.EventEmitter,this.observer.on(F.Events.FRAG_DECRYPTED,T),this.observer.on(F.Events.ERROR,T);var R={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},C=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var w;try{w=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),w.addEventListener("message",this.onwmsg),w.onerror=function(x){l.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(x.message+" ("+x.filename+":"+x.lineno+")")})},w.postMessage({cmd:"init",typeSupported:R,vendor:C,id:a,config:JSON.stringify(S)})}catch(x){W.logger.warn("Error in worker:",x),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),w&&self.URL.revokeObjectURL(w.objectURL),this.transmuxer=new z.default(this.observer,R,S,C,a),this.worker=null}}else this.transmuxer=new z.default(this.observer,R,S,C,a)}var d=n.prototype;return d.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},d.push=function(a,u,c,L,S,T,R,C,w,x){var _=this;w.transmuxing.start=self.performance.now();var o=this.transmuxer,b=this.worker,m=T?T.start:S.start,E=S.decryptdata,N=this.frag,D=!(N&&S.cc===N.cc),B=!(N&&w.level===N.level),j=N?w.sn-N.sn:-1,I=this.part?w.part-this.part.index:1,v=!B&&(j===1||j===0&&I===1),G=self.performance.now();(B||j||S.stats.parsing.start===0)&&(S.stats.parsing.start=G),T&&(I||!v)&&(T.stats.parsing.start=G);var Y=new z.TransmuxState(D,v,C,B,m);if(!v||D){W.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+w.sn+" p: "+w.part+" level: "+w.level+" id: "+w.id+`
discontinuity: `+D+`
trackSwitch: `+B+`
contiguous: `+v+`
accurateTimeOffset: `+C+`
timeOffset: `+m);var re=new z.TransmuxConfig(c,L,u,R,x);this.configureTransmuxer(re)}if(this.frag=S,this.part=T,b)b.postMessage({cmd:"demux",data:a,decryptdata:E,chunkMeta:w,state:Y},a instanceof ArrayBuffer?[a]:[]);else if(o){var oe=o.push(a,E,w,Y);Object(z.isPromise)(oe)?oe.then(function(we){_.handleTransmuxComplete(we)}):this.handleTransmuxComplete(oe)}},d.flush=function(a){var u=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(c){var S=c.flush(a);Object(z.isPromise)(S)?S.then(function(T){u.handleFlushResult(T,a)}):this.handleFlushResult(S,a)}},d.handleFlushResult=function(a,u){var c=this;a.forEach(function(L){c.handleTransmuxComplete(L)}),this.onFlush(u)},d.onWorkerMessage=function(a){var u=a.data,c=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,c.trigger(u.event,u.data);break}}},d.configureTransmuxer=function(a){var u=this.worker,c=this.transmuxer;u?u.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},d.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},n}()},"./src/demux/transmuxer-worker.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return M});var Q=P("./src/demux/transmuxer.ts"),H=P("./src/events.ts"),F=P("./src/utils/logger.ts"),z=P("./node_modules/eventemitter3/index.js"),W=P.n(z);function M(h){var n=new z.EventEmitter,d=function(a,u){h.postMessage({event:a,data:u})};n.on(H.Events.FRAG_DECRYPTED,d),n.on(H.Events.ERROR,d),h.addEventListener("message",function(l){var a=l.data;switch(a.cmd){case"init":{var u=JSON.parse(a.config);h.transmuxer=new Q.default(n,a.typeSupported,u,a.vendor,a.id),Object(F.enableLogs)(u.debug),d("init",null);break}case"configure":{h.transmuxer.configure(a.config);break}case"demux":{var c=h.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Q.isPromise)(c)?c.then(function(T){O(h,T)}):O(h,c);break}case"flush":{var L=a.chunkMeta,S=h.transmuxer.flush(L);Object(Q.isPromise)(S)?S.then(function(T){p(h,T,L)}):p(h,S,L);break}default:break}})}function O(h,n){if(f(n.remuxResult))return;var d=[],l=n.remuxResult,a=l.audio,u=l.video;a&&g(d,a),u&&g(d,u),h.postMessage({event:"transmuxComplete",data:n},d)}function g(h,n){n.data1&&h.push(n.data1.buffer),n.data2&&h.push(n.data2.buffer)}function p(h,n,d){n.forEach(function(l){O(h,l)}),h.postMessage({event:"flush",data:d})}function f(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return u}),P.d(J,"isPromise",function(){return S}),P.d(J,"TransmuxConfig",function(){return T}),P.d(J,"TransmuxState",function(){return R});var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/crypt/decrypter.ts"),z=P("./src/demux/aacdemuxer.ts"),W=P("./src/demux/mp4demuxer.ts"),M=P("./src/demux/tsdemuxer.ts"),O=P("./src/demux/mp3demuxer.ts"),g=P("./src/remux/mp4-remuxer.ts"),p=P("./src/remux/passthrough-remuxer.ts"),f=P("./src/demux/chunk-cache.ts"),h=P("./src/utils/mp4-tools.ts"),n=P("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(C){n.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var l=[{demux:M.default,remux:g.default},{demux:W.default,remux:p.default},{demux:z.default,remux:g.default},{demux:O.default,remux:g.default}],a=1024;l.forEach(function(C){var w=C.demux;a=Math.max(a,w.minProbeByteLength)});var u=function(){function C(x,_,o,b,m){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 f.default,this.observer=x,this.typeSupported=_,this.config=o,this.vendor=b,this.id=m}var w=C.prototype;return w.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},w.push=function(_,o,b,m){var E=this,N=b.transmuxing;N.executeStart=d();var D=new Uint8Array(_),B=this.cache,j=this.config,I=this.currentTransmuxState,v=this.transmuxConfig;m&&(this.currentTransmuxState=m);var G=c(D,o);if(G&&G.method==="AES-128"){var Y=this.getDecrypter();if(j.enableSoftwareAES){var re=Y.softwareDecrypt(D,G.key.buffer,G.iv.buffer);if(!re)return N.executeEnd=d(),L(b);D=new Uint8Array(re)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,G.key.buffer,G.iv.buffer).then(function(Ae){var Le=E.push(Ae,null,b);return E.decryptionPromise=null,Le}),this.decryptionPromise}var oe=m||I,we=oe.contiguous,pe=oe.discontinuity,xe=oe.trackSwitch,_e=oe.accurateTimeOffset,Se=oe.timeOffset,ce=v.audioCodec,ue=v.videoCodec,ie=v.defaultInitPts,de=v.duration,se=v.initSegmentData;if((pe||xe)&&this.resetInitSegment(se,ce,ue,de),pe&&this.resetInitialTimestamp(ie),we||this.resetContiguity(),this.needsProbing(D,pe,xe)){if(B.dataLength){var Oe=B.flush();D=Object(h.appendUint8Array)(Oe,D)}this.configureTransmuxer(D,v)}var ke=this.transmux(D,G,Se,_e,b),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,N.executeEnd=d(),ke},w.flush=function(_){var o=this,b=_.transmuxing;b.executeStart=d();var m=this.decrypter,E=this.cache,N=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return o.flush(_)});var B=[],j=N.timeOffset;if(m){var I=m.flush();I&&B.push(this.push(I,null,_))}var v=E.dataLength;E.reset();var G=this.demuxer,Y=this.remuxer;if(!G||!Y)return v>=a&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=d(),[L(_)];var re=G.flush(j);return S(re)?re.then(function(oe){return o.flushRemux(B,oe,_),B}):(this.flushRemux(B,re,_),B)},w.flushRemux=function(_,o,b){var m=o.audioTrack,E=o.avcTrack,N=o.id3Track,D=o.textTrack,B=this.currentTransmuxState,j=B.accurateTimeOffset,I=B.timeOffset;n.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var v=this.remuxer.remux(m,E,N,D,I,j,!0,this.id);_.push({remuxResult:v,chunkMeta:b}),b.transmuxing.executeEnd=d()},w.resetInitialTimestamp=function(_){var o=this.demuxer,b=this.remuxer;if(!o||!b)return;o.resetTimeStamp(_),b.resetTimeStamp(_)},w.resetContiguity=function(){var _=this.demuxer,o=this.remuxer;if(!_||!o)return;_.resetContiguity(),o.resetNextTimestamp()},w.resetInitSegment=function(_,o,b,m){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(o,b,m),N.resetInitSegment(_,o,b)},w.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},w.transmux=function(_,o,b,m,E){var N;return o&&o.method==="SAMPLE-AES"?N=this.transmuxSampleAes(_,o,b,m,E):N=this.transmuxUnencrypted(_,b,m,E),N},w.transmuxUnencrypted=function(_,o,b,m){var E=this.demuxer.demux(_,o,!1,!this.config.progressive),N=E.audioTrack,D=E.avcTrack,B=E.id3Track,j=E.textTrack,I=this.remuxer.remux(N,D,B,j,o,b,!1,this.id);return{remuxResult:I,chunkMeta:m}},w.transmuxSampleAes=function(_,o,b,m,E){var N=this;return this.demuxer.demuxSampleAes(_,o,b).then(function(D){var B=N.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,b,m,!1,N.id);return{remuxResult:B,chunkMeta:E}})},w.configureTransmuxer=function(_,o){for(var b=this.config,m=this.observer,E=this.typeSupported,N=this.vendor,D=o.audioCodec,B=o.defaultInitPts,j=o.duration,I=o.initSegmentData,v=o.videoCodec,G,Y=0,re=l.length;Y<re;Y++)if(l[Y].demux.probe(_)){G=l[Y];break}G||(n.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:W.default,remux:p.default});var oe=this.demuxer,we=this.remuxer,pe=G.remux,xe=G.demux;(!we||!(we instanceof pe))&&(this.remuxer=new pe(m,b,E,N)),(!oe||!(oe instanceof xe))&&(this.demuxer=new xe(m,b,E),this.probe=xe.probe),this.resetInitSegment(I,D,v,j),this.resetInitialTimestamp(B)},w.needsProbing=function(_,o,b){return!this.demuxer||!this.remuxer||o||b},w.getDecrypter=function(){var _=this.decrypter;return _||(_=this.decrypter=new F.default(this.observer,this.config)),_},C}();function c(C,w){var x=null;return C.byteLength>0&&w!=null&&w.key!=null&&w.iv!==null&&w.method!=null&&(x=w),x}var L=function(w){return{remuxResult:{},chunkMeta:w}};function S(C){return"then"in C&&C.then instanceof Function}var T=function(w,x,_,o,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=w,this.videoCodec=x,this.initSegmentData=_,this.duration=o,this.defaultInitPts=b},R=function(w,x,_,o,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=w,this.contiguous=x,this.accurateTimeOffset=_,this.trackSwitch=o,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"discardEPB",function(){return L});var Q=P("./src/demux/adts.ts"),H=P("./src/demux/mpegaudio.ts"),F=P("./src/demux/exp-golomb.ts"),z=P("./src/demux/id3.ts"),W=P("./src/demux/sample-aes.ts"),M=P("./src/events.ts"),O=P("./src/utils/mp4-tools.ts"),g=P("./src/utils/logger.ts"),p=P("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function S(R,C,w){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=C,this.typeSupported=w}S.probe=function(C){var w=S.syncOffset(C);return w<0?!1:(w&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+w+", junk ahead ?"),!0)},S.syncOffset=function(C){for(var w=Math.min(1e3,C.length-3*188),x=0;x<w;){if(C[x]===71&&C[x+188]===71&&C[x+2*188]===71)return x;x++}return-1},S.createTrack=function(C,w){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:f[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?w:void 0}};var T=S.prototype;return T.resetInitSegment=function(C,w,x){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=S.createTrack("video",x),this._audioTrack=S.createTrack("audio",x),this._id3Track=S.createTrack("id3",x),this._txtTrack=S.createTrack("text",x),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=C,this.videoCodec=w,this._duration=x},T.resetTimeStamp=function(){},T.resetContiguity=function(){var C=this._audioTrack,w=this._avcTrack,x=this._id3Track;C&&(C.pesData=null),w&&(w.pesData=null),x&&(x.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(C,w,x,_){x===void 0&&(x=!1),_===void 0&&(_=!1),x||(this.sampleAes=null);var o,b=this._avcTrack,m=this._audioTrack,E=this._id3Track,N=b.pid,D=b.pesData,B=m.pid,j=E.pid,I=m.pesData,v=E.pesData,G=!1,Y=this.pmtParsed,re=this._pmtId,oe=C.length;if(this.remainderData&&(C=Object(O.appendUint8Array)(this.remainderData,C),oe=C.length,this.remainderData=null),oe<188&&!_)return this.remainderData=C,{audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};var we=Math.max(0,S.syncOffset(C));oe-=(oe+we)%188,oe<C.byteLength&&!_&&(this.remainderData=new Uint8Array(C.buffer,oe,C.buffer.byteLength-oe));for(var pe=we;pe<oe;pe+=188)if(C[pe]===71){var xe=!!(C[pe+1]&64),_e=((C[pe+1]&31)<<8)+C[pe+2],Se=(C[pe+3]&48)>>4,ce=void 0;if(Se>1){if(ce=pe+5+C[pe+4],ce===pe+188)continue}else ce=pe+4;switch(_e){case N:xe&&(D&&(o=a(D))&&this.parseAVCPES(o,!1),D={data:[],size:0}),D&&(D.data.push(C.subarray(ce,pe+188)),D.size+=pe+188-ce);break;case B:xe&&(I&&(o=a(I))&&(m.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(C.subarray(ce,pe+188)),I.size+=pe+188-ce);break;case j:xe&&(v&&(o=a(v))&&this.parseID3PES(o),v={data:[],size:0}),v&&(v.data.push(C.subarray(ce,pe+188)),v.size+=pe+188-ce);break;case 0:xe&&(ce+=C[ce]+1),re=this._pmtId=d(C,ce);break;case re:{xe&&(ce+=C[ce]+1);var ue=l(C,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,x);N=ue.avc,N>0&&(b.pid=N),B=ue.audio,B>0&&(m.pid=B,m.isAAC=ue.isAAC),j=ue.id3,j>0&&(E.pid=j),G&&!Y&&(g.logger.log("reparse from beginning"),G=!1,pe=we-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=D,m.pesData=I,E.pesData=v;var ie={audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(ie),ie},T.flush=function(){var C=this.remainderData;this.remainderData=null;var w;return C?w=this.demux(C,-1,!1,!0):w={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(w),this.sampleAes?this.decrypt(w,this.sampleAes):w},T.extractRemainingSamples=function(C){var w=C.audioTrack,x=C.avcTrack,_=C.id3Track,o=x.pesData,b=w.pesData,m=_.pesData,E;o&&(E=a(o))?(this.parseAVCPES(E,!0),x.pesData=null):x.pesData=o,b&&(E=a(b))?(w.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),w.pesData=null):(b!=null&&b.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),w.pesData=b),m&&(E=a(m))?(this.parseID3PES(E),_.pesData=null):_.pesData=m},T.demuxSampleAes=function(C,w,x){var _=this.demux(C,x,!0,!this.config.progressive),o=this.sampleAes=new W.default(this.observer,this.config,w);return this.decrypt(_,o)},T.decrypt=function(C,w){return new Promise(function(x){var _=C.audioTrack,o=C.avcTrack;_.samples&&_.isAAC?w.decryptAacSamples(_.samples,0,function(){o.samples?w.decryptAvcSamples(o.samples,0,0,function(){x(C)}):x(C)}):o.samples&&w.decryptAvcSamples(o.samples,0,0,function(){x(C)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(C,w){var x=this,_=this._avcTrack,o=this.parseAVCNALu(C.data),b=!1,m=this.avcSample,E,N=!1;C.data=null,m&&o.length&&!_.audFound&&(u(m,_),m=this.avcSample=n(!1,C.pts,C.dts,"")),o.forEach(function(D){switch(D.type){case 1:{E=!0,m||(m=x.avcSample=n(!0,C.pts,C.dts,"")),b&&(m.debug+="NDR "),m.frame=!0;var B=D.data;if(N&&B.length>4){var j=new F.default(B).readSliceType();(j===2||j===4||j===7||j===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=x.avcSample=n(!0,C.pts,C.dts,"")),b&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,b&&m&&(m.debug+="SEI ");var I=new F.default(L(D.data));I.readUByte();for(var v=0,G=0,Y=!1,re=0;!Y&&I.bytesAvailable>1;){v=0;do re=I.readUByte(),v+=re;while(re===255);G=0;do re=I.readUByte(),G+=re;while(re===255);if(v===4&&I.bytesAvailable!==0){Y=!0;var oe=I.readUByte();if(oe===181){var we=I.readUShort();if(we===49){var pe=I.readUInt();if(pe===1195456820){var xe=I.readUByte();if(xe===3){for(var _e=I.readUByte(),Se=I.readUByte(),ce=31&_e,ue=[_e,Se],ie=0;ie<ce;ie++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());c(x._txtTrack.samples,{type:3,pts:C.pts,bytes:ue})}}}}}else if(v===5&&I.bytesAvailable!==0){if(Y=!0,G>16){for(var de=[],se=0;se<16;se++)de.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&de.push("-");for(var Oe=G-16,ke=new Uint8Array(Oe),Te=0;Te<Oe;Te++)ke[Te]=I.readUByte();c(x._txtTrack.samples,{pts:C.pts,payloadType:v,uuid:de.join(""),userData:Object(z.utf8ArrayToStr)(ke),userDataBytes:ke})}}else if(G<I.bytesAvailable)for(var Ae=0;Ae<G;Ae++)I.readUByte()}break}case 7:if(E=!0,N=!0,b&&m&&(m.debug+="SPS "),!_.sps){var Le=new F.default(D.data),Be=Le.readSPS();_.width=Be.width,_.height=Be.height,_.pixelRatio=Be.pixelRatio,_.sps=[D.data],_.duration=x._duration;for(var Fe=D.data.subarray(1,4),De="avc1.",Ne=0;Ne<3;Ne++){var Xe=Fe[Ne].toString(16);Xe.length<2&&(Xe="0"+Xe),De+=Xe}_.codec=De}break;case 8:E=!0,b&&m&&(m.debug+="PPS "),_.pps||(_.pps=[D.data]);break;case 9:E=!1,_.audFound=!0,m&&u(m,_),m=x.avcSample=n(!1,C.pts,C.dts,b?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+D.type+" ");break}if(m&&E){var Ze=m.units;Ze.push(D)}}),w&&m&&(u(m,_),this.avcSample=null)},T.getLastNalUnit=function(){var C,w=this.avcSample,x;if(!w||w.units.length===0){var _=this._avcTrack.samples;w=_[_.length-1]}if((C=w)!==null&&C!==void 0&&C.units){var o=w.units;x=o[o.length-1]}return x},T.parseAVCNALu=function(C){var w=C.byteLength,x=this._avcTrack,_=x.naluState||0,o=_,b=[],m=0,E,N,D,B=-1,j=0;for(_===-1&&(B=0,j=C[0]&31,_=0,m=1);m<w;){if(E=C[m++],!_){_=E?0:1;continue}if(_===1){_=E?0:2;continue}if(!E)_=3;else if(E===1){if(B>=0){var I={data:C.subarray(B,m-_-1),type:j};b.push(I)}else{var v=this.getLastNalUnit();if(v&&(o&&m<=4-o&&(v.state&&(v.data=v.data.subarray(0,v.data.byteLength-o))),N=m-_-1,N>0)){var G=new Uint8Array(v.data.byteLength+N);G.set(v.data,0),G.set(C.subarray(0,N),v.data.byteLength),v.data=G,v.state=0}}m<w?(D=C[m]&31,B=m,j=D,_=0):_=-1}else _=0}if(B>=0&&_>=0){var Y={data:C.subarray(B,w),type:j,state:_};b.push(Y)}if(b.length===0){var re=this.getLastNalUnit();if(re){var oe=new Uint8Array(re.data.byteLength+C.byteLength);oe.set(re.data,0),oe.set(C,re.data.byteLength),re.data=oe}}return x.naluState=_,b},T.parseAACPES=function(C){var w=0,x=this._audioTrack,_=this.aacOverFlow,o=C.data;if(_){this.aacOverFlow=null;var b=_.sample.unit.byteLength,m=Math.min(_.missing,b),E=b-m;_.sample.unit.set(o.subarray(0,m),E),x.samples.push(_.sample),w=_.missing}var N,D;for(N=w,D=o.length;N<D-1&&!Q.isHeader(o,N);N++);if(N!==w){var B,j;if(N<D-1?(B="AAC PES did not start with ADTS header,offset:"+N,j=!1):(B="no ADTS header found in AAC PES",j=!0),g.logger.warn("parsing error:"+B),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:B}),j)return}Q.initTrackConfig(x,this.observer,o,N,this.audioCodec);var I;if(C.pts!==void 0)I=C.pts;else if(_){var v=Q.getFrameDuration(x.samplerate);I=_.sample.pts+v}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;N<D;)if(Q.isHeader(o,N)){if(N+5<D){var Y=Q.appendFrame(x,o,N,I,G);if(Y)if(Y.missing)this.aacOverFlow=Y;else{N+=Y.length,G++;continue}}break}else N++},T.parseMPEGPES=function(C){var w=C.data,x=w.length,_=0,o=0,b=C.pts;if(b===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<x;)if(H.isHeader(w,o)){var m=H.appendFrame(this._audioTrack,w,o,b,_);if(m)o+=m.length,_++;else break}else o++},T.parseID3PES=function(C){if(C.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(C)},S}();h.minProbeByteLength=188;function n(S,T,R,C){return{key:S,frame:!1,pts:T,dts:R,units:[],debug:C,length:0}}function d(S,T){return(S[T+10]&31)<<8|S[T+11]}function l(S,T,R,C){var w={audio:-1,avc:-1,id3:-1,isAAC:!0},x=(S[T+1]&15)<<8|S[T+2],_=T+3+x-4,o=(S[T+10]&15)<<8|S[T+11];for(T+=12+o;T<_;){var b=(S[T+1]&31)<<8|S[T+2];switch(S[T]){case 207:if(!C){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:w.audio===-1&&(w.audio=b);break;case 21:w.id3===-1&&(w.id3=b);break;case 219:if(!C){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:w.avc===-1&&(w.avc=b);break;case 3:case 4:R?w.audio===-1&&(w.audio=b,w.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}T+=((S[T+3]&15)<<8|S[T+4])+5}return w}function a(S){var T=0,R,C,w,x,_,o=S.data;if(!S||S.size===0)return null;for(;o[0].length<19&&o.length>1;){var b=new Uint8Array(o[0].length+o[1].length);b.set(o[0]),b.set(o[1],o[0].length),o[0]=b,o.splice(1,1)}R=o[0];var m=(R[0]<<16)+(R[1]<<8)+R[2];if(m===1){if(C=(R[4]<<8)+R[5],C&&C>S.size-6)return null;var E=R[7];E&192&&(x=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,E&64?(_=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,x-_>60*9e4&&(g.logger.warn(Math.round((x-_)/9e4)+"s delta between PTS and DTS, align them"),x=_)):_=x),w=R[8];var N=w+9;if(S.size<=N)return null;S.size-=N;for(var D=new Uint8Array(S.size),B=0,j=o.length;B<j;B++){R=o[B];var I=R.byteLength;if(N)if(N>I){N-=I;continue}else R=R.subarray(N),I-=N,N=0;D.set(R,T),T+=I}return C&&(C-=w+3),{data:D,pts:x,dts:_,len:C}}return null}function u(S,T){if(S.units.length&&S.frame){if(S.pts===void 0){var R=T.samples,C=R.length;if(C){var w=R[C-1];S.pts=w.pts,S.dts=w.dts}else{T.dropped++;return}}T.samples.push(S)}S.debug.length&&g.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function c(S,T){var R=S.length;if(R>0){if(T.pts>=S[R-1].pts)S.push(T);else for(var C=R-1;C>=0;C--)if(T.pts<S[C].pts){S.splice(C,0,T);break}}else S.push(T)}function L(S){for(var T=S.byteLength,R=[],C=1;C<T-2;)S[C]===0&&S[C+1]===0&&S[C+2]===3?(R.push(C+2),C+=2):C++;if(R.length===0)return S;var w=T-R.length,x=new Uint8Array(w),_=0;for(C=0;C<w;_++,C++)_===R[0]&&(_++,R.shift()),x[C]=S[_];return x}J.default=h},"./src/errors.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"ErrorTypes",function(){return Q}),P.d(J,"ErrorDetails",function(){return H});var Q;(function(F){F.NETWORK_ERROR="networkError",F.MEDIA_ERROR="mediaError",F.KEY_SYSTEM_ERROR="keySystemError",F.MUX_ERROR="muxError",F.OTHER_ERROR="otherError"})(Q||(Q={}));var H;(function(F){F.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",F.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",F.KEY_SYSTEM_NO_SESSION="keySystemNoSession",F.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",F.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",F.MANIFEST_LOAD_ERROR="manifestLoadError",F.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",F.MANIFEST_PARSING_ERROR="manifestParsingError",F.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",F.LEVEL_EMPTY_ERROR="levelEmptyError",F.LEVEL_LOAD_ERROR="levelLoadError",F.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",F.LEVEL_SWITCH_ERROR="levelSwitchError",F.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",F.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",F.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",F.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",F.FRAG_LOAD_ERROR="fragLoadError",F.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",F.FRAG_DECRYPT_ERROR="fragDecryptError",F.FRAG_PARSING_ERROR="fragParsingError",F.REMUX_ALLOC_ERROR="remuxAllocError",F.KEY_LOAD_ERROR="keyLoadError",F.KEY_LOAD_TIMEOUT="keyLoadTimeOut",F.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",F.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",F.BUFFER_APPEND_ERROR="bufferAppendError",F.BUFFER_APPENDING_ERROR="bufferAppendingError",F.BUFFER_STALLED_ERROR="bufferStalledError",F.BUFFER_FULL_ERROR="bufferFullError",F.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",F.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",F.INTERNAL_EXCEPTION="internalException",F.INTERNAL_ABORTED="aborted",F.UNKNOWN="unknown"})(H||(H={}))},"./src/events.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"Events",function(){return Q});var Q;(function(H){H.MEDIA_ATTACHING="hlsMediaAttaching",H.MEDIA_ATTACHED="hlsMediaAttached",H.MEDIA_DETACHING="hlsMediaDetaching",H.MEDIA_DETACHED="hlsMediaDetached",H.BUFFER_RESET="hlsBufferReset",H.BUFFER_CODECS="hlsBufferCodecs",H.BUFFER_CREATED="hlsBufferCreated",H.BUFFER_APPENDING="hlsBufferAppending",H.BUFFER_APPENDED="hlsBufferAppended",H.BUFFER_EOS="hlsBufferEos",H.BUFFER_FLUSHING="hlsBufferFlushing",H.BUFFER_FLUSHED="hlsBufferFlushed",H.MANIFEST_LOADING="hlsManifestLoading",H.MANIFEST_LOADED="hlsManifestLoaded",H.MANIFEST_PARSED="hlsManifestParsed",H.LEVEL_SWITCHING="hlsLevelSwitching",H.LEVEL_SWITCHED="hlsLevelSwitched",H.LEVEL_LOADING="hlsLevelLoading",H.LEVEL_LOADED="hlsLevelLoaded",H.LEVEL_UPDATED="hlsLevelUpdated",H.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",H.LEVELS_UPDATED="hlsLevelsUpdated",H.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",H.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",H.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",H.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",H.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",H.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",H.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",H.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",H.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",H.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",H.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",H.CUES_PARSED="hlsCuesParsed",H.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",H.INIT_PTS_FOUND="hlsInitPtsFound",H.FRAG_LOADING="hlsFragLoading",H.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",H.FRAG_LOADED="hlsFragLoaded",H.FRAG_DECRYPTED="hlsFragDecrypted",H.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",H.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",H.FRAG_PARSING_METADATA="hlsFragParsingMetadata",H.FRAG_PARSED="hlsFragParsed",H.FRAG_BUFFERED="hlsFragBuffered",H.FRAG_CHANGED="hlsFragChanged",H.FPS_DROP="hlsFpsDrop",H.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",H.ERROR="hlsError",H.DESTROYING="hlsDestroying",H.KEY_LOADING="hlsKeyLoading",H.KEY_LOADED="hlsKeyLoaded",H.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",H.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return S});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),H=P.n(Q),F=P("./src/loader/playlist-loader.ts"),z=P("./src/loader/key-loader.ts"),W=P("./src/controller/id3-track-controller.ts"),M=P("./src/controller/latency-controller.ts"),O=P("./src/controller/level-controller.ts"),g=P("./src/controller/fragment-tracker.ts"),p=P("./src/controller/stream-controller.ts"),f=P("./src/is-supported.ts"),h=P("./src/utils/logger.ts"),n=P("./src/config.ts"),d=P("./node_modules/eventemitter3/index.js"),l=P.n(d),a=P("./src/events.ts"),u=P("./src/errors.ts");function c(T,R){for(var C=0;C<R.length;C++){var w=R[C];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(T,w.key,w)}}function L(T,R,C){return R&&c(T.prototype,R),C&&c(T,C),T}var S=function(){T.isSupported=function(){return Object(f.isSupported)()};function T(C){C===void 0&&(C={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new d.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 w=this.config=Object(n.mergeConfig)(T.DefaultConfig,C);this.userConfig=C,Object(h.enableLogs)(w.debug),this._autoLevelCapping=-1,w.progressive&&Object(n.enableStreamingMode)(w);var x=w.abrController,_=w.bufferController,o=w.capLevelController,b=w.fpsController,m=this.abrController=new x(this),E=this.bufferController=new _(this),N=this.capLevelController=new o(this),D=new b(this),B=new F.default(this),j=new z.default(this),I=new W.default(this),v=this.levelController=new O.default(this),G=new g.FragmentTracker(this),Y=this.streamController=new p.default(this,G);N.setStreamController(Y),D.setStreamController(Y);var re=[v,Y];this.networkControllers=re;var oe=[B,j,m,E,N,D,I,G];this.audioTrackController=this.createController(w.audioTrackController,null,re),this.createController(w.audioStreamController,G,re),this.subtitleTrackController=this.createController(w.subtitleTrackController,null,re),this.createController(w.subtitleStreamController,G,re),this.createController(w.timelineController,null,oe),this.emeController=this.createController(w.emeController,null,oe),this.cmcdController=this.createController(w.cmcdController,null,oe),this.latencyController=this.createController(M.default,null,oe),this.coreComponents=oe}var R=T.prototype;return R.createController=function(w,x,_){if(w){var o=x?new w(this,x):new w(this);return _&&_.push(o),o}return null},R.on=function(w,x,_){_===void 0&&(_=this),this._emitter.on(w,x,_)},R.once=function(w,x,_){_===void 0&&(_=this),this._emitter.once(w,x,_)},R.removeAllListeners=function(w){this._emitter.removeAllListeners(w)},R.off=function(w,x,_,o){_===void 0&&(_=this),this._emitter.off(w,x,_,o)},R.listeners=function(w){return this._emitter.listeners(w)},R.emit=function(w,x,_){return this._emitter.emit(w,x,_)},R.trigger=function(w,x){if(this.config.debug)return this.emit(w,w,x);try{return this.emit(w,w,x)}catch(_){h.logger.error("An internal error happened while handling event "+w+'. Error message: "'+_.message+'". Here is a stacktrace:',_),this.trigger(a.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:w,error:_})}return!1},R.listenerCount=function(w){return this._emitter.listenerCount(w)},R.destroy=function(){h.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(w){return w.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(w){return w.destroy()}),this.coreComponents.length=0},R.attachMedia=function(w){h.logger.log("attachMedia"),this._media=w,this.trigger(a.Events.MEDIA_ATTACHING,{media:w})},R.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(w){this.stopLoad();var x=this.media,_=this.url,o=this.url=Q.buildAbsoluteURL(self.location.href,w,{alwaysNormalize:!0});h.logger.log("loadSource:"+o),x&&_&&_!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(x)),this.trigger(a.Events.MANIFEST_LOADING,{url:w})},R.startLoad=function(w){w===void 0&&(w=-1),h.logger.log("startLoad("+w+")"),this.networkControllers.forEach(function(x){x.startLoad(w)})},R.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach(function(w){w.stopLoad()})},R.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){h.logger.log("recoverMediaError");var w=this._media;this.detachMedia(),w&&this.attachMedia(w)},R.removeLevel=function(w,x){x===void 0&&(x=0),this.levelController.removeLevel(w,x)},L(T,[{key:"levels",get:function(){var w=this.levelController.levels;return w||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(w){h.logger.log("set currentLevel:"+w),this.loadLevel=w,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(w){h.logger.log("set nextLevel:"+w),this.levelController.manualLevel=w,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(w){h.logger.log("set loadLevel:"+w),this.levelController.manualLevel=w}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(w){this.levelController.nextLoadLevel=w}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(w){h.logger.log("set firstLevel:"+w),this.levelController.firstLevel=w}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(w){h.logger.log("set startLevel:"+w),w!==-1&&(w=Math.max(w,this.minAutoLevel)),this.levelController.startLevel=w}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(w){var x=!!w;x!==this.config.capLevelToPlayerSize&&(x?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=x)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(w){this._autoLevelCapping!==w&&(h.logger.log("set autoLevelCapping:"+w),this._autoLevelCapping=w)}},{key:"bandwidthEstimate",get:function(){var w=this.abrController.bwEstimator;return w?w.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var w=this.levels,x=this.config.minAutoBitrate;if(!w)return 0;for(var _=w.length,o=0;o<_;o++)if(w[o].maxBitrate>x)return o;return 0}},{key:"maxAutoLevel",get:function(){var w=this.levels,x=this.autoLevelCapping,_;return x===-1&&w&&w.length?_=w.length-1:_=x,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(w){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,w)}},{key:"audioTracks",get:function(){var w=this.audioTrackController;return w?w.audioTracks:[]}},{key:"audioTrack",get:function(){var w=this.audioTrackController;return w?w.audioTrack:-1},set:function(w){var x=this.audioTrackController;x&&(x.audioTrack=w)}},{key:"subtitleTracks",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTrack:-1},set:function(w){var x=this.subtitleTrackController;x&&(x.subtitleTrack=w)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var w=this.subtitleTrackController;return w?w.subtitleDisplay:!1},set:function(w){var x=this.subtitleTrackController;x&&(x.subtitleDisplay=w)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(w){this.config.lowLatencyMode=w}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:n.hlsDefaultConfig},set:function(w){T.defaultConfig=w}}]),T}();S.defaultConfig=void 0},"./src/is-supported.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"isSupported",function(){return F}),P.d(J,"changeTypeSupported",function(){return z});var Q=P("./src/utils/mediasource-helper.ts");function H(){return self.SourceBuffer||self.WebKitSourceBuffer}function F(){var W=Object(Q.getMediaSource)();if(!W)return!1;var M=H(),O=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!O&&!!g}function z(){var W,M=H();return typeof(M==null||((W=M.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return h}),P.d(J,"LoadError",function(){return d});var Q=P("./src/polyfills/number.ts"),H=P("./src/errors.ts");function F(l,a){l.prototype=Object.create(a.prototype),l.prototype.constructor=l,g(l,a)}function z(l){var a=typeof Map=="function"?new Map:void 0;return z=function(c){if(c===null||!O(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(c))return a.get(c);a.set(c,L)}function L(){return W(c,arguments,p(this).constructor)}return L.prototype=Object.create(c.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),g(L,c)},z(l)}function W(l,a,u){return M()?W=Reflect.construct:W=function(L,S,T){var R=[null];R.push.apply(R,S);var C=Function.bind.apply(L,R),w=new C;return T&&g(w,T.prototype),w},W.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function O(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function g(l,a){return g=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},g(l,a)}function p(l){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},p(l)}var f=Math.pow(2,17),h=function(){function l(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var a=l.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(c,L){var S=this,T=c.url;if(!T)return Promise.reject(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var R=this.config,C=R.fLoader,w=R.loader;return new Promise(function(x,_){S.loader&&S.loader.destroy();var o=S.loader=c.loader=C?new C(R):new w(R),b=n(c),m={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:f};c.stats=o.stats,o.load(b,m,{onSuccess:function(N,D,B,j){S.resetLoader(c,o),x({frag:c,part:null,payload:N.data,networkDetails:j})},onError:function(N,D,B){S.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:N,networkDetails:B}))},onAbort:function(N,D,B){S.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:B}))},onTimeout:function(N,D,B){S.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:B}))},onProgress:function(N,D,B,j){L&&L({frag:c,part:null,payload:B,networkDetails:j})}})})},a.loadPart=function(c,L,S){var T=this;this.abort();var R=this.config,C=R.fLoader,w=R.loader;return new Promise(function(x,_){T.loader&&T.loader.destroy();var o=T.loader=c.loader=C?new C(R):new w(R),b=n(c,L),m={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:f};L.stats=o.stats,o.load(b,m,{onSuccess:function(N,D,B,j){T.resetLoader(c,o),T.updateStatsFromPart(c,L);var I={frag:c,part:L,payload:N.data,networkDetails:j};S(I),x(I)},onError:function(N,D,B){T.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:L,response:N,networkDetails:B}))},onAbort:function(N,D,B){c.stats.aborted=L.stats.aborted,T.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:L,networkDetails:B}))},onTimeout:function(N,D,B){T.resetLoader(c,o),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:L,networkDetails:B}))}})})},a.updateStatsFromPart=function(c,L){var S=c.stats,T=L.stats,R=T.total;if(S.loaded+=T.loaded,R){var C=Math.round(c.duration/L.duration),w=Math.min(Math.round(S.loaded/R),C),x=C-w,_=x*Math.round(S.loaded/w);S.total=S.loaded+_}else S.total=Math.max(S.loaded,S.total);var o=S.loading,b=T.loading;o.start?o.first+=b.first-b.start:(o.start=b.start,o.first=b.first),o.end=b.end},a.resetLoader=function(c,L){c.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},l}();function n(l,a){a===void 0&&(a=null);var u=a||l,c={frag:l,part:a,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},L=u.byteRangeStartOffset,S=u.byteRangeEndOffset;return Object(Q.isFiniteNumber)(L)&&Object(Q.isFiniteNumber)(S)&&(c.rangeStart=L,c.rangeEnd=S),c}var d=function(l){F(a,l);function a(u){for(var c,L=arguments.length,S=new Array(L>1?L-1:0),T=1;T<L;T++)S[T-1]=arguments[T];return c=l.call.apply(l,[this].concat(S))||this,c.data=void 0,c.data=u,c}return a}(z(Error))},"./src/loader/fragment.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"ElementaryStreamTypes",function(){return h}),P.d(J,"BaseSegment",function(){return n}),P.d(J,"Fragment",function(){return d}),P.d(J,"Part",function(){return l});var Q=P("./src/polyfills/number.ts"),H=P("./node_modules/url-toolkit/src/url-toolkit.js"),F=P.n(H),z=P("./src/utils/logger.ts"),W=P("./src/loader/level-key.ts"),M=P("./src/loader/load-stats.ts");function O(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,g(a,u)}function g(a,u){return g=Object.setPrototypeOf||function(L,S){return L.__proto__=S,L},g(a,u)}function p(a,u){for(var c=0;c<u.length;c++){var L=u[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function f(a,u,c){return u&&p(a.prototype,u),c&&p(a,c),a}var h;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(h||(h={}));var n=function(){function a(c){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[h.AUDIO]=null,L[h.VIDEO]=null,L[h.AUDIOVIDEO]=null,L),this.baseurl=c}var u=a.prototype;return u.setByteRange=function(L,S){var T=L.split("@",2),R=[];T.length===1?R[0]=S?S.byteRangeEndOffset:0:R[0]=parseInt(T[1]),R[1]=parseInt(T[0])+R[0],this._byteRange=R},f(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(H.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(L){this._url=L}}]),a}(),d=function(a){O(u,a);function u(L,S){var T;return T=a.call(this,S)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new M.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=L,T}var c=u.prototype;return c.createInitializationVector=function(S){for(var T=new Uint8Array(16),R=12;R<16;R++)T[R]=S>>8*(15-R)&255;return T},c.setDecryptDataFromLevelKey=function(S,T){var R=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(R=W.LevelKey.fromURI(S.uri),R.method=S.method,R.iv=this.createInitializationVector(T),R.keyFormat="identity"),R},c.setElementaryStreamInfo=function(S,T,R,C,w,x){x===void 0&&(x=!1);var _=this.elementaryStreams,o=_[S];if(!o){_[S]={startPTS:T,endPTS:R,startDTS:C,endDTS:w,partial:x};return}o.startPTS=Math.min(o.startPTS,T),o.endPTS=Math.max(o.endPTS,R),o.startDTS=Math.min(o.startDTS,C),o.endDTS=Math.max(o.endDTS,w)},c.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[h.AUDIO]=null,S[h.VIDEO]=null,S[h.AUDIOVIDEO]=null},f(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var S=this.sn;typeof S!="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'),S=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,S)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var S=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+S*1e3}},{key:"encrypted",get:function(){var S;return!!((S=this.decryptdata)!==null&&S!==void 0&&S.keyFormat&&this.decryptdata.uri)}}]),u}(n),l=function(a){O(u,a);function u(c,L,S,T,R){var C;C=a.call(this,S)||this,C.fragOffset=0,C.duration=0,C.gap=!1,C.independent=!1,C.relurl=void 0,C.fragment=void 0,C.index=void 0,C.stats=new M.LoadStats,C.duration=c.decimalFloatingPoint("DURATION"),C.gap=c.bool("GAP"),C.independent=c.bool("INDEPENDENT"),C.relurl=c.enumeratedString("URI"),C.fragment=L,C.index=T;var w=c.enumeratedString("BYTERANGE");return w&&C.setByteRange(w,R),R&&(C.fragOffset=R.fragOffset+R.duration),C}return f(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),u}(n)},"./src/loader/key-loader.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return z});var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),z=function(){function W(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var M=W.prototype;return M._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},M.onKeyLoading=function(g,p){var f=p.frag,h=f.type,n=this.loaders[h];if(!f.decryptdata){F.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=f.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(n&&(F.logger.warn("abort previous key loader for type:"+h),n.abort()),!d){F.logger.warn("key uri is falsy");return}var a=l.loader,u=f.loader=this.loaders[h]=new a(l);this.decrypturl=d,this.decryptkey=null;var c={url:d,frag:f,responseType:"arraybuffer"},L={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(c,L,S)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:f}))},M.loadsuccess=function(g,p,f){var h=f.frag;if(!h.decryptdata){F.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(g.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:h})},M.loaderror=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},M.loadtimeout=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},W}()},"./src/loader/level-details.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"LevelDetails",function(){return W});var Q=P("./src/polyfills/number.ts");function H(M,O){for(var g=0;g<O.length;g++){var p=O[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(M,p.key,p)}}function F(M,O,g){return O&&H(M.prototype,O),g&&H(M,g),M}var z=10,W=function(){function M(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var O=M.prototype;return O.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-p.lastPartSn,h=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!h||!!f,this.advanced=this.endSN>p.endSN||f>0||f===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},F(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var f=this.driftEnd-this.driftStart;return f*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"LevelKey",function(){return W});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),H=P.n(Q);function F(M,O){for(var g=0;g<O.length;g++){var p=O[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(M,p.key,p)}}function z(M,O,g){return O&&F(M.prototype,O),g&&F(M,g),M}var W=function(){M.fromURL=function(g,p){return new M(g,p)},M.fromURI=function(g){return new M(g)};function M(O,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(Q.buildAbsoluteURL)(O,g,{alwaysNormalize:!0}):this._uri=O}return z(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"LoadStats",function(){return Q});var Q=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(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return u});var Q=P("./src/polyfills/number.ts"),H=P("./node_modules/url-toolkit/src/url-toolkit.js"),F=P.n(H),z=P("./src/loader/fragment.ts"),W=P("./src/loader/level-details.ts"),M=P("./src/loader/level-key.ts"),O=P("./src/utils/attr-list.ts"),g=P("./src/utils/logger.ts"),p=P("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,h=/#EXT-X-MEDIA:(.*)/g,n=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function a(R){var C,w;return l.test((C=(w=H.parseURL(R))===null||w===void 0?void 0:w.path)!=null?C:"")}var u=function(){function R(){}return R.findGroup=function(w,x){for(var _=0;_<w.length;_++){var o=w[_];if(o.id===x)return o}},R.convertAVC1ToAVCOTI=function(w){var x=w.split(".");if(x.length>2){var _=x.shift()+".";return _+=parseInt(x.shift()).toString(16),_+=("000"+parseInt(x.shift()).toString(16)).substr(-4),_}return w},R.resolve=function(w,x){return H.buildAbsoluteURL(x,w,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(w,x){var _=[],o={},b=!1;f.lastIndex=0;for(var m;(m=f.exec(w))!=null;)if(m[1]){var E=new O.AttrList(m[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:R.resolve(m[2],x)},D=E.decimalResolution("RESOLUTION");D&&(N.width=D.width,N.height=D.height),c((E.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=R.convertAVC1ToAVCOTI(N.videoCodec)),_.push(N)}else if(m[3]){var B=new O.AttrList(m[3]);B["DATA-ID"]&&(b=!0,o[B["DATA-ID"]]=B)}return{levels:_,sessionData:b?o:null}},R.parseMasterPlaylistMedia=function(w,x,_,o){o===void 0&&(o=[]);var b,m=[],E=0;for(h.lastIndex=0;(b=h.exec(w))!==null;){var N=new O.AttrList(b[1]);if(N.TYPE===_){var D={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:_,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?R.resolve(N.URI,x):""};if(o.length){var B=R.findGroup(o,D.groupId)||o[0];L(D,B,"audioCodec"),L(D,B,"textCodec")}m.push(D)}}return m},R.parseLevelPlaylist=function(w,x,_,o,b){var m=new W.LevelDetails(x),E=m.fragments,N=null,D=0,B=0,j=0,I=0,v=null,G=new z.Fragment(o,x),Y,re,oe,we=-1,pe=!1;for(n.lastIndex=0,m.m3u8=w;(Y=n.exec(w))!==null;){pe&&(pe=!1,G=new z.Fragment(o,x),G.start=j,G.sn=D,G.cc=I,G.level=_,N&&(G.initSegment=N,G.rawProgramDateTime=N.rawProgramDateTime));var xe=Y[1];if(xe){G.duration=parseFloat(xe);var _e=(" "+Y[2]).slice(1);G.title=_e||null,G.tagList.push(_e?["INF",xe,_e]:["INF",xe])}else if(Y[3])Object(Q.isFiniteNumber)(G.duration)&&(G.start=j,oe&&(G.levelkey=oe),G.sn=D,G.level=_,G.cc=I,G.urlId=b,E.push(G),G.relurl=(" "+Y[3]).slice(1),T(G,v),v=G,j+=G.duration,D++,B=0,pe=!0);else if(Y[4]){var Se=(" "+Y[4]).slice(1);v?G.setByteRange(Se,v):G.setByteRange(Se)}else if(Y[5])G.rawProgramDateTime=(" "+Y[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),we===-1&&(we=E.length);else{if(Y=Y[0].match(d),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<Y.length&&!(typeof Y[re]!="undefined");re++);var ce=(" "+Y[re]).slice(1),ue=(" "+Y[re+1]).slice(1),ie=Y[re+2]?(" "+Y[re+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":m.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":D=m.startSN=parseInt(ue);break;case"SKIP":{var de=new O.AttrList(ue),se=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(se)){m.skippedSegments=se;for(var Oe=se;Oe--;)E.unshift(null);D+=se}var ke=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");ke&&(m.recentlyRemovedDateranges=ke.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(ue);break;case"VERSION":m.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(ue||ie)&&G.tagList.push(ie?[ue,ie]:[ue]);break;case"DIS":I++;case"GAP":G.tagList.push([ce]);break;case"BITRATE":G.tagList.push([ce,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var Te,Ae=new O.AttrList(ue),Le=Ae.enumeratedString("METHOD"),Be=Ae.URI,Fe=Ae.hexadecimalInteger("IV"),De=Ae.enumeratedString("KEYFORMATVERSIONS"),Ne=Ae.enumeratedString("KEYID"),Xe=(Te=Ae.enumeratedString("KEYFORMAT"))!=null?Te:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(Xe)>-1){g.logger.warn("Keyformat "+Xe+" is not supported from the manifest");continue}else if(Xe!=="identity")continue;Le&&(oe=M.LevelKey.fromURL(x,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Le)>=0&&(oe.method=Le,oe.keyFormat=Xe,Ne&&(oe.keyID=Ne),De&&(oe.keyFormatVersions=De),oe.iv=Fe));break}case"START":{var Je=new O.AttrList(ue),$e=Je.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)($e)&&(m.startTimeOffset=$e);break}case"MAP":{var lt=new O.AttrList(ue);G.relurl=lt.URI,lt.BYTERANGE&&G.setByteRange(lt.BYTERANGE),G.level=_,G.sn="initSegment",oe&&(G.levelkey=oe),G.initSegment=null,N=G,pe=!0;break}case"SERVER-CONTROL":{var tt=new O.AttrList(ue);m.canBlockReload=tt.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=tt.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&tt.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=tt.optionalFloat("PART-HOLD-BACK",0),m.holdBack=tt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var it=new O.AttrList(ue);m.partTarget=it.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ue=m.partList;Ue||(Ue=m.partList=[]);var dt=B>0?Ue[Ue.length-1]:void 0,rt=B++,Me=new z.Part(new O.AttrList(ue),G,x,rt,dt);Ue.push(Me),G.duration+=Me.duration;break}case"PRELOAD-HINT":{var ze=new O.AttrList(ue);m.preloadHint=ze;break}case"RENDITION-REPORT":{var Ce=new O.AttrList(ue);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Ce);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}v&&!v.relurl?(E.pop(),j-=v.duration,m.partList&&(m.fragmentHint=v)):m.partList&&(T(G,v),G.cc=I,m.fragmentHint=G);var ve=E.length,Ee=E[0],te=E[ve-1];if(j+=m.skippedSegments*m.targetduration,j>0&&ve&&te){m.averagetargetduration=j/ve;var ne=te.sn;m.endSN=ne!=="initSegment"?ne:0,Ee&&(m.startCC=Ee.cc,Ee.initSegment||m.fragments.every(function(he){return he.relurl&&a(he.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new z.Fragment(o,x),G.relurl=te.relurl,G.level=_,G.sn="initSegment",Ee.initSegment=G,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(j+=m.fragmentHint.duration),m.totalduration=j,m.endCC=I,we>0&&S(E,we),m},R}();function c(R,C){["video","audio","text"].forEach(function(w){var x=R.filter(function(o){return Object(p.isCodecType)(o,w)});if(x.length){var _=x.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});C[w+"Codec"]=_.length>0?_[0]:x[0],R=R.filter(function(o){return x.indexOf(o)===-1})}}),C.unknownCodecs=R}function L(R,C,w){var x=C[w];x&&(R[w]=x)}function S(R,C){for(var w=R[C],x=C;x--;){var _=R[x];if(!_)return;_.programDateTime=w.programDateTime-_.duration*1e3,w=_}}function T(R,C){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):C!=null&&C.programDateTime&&(R.programDateTime=C.endProgramDateTime),Object(Q.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/polyfills/number.ts"),H=P("./src/events.ts"),F=P("./src/errors.ts"),z=P("./src/utils/logger.ts"),W=P("./src/utils/mp4-tools.ts"),M=P("./src/loader/m3u8-parser.ts"),O=P("./src/types/loader.ts"),g=P("./src/utils/attr-list.ts");function p(n){var d=n.type;switch(d){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function f(n,d){var l=n.url;return(l===void 0||l.indexOf("data:")===0)&&(l=d.url),l}var h=function(){function n(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var d=n.prototype;return d.registerListeners=function(){var a=this.hls;a.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(a){var u=this.hls.config,c=u.pLoader,L=u.loader,S=c||L,T=new S(u);return a.loader=T,this.loaders[a.type]=T,T},d.getInternalLoader=function(a){return this.loaders[a.type]},d.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},d.destroyInternalLoaders=function(){for(var a in this.loaders){var u=this.loaders[a];u&&u.destroy(),this.resetInternalLoader(a)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(a,u){var c=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},d.onLevelLoading=function(a,u){var c=u.id,L=u.level,S=u.url,T=u.deliveryDirectives;this.load({id:c,groupId:null,level:L,responseType:"text",type:O.PlaylistContextType.LEVEL,url:S,deliveryDirectives:T})},d.onAudioTrackLoading=function(a,u){var c=u.id,L=u.groupId,S=u.url,T=u.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:T})},d.onSubtitleTrackLoading=function(a,u){var c=u.id,L=u.groupId,S=u.url,T=u.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:T})},d.load=function(a){var u,c=this.hls.config,L=this.getInternalLoader(a);if(L){var S=L.context;if(S&&S.url===a.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var T,R,C,w;switch(a.type){case O.PlaylistContextType.MANIFEST:T=c.manifestLoadingMaxRetry,R=c.manifestLoadingTimeOut,C=c.manifestLoadingRetryDelay,w=c.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:T=0,R=c.levelLoadingTimeOut;break;default:T=c.levelLoadingMaxRetry,R=c.levelLoadingTimeOut,C=c.levelLoadingRetryDelay,w=c.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(u=a.deliveryDirectives)!==null&&u!==void 0&&u.part){var x;if(a.type===O.PlaylistContextType.LEVEL&&a.level!==null?x=this.hls.levels[a.level].details:a.type===O.PlaylistContextType.AUDIO_TRACK&&a.id!==null?x=this.hls.audioTracks[a.id].details:a.type===O.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(x=this.hls.subtitleTracks[a.id].details),x){var _=x.partTarget,o=x.targetduration;_&&o&&(R=Math.min(Math.max(_*3,o*.8)*1e3,R))}}var b={timeout:R,maxRetry:T,retryDelay:C,maxRetryDelay:w,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,b,m)},d.loadsuccess=function(a,u,c,L){if(L===void 0&&(L=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,u,c,L);return}this.resetInternalLoader(c.type);var S=a.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",L);return}u.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,u,c,L):this.handleMasterPlaylist(a,u,c,L)},d.loaderror=function(a,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!1,a)},d.loadtimeout=function(a,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!0)},d.handleMasterPlaylist=function(a,u,c,L){var S=this.hls,T=a.data,R=f(a,c),C=M.default.parseMasterPlaylist(T,R),w=C.levels,x=C.sessionData;if(!w.length){this.handleManifestParsingError(a,c,"no level found in manifest",L);return}var _=w.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),o=w.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),b=M.default.parseMasterPlaylistMedia(T,R,"AUDIO",_),m=M.default.parseMasterPlaylistMedia(T,R,"SUBTITLES",o),E=M.default.parseMasterPlaylistMedia(T,R,"CLOSED-CAPTIONS");if(b.length){var N=b.some(function(D){return!D.url});!N&&w[0].audioCodec&&!w[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}S.trigger(H.Events.MANIFEST_LOADED,{levels:w,audioTracks:b,subtitles:m,captions:E,url:R,stats:u,networkDetails:L,sessionData:x})},d.handleTrackOrLevelPlaylist=function(a,u,c,L){var S=this.hls,T=c.id,R=c.level,C=c.type,w=f(a,c),x=Object(Q.isFiniteNumber)(T)?T:0,_=Object(Q.isFiniteNumber)(R)?R:x,o=p(c),b=M.default.parseLevelPlaylist(a.data,w,_,o,x);if(!b.fragments.length){S.trigger(H.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:w,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(C===O.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:b,name:"",url:w};S.trigger(H.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:w,stats:u,networkDetails:L,sessionData:null})}if(u.parsing.end=performance.now(),b.needSidxRanges){var E,N=(E=b.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:C,level:R,levelDetails:b,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(a,u,c,L)},d.handleSidxRequest=function(a,u){var c=Object(W.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var L=c.references,S=u.levelDetails;L.forEach(function(T,R){var C=T.info,w=S.fragments[R];w.byteRange.length===0&&w.setByteRange(String(1+C.end-C.start)+"@"+String(C.start)),w.initSegment&&w.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(a,u,c,L){this.hls.trigger(H.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===O.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:u,networkDetails:L})},d.handleNetworkError=function(a,u,c,L){c===void 0&&(c=!1),z.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var S=F.ErrorDetails.UNKNOWN,T=!1,R=this.getInternalLoader(a);switch(a.type){case O.PlaylistContextType.MANIFEST:S=c?F.ErrorDetails.MANIFEST_LOAD_TIMEOUT:F.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case O.PlaylistContextType.LEVEL:S=c?F.ErrorDetails.LEVEL_LOAD_TIMEOUT:F.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case O.PlaylistContextType.AUDIO_TRACK:S=c?F.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:S=c?F.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:F.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}R&&this.resetInternalLoader(a.type);var C={type:F.ErrorTypes.NETWORK_ERROR,details:S,fatal:T,url:a.url,loader:R,context:a,networkDetails:u};L&&(C.response=L),this.hls.trigger(H.Events.ERROR,C)},d.handlePlaylistLoaded=function(a,u,c,L){var S=c.type,T=c.level,R=c.id,C=c.groupId,w=c.loader,x=c.levelDetails,_=c.deliveryDirectives;if(!(x!=null&&x.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",L);return}if(!w)return;x.live&&(w.getCacheAge&&(x.ageHeader=w.getCacheAge()||0),(!w.getCacheAge||isNaN(x.ageHeader))&&(x.ageHeader=0));switch(S){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(H.Events.LEVEL_LOADED,{details:x,level:T||0,id:R||0,stats:u,networkDetails:L,deliveryDirectives:_});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(H.Events.AUDIO_TRACK_LOADED,{details:x,id:R||0,groupId:C||"",stats:u,networkDetails:L,deliveryDirectives:_});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADED,{details:x,id:R||0,groupId:C||"",stats:u,networkDetails:L,deliveryDirectives:_});break}},n}();J.default=h},"./src/polyfills/number.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"isFiniteNumber",function(){return Q}),P.d(J,"MAX_SAFE_INTEGER",function(){return H});var Q=Number.isFinite||function(F){return typeof F=="number"&&isFinite(F)},H=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,J,P){"use strict";P.r(J);var Q=function(){function H(){}return H.getSilentFrame=function(z,W){switch(z){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===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(W===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(W===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(W===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(W===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},H}();J.default=Q},"./src/remux/mp4-generator.ts":function(le,J,P){"use strict";P.r(J);var Q=Math.pow(2,32)-1,H=function(){function F(){}return F.init=function(){F.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 W;for(W in F.types)F.types.hasOwnProperty(W)&&(F.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var M=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]),O=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]);F.HDLR_TYPES={video:M,audio:O};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=p,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,f,n,f,h),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,g))},F.box=function(W){for(var M=8,O=arguments.length,g=new Array(O>1?O-1:0),p=1;p<O;p++)g[p-1]=arguments[p];for(var f=g.length,h=f;f--;)M+=g[f].byteLength;var n=new Uint8Array(M);for(n[0]=M>>24&255,n[1]=M>>16&255,n[2]=M>>8&255,n[3]=M&255,n.set(W,4),f=0,M=8;f<h;f++)n.set(g[f],M),M+=g[f].byteLength;return n},F.hdlr=function(W){return F.box(F.types.hdlr,F.HDLR_TYPES[W])},F.mdat=function(W){return F.box(F.types.mdat,W)},F.mdhd=function(W,M){M*=W;var O=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1));return F.box(F.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},F.mdia=function(W){return F.box(F.types.mdia,F.mdhd(W.timescale,W.duration),F.hdlr(W.type),F.minf(W))},F.mfhd=function(W){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},F.minf=function(W){return W.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(W)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(W))},F.moof=function(W,M,O){return F.box(F.types.moof,F.mfhd(W),F.traf(O,M))},F.moov=function(W){for(var M=W.length,O=[];M--;)O[M]=F.trak(W[M]);return F.box.apply(null,[F.types.moov,F.mvhd(W[0].timescale,W[0].duration)].concat(O).concat(F.mvex(W)))},F.mvex=function(W){for(var M=W.length,O=[];M--;)O[M]=F.trex(W[M]);return F.box.apply(null,[F.types.mvex].concat(O))},F.mvhd=function(W,M){M*=W;var O=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,O>>24,O>>16&255,O>>8&255,O&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return F.box(F.types.mvhd,p)},F.sdtp=function(W){var M=W.samples||[],O=new Uint8Array(4+M.length),g,p;for(g=0;g<M.length;g++)p=M[g].flags,O[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return F.box(F.types.sdtp,O)},F.stbl=function(W){return F.box(F.types.stbl,F.stsd(W),F.box(F.types.stts,F.STTS),F.box(F.types.stsc,F.STSC),F.box(F.types.stsz,F.STSZ),F.box(F.types.stco,F.STCO))},F.avc1=function(W){var M=[],O=[],g,p,f;for(g=0;g<W.sps.length;g++)p=W.sps[g],f=p.byteLength,M.push(f>>>8&255),M.push(f&255),M=M.concat(Array.prototype.slice.call(p));for(g=0;g<W.pps.length;g++)p=W.pps[g],f=p.byteLength,O.push(f>>>8&255),O.push(f&255),O=O.concat(Array.prototype.slice.call(p));var h=F.box(F.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|W.sps.length].concat(M).concat([W.pps.length]).concat(O))),n=W.width,d=W.height,l=W.pixelRatio[0],a=W.pixelRatio[1];return F.box(F.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,n>>8&255,n&255,d>>8&255,d&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]),h,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,a>>24,a>>16&255,a>>8&255,a&255])))},F.esds=function(W){var M=W.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(W.config).concat([6,1,2]))},F.mp4a=function(W){var M=W.samplerate;return F.box(F.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),F.box(F.types.esds,F.esds(W)))},F.mp3=function(W){var M=W.samplerate;return F.box(F.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},F.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(W)):F.box(F.types.stsd,F.STSD,F.mp4a(W)):F.box(F.types.stsd,F.STSD,F.avc1(W))},F.tkhd=function(W){var M=W.id,O=W.duration*W.timescale,g=W.width,p=W.height,f=Math.floor(O/(Q+1)),h=Math.floor(O%(Q+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,p>>8&255,p&255,0,0]))},F.traf=function(W,M){var O=F.sdtp(W),g=W.id,p=Math.floor(M/(Q+1)),f=Math.floor(M%(Q+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),F.box(F.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,f>>24,f>>16&255,f>>8&255,f&255])),F.trun(W,O.length+16+20+8+16+8+8),O)},F.trak=function(W){return W.duration=W.duration||4294967295,F.box(F.types.trak,F.tkhd(W),F.mdia(W))},F.trex=function(W){var M=W.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},F.trun=function(W,M){var O=W.samples||[],g=O.length,p=12+16*g,f=new Uint8Array(p),h,n,d,l,a,u;for(M+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),h=0;h<g;h++)n=O[h],d=n.duration,l=n.size,a=n.flags,u=n.cts,f.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*h);return F.box(F.types.trun,f)},F.initSegment=function(W){F.types||F.init();var M=F.moov(W),O=new Uint8Array(F.FTYP.byteLength+M.byteLength);return O.set(F.FTYP),O.set(M,F.FTYP.byteLength),O},F}();H.types=void 0,H.HDLR_TYPES=void 0,H.STTS=void 0,H.STSC=void 0,H.STCO=void 0,H.STSZ=void 0,H.VMHD=void 0,H.SMHD=void 0,H.STSD=void 0,H.FTYP=void 0,H.DINF=void 0,J.default=H},"./src/remux/mp4-remuxer.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return u}),P.d(J,"normalizePts",function(){return c});var Q=P("./src/polyfills/number.ts"),H=P("./src/remux/aac-helper.ts"),F=P("./src/remux/mp4-generator.ts"),z=P("./src/events.ts"),W=P("./src/errors.ts"),M=P("./src/utils/logger.ts"),O=P("./src/types/loader.ts"),g=P("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(R){for(var C=1;C<arguments.length;C++){var w=arguments[C];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(R[x]=w[x])}return R},p.apply(this,arguments)}var f=10*1e3,h=1024,n=1152,d=null,l=null,a=!1,u=function(){function R(w,x,_,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=w,this.config=x,this.typeSupported=_,this.ISGenerated=!1,d===null){var b=navigator.userAgent||"",m=b.match(/Chrome\/(\d+)/i);d=m?parseInt(m[1]):0}if(l===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);l=E?parseInt(E[1]):0}a=!!d&&d<75||!!l&&l<600}var C=R.prototype;return C.destroy=function(){},C.resetTimeStamp=function(x){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=x},C.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(x){var _=!1,o=x.reduce(function(b,m){var E=m.pts-b;return E<-4294967296?(_=!0,c(b,m.pts)):E>0?b:m.pts},x[0].pts);return _&&M.logger.debug("PTS rollover detected"),o},C.remux=function(x,_,o,b,m,E,N,D){var B,j,I,v,G,Y,re=m,oe=m,we=x.pid>-1,pe=_.pid>-1,xe=_.samples.length,_e=x.samples.length>0,Se=xe>1,ce=(!we||_e)&&(!pe||Se)||this.ISGenerated||N;if(ce){this.ISGenerated||(I=this.generateIS(x,_,m));var ue=this.isVideoContiguous,ie=-1;if(Se&&(ie=L(_.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,ie>0){M.logger.warn("[mp4-remuxer]: Dropped "+ie+" out of "+xe+" video samples due to a missing keyframe");var de=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(ie),_.dropped+=ie,oe+=(_.samples[0].pts-de)/(_.timescale||9e4)}else ie===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+xe+" video samples"),Y=!1);if(this.ISGenerated){if(_e&&Se){var se=this.getVideoStartPts(_.samples),Oe=c(x.samples[0].pts,se)-se,ke=Oe/_.inputTimeScale;re+=Math.max(0,ke),oe+=Math.max(0,-ke)}if(_e){if(x.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(x,_,m)),j=this.remuxAudio(x,re,this.isAudioContiguous,E,pe||Se||D===O.PlaylistLevelType.AUDIO?oe:void 0),Se){var Te=j?j.endPTS-j.startPTS:0;_.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(x,_,m)),B=this.remuxVideo(_,oe,ue,Te)}}else Se&&(B=this.remuxVideo(_,oe,ue,0));B&&(B.firstKeyFrame=ie,B.independent=ie!==-1)}}return this.ISGenerated&&(o.samples.length&&(G=this.remuxID3(o,m)),b.samples.length&&(v=this.remuxText(b,m))),{audio:j,video:B,initSegment:I,independent:Y,text:v,id3:G}},C.generateIS=function(x,_,o){var b=x.samples,m=_.samples,E=this.typeSupported,N={},D=!Object(Q.isFiniteNumber)(this._initPTS),B="audio/mp4",j,I,v;if(D&&(j=I=Infinity),x.config&&b.length&&(x.timescale=x.samplerate,x.isAAC||(E.mpeg?(B="audio/mpeg",x.codec=""):E.mp3&&(x.codec="mp3")),N.audio={id:"audio",container:B,codec:x.codec,initSegment:!x.isAAC&&E.mpeg?new Uint8Array(0):F.default.initSegment([x]),metadata:{channelCount:x.channelCount}},D&&(v=x.inputTimeScale,j=I=b[0].pts-Math.round(v*o))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:F.default.initSegment([_]),metadata:{width:_.width,height:_.height}},D)){v=_.inputTimeScale;var G=this.getVideoStartPts(m),Y=Math.round(v*o);I=Math.min(I,c(m[0].dts,G)-Y),j=Math.min(j,G-Y)}if(Object.keys(N).length)return this.ISGenerated=!0,D&&(this._initPTS=j,this._initDTS=I),{tracks:N,initPTS:j,timescale:v}},C.remuxVideo=function(x,_,o,b){var m=x.inputTimeScale,E=x.samples,N=[],D=E.length,B=this._initPTS,j=this.nextAvcDts,I=8,v,G,Y,re=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,we=0,pe=!1;if(!o||j===null){var xe=_*m,_e=E[0].pts-c(E[0].dts,E[0].pts);j=xe-_e}for(var Se=0;Se<D;Se++){var ce=E[Se];if(ce.pts=c(ce.pts-B,j),ce.dts=c(ce.dts-B,j),ce.dts>ce.pts){var ue=9e4*.2;we=Math.max(Math.min(we,ce.pts-ce.dts),-1*ue)}ce.dts<E[Se>0?Se-1:Se].dts&&(pe=!0)}pe&&E.sort(function(Ct,xt){var ut=Ct.dts-xt.dts,Ut=Ct.pts-xt.pts;return ut||Ut}),G=E[0].dts,Y=E[E.length-1].dts;var ie=Math.round((Y-G)/(D-1));if(we<0){if(we<ie*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-ie,!0)+" ms");for(var de=we,se=0;se<D;se++)E[se].dts=de=Math.max(de,E[se].pts-ie),E[se].pts=Math.max(de,E[se].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(we,!0)+" ms to overcome this issue");for(var Oe=0;Oe<D;Oe++)E[Oe].dts=E[Oe].dts+we}G=E[0].dts}if(o){var ke=G-j,Te=ke>ie,Ae=ke<-1;if(Te||Ae){Te?M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),G=j;var Le=E[0].pts-ke;E[0].dts=G,E[0].pts=Le,M.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Le,!0)+"/"+Object(g.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms")}}a&&(G=Math.max(0,G));for(var Be=0,Fe=0,De=0;De<D;De++){for(var Ne=E[De],Xe=Ne.units,Ze=Xe.length,Je=0,$e=0;$e<Ze;$e++)Je+=Xe[$e].data.length;Fe+=Je,Be+=Ze,Ne.length=Je,Ne.dts=Math.max(Ne.dts,G),Ne.pts=Math.max(Ne.pts,Ne.dts,0),re=Math.min(Ne.pts,re),oe=Math.max(Ne.pts,oe)}Y=E[D-1].dts;var lt=Fe+4*Be+8,tt;try{tt=new Uint8Array(lt)}catch(Ct){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:lt,reason:"fail allocating video mdat "+lt});return}var it=new DataView(tt.buffer);it.setUint32(0,lt),tt.set(F.default.types.mdat,4);for(var Ue=0;Ue<D;Ue++){for(var dt=E[Ue],rt=dt.units,Me=0,ze=0,Ce=rt.length;ze<Ce;ze++){var ve=rt[ze],Ee=ve.data,te=ve.data.byteLength;it.setUint32(I,te),I+=4,tt.set(Ee,I),I+=te,Me+=4+te}if(Ue<D-1)v=E[Ue+1].dts-dt.dts;else{var ne=this.config,he=dt.dts-E[Ue>0?Ue-1:Ue].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(ne.maxBufferHole*m),be=(b?re+b*m:this.nextAudioPts)-dt.pts;be>me?(v=be-he,v<0&&(v=he),M.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=he}else v=he}var Pe=Math.round(dt.pts-dt.dts);N.push(new S(dt.key,v,Me,Pe))}if(N.length&&d&&d<70){var We=N[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(v!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Y+v,this.isVideoContiguous=!0;var st=F.default.moof(x.sequenceNumber++,G,p({},x,{samples:N})),ft="video",pt={data1:st,data2:tt,startPTS:re/m,endPTS:(oe+v)/m,startDTS:G/m,endDTS:j/m,type:ft,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:x.dropped};return x.samples=[],x.dropped=0,console.assert(tt.length,"MDAT length must not be zero"),pt},C.remuxAudio=function(x,_,o,b,m){var E=x.inputTimeScale,N=x.samplerate?x.samplerate:E,D=E/N,B=x.isAAC?h:n,j=B*D,I=this._initPTS,v=!x.isAAC&&this.typeSupported.mpeg,G=[],Y=x.samples,re=v?0:8,oe=this.nextAudioPts||-1,we=_*E;if(this.isAudioContiguous=o=o||Y.length&&oe>0&&(b&&Math.abs(we-oe)<9e3||Math.abs(c(Y[0].pts-I,we)-oe)<20*j),Y.forEach(function(Ee){Ee.pts=c(Ee.pts-I,we)}),!o||oe<0){if(Y=Y.filter(function(Ee){return Ee.pts>=0}),!Y.length)return;m===0?oe=0:b?oe=Math.max(0,we):oe=Y[0].pts}if(x.isAAC)for(var pe=m!==void 0,xe=this.config.maxAudioFramesDrift,_e=0,Se=oe;_e<Y.length;_e++){var ce=Y[_e],ue=ce.pts,ie=ue-Se,de=Math.abs(1e3*ie/E);if(ie<=-xe*j&&pe)_e===0&&(M.logger.warn("Audio frame @ "+(ue/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ie/E)+" ms."),this.nextAudioPts=oe=Se=ue);else if(ie>=xe*j&&de<f&&pe){var se=Math.round(ie/j);Se=ue-se*j,Se<0&&(se--,Se+=j),_e===0&&(this.nextAudioPts=oe=Se),M.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Se/E).toFixed(3)+"s due to "+Math.round(1e3*ie/E)+" ms gap.");for(var Oe=0;Oe<se;Oe++){var ke=Math.max(Se,0),Te=H.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);Te||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Te=ce.unit.subarray()),Y.splice(_e,0,{unit:Te,pts:ke}),Se+=j,_e++}}ce.pts=Se,Se+=j}for(var Ae=null,Le=null,Be,Fe=0,De=Y.length;De--;)Fe+=Y[De].unit.byteLength;for(var Ne=0,Xe=Y.length;Ne<Xe;Ne++){var Ze=Y[Ne],Je=Ze.unit,$e=Ze.pts;if(Le!==null){var lt=G[Ne-1];lt.duration=Math.round(($e-Le)/D)}else if(o&&x.isAAC&&($e=oe),Ae=$e,Fe>0){Fe+=re;try{Be=new Uint8Array(Fe)}catch(Ee){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!v){var tt=new DataView(Be.buffer);tt.setUint32(0,Fe),Be.set(F.default.types.mdat,4)}}else return;Be.set(Je,re);var it=Je.byteLength;re+=it,G.push(new S(!0,B,it,0)),Le=$e}var Ue=G.length;if(!Ue)return;var dt=G[G.length-1];this.nextAudioPts=oe=Le+D*dt.duration;var rt=v?new Uint8Array(0):F.default.moof(x.sequenceNumber++,Ae/D,p({},x,{samples:G}));x.samples=[];var Me=Ae/E,ze=oe/E,Ce="audio",ve={data1:rt,data2:Be,startPTS:Me,endPTS:ze,startDTS:Me,endDTS:ze,type:Ce,hasAudio:!0,hasVideo:!1,nb:Ue};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),ve},C.remuxEmptyAudio=function(x,_,o,b){var m=x.inputTimeScale,E=x.samplerate?x.samplerate:m,N=m/E,D=this.nextAudioPts,B=(D!==null?D:b.startDTS*m)+this._initDTS,j=b.endDTS*m+this._initDTS,I=N*h,v=Math.ceil((j-B)/I),G=H.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],re=0;re<v;re++){var oe=B+re*I;Y.push({unit:G,pts:oe,dts:oe})}return x.samples=Y,this.remuxAudio(x,_,o,!1)},C.remuxID3=function(x,_){var o=x.samples.length;if(!o)return;for(var b=x.inputTimeScale,m=this._initPTS,E=this._initDTS,N=0;N<o;N++){var D=x.samples[N];D.pts=c(D.pts-m,_*b)/b,D.dts=c(D.dts-E,_*b)/b}var B=x.samples;return x.samples=[],{samples:B}},C.remuxText=function(x,_){var o=x.samples.length;if(!o)return;for(var b=x.inputTimeScale,m=this._initPTS,E=0;E<o;E++){var N=x.samples[E];N.pts=c(N.pts-m,_*b)/b}x.samples.sort(function(B,j){return B.pts-j.pts});var D=x.samples;return x.samples=[],{samples:D}},R}();function c(R,C){var w;if(C===null)return R;for(C<R?w=-8589934592:w=8589934592;Math.abs(R-C)>4294967296;)R+=w;return R}function L(R){for(var C=0;C<R.length;C++)if(R[C].key)return C;return-1}var S=function(C,w,x,_){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=w,this.size=x,this.cts=_,this.flags=new T(C)},T=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?0:1}},"./src/remux/passthrough-remuxer.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/mp4-tools.ts"),F=P("./src/loader/fragment.ts"),z=P("./src/utils/logger.ts"),W=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=g.prototype;return p.destroy=function(){},p.resetTimeStamp=function(h){this.initPTS=h,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(h,n,d){this.audioCodec=n,this.videoCodec=d,this.generateInitSegment(h),this.emitInitSegment=!0},p.generateInitSegment=function(h){var n=this.audioCodec,d=this.videoCodec;if(!h||!h.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(H.parseInitSegment)(h);n||(n=O(l.audio,F.ElementaryStreamTypes.AUDIO)),d||(d=O(l.video,F.ElementaryStreamTypes.VIDEO));var a={};l.audio&&l.video?a.audiovideo={container:"video/mp4",codec:n+","+d,initSegment:h,id:"main"}:l.audio?a.audio={container:"audio/mp4",codec:n,initSegment:h,id:"audio"}:l.video?a.video={container:"video/mp4",codec:d,initSegment:h,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(h,n,d,l,a){var u=this.initPTS,c=this.lastEndDTS,L={audio:void 0,video:void 0,text:l,id3:d,initSegment:void 0};Object(Q.isFiniteNumber)(c)||(c=this.lastEndDTS=a||0);var S=n.samples;if(!S||!S.length)return L;var T={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(S),R=this.initData),!R||!R.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(u)||(this.initPTS=T.initPTS=u=M(R,S,c));var C=Object(H.getDuration)(S,R),w=c,x=C+w;Object(H.offsetStartDTS)(R,S,u),C>0?this.lastEndDTS=x:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!R.audio,o=!!R.video,b="";_&&(b+="audio"),o&&(b+="video");var m={data1:S,startPTS:w,startDTS:w,endPTS:x,endDTS:x,type:b,hasAudio:_,hasVideo:o,nb:1,dropped:0};return L.audio=m.type==="audio"?m:void 0,L.video=m.type!=="audio"?m:void 0,L.text=l,L.id3=d,L.initSegment=T,L},g}(),M=function(p,f,h){return Object(H.getStartDTS)(p,f)-h};function O(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===F.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=W},"./src/task-loop.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return Q});var Q=function(){function H(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var F=H.prototype;return F.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},F.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},F.onHandlerDestroyed=function(){},F.hasInterval=function(){return!!this._tickInterval},F.hasNextTick=function(){return!!this._tickTimer},F.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},F.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},F.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},F.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},F.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},F.doTick=function(){},H}()},"./src/types/cmcd.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"CMCDVersion",function(){return Q}),P.d(J,"CMCDObjectType",function(){return H}),P.d(J,"CMCDStreamingFormat",function(){return F}),P.d(J,"CMCDStreamType",function(){return z});var Q=1,H;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(H||(H={}));var F;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(F||(F={}));var z;(function(W){W.VOD="v",W.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"HlsSkip",function(){return F}),P.d(J,"getSkipValue",function(){return z}),P.d(J,"HlsUrlParameters",function(){return W}),P.d(J,"Level",function(){return M});function Q(O,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(O,f.key,f)}}function H(O,g,p){return g&&Q(O.prototype,g),p&&Q(O,p),O}var F;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(F||(F={}));function z(O,g){var p=O.canSkipUntil,f=O.canSkipDateRanges,h=O.endSN,n=g!==void 0?g-h:0;return p&&n<p?f?F.v2:F.Yes:F.No}var W=function(){function O(p,f,h){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=f,this.skip=h}var g=O.prototype;return g.addDirectives=function(f){var h=new self.URL(f);return this.msn!==void 0&&h.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&h.searchParams.set("_HLS_part",this.part.toString()),this.skip&&h.searchParams.set("_HLS_skip",this.skip),h.toString()},O}(),M=function(){function O(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return H(O,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(p){var f=p%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),O}()},"./src/types/loader.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"PlaylistContextType",function(){return Q}),P.d(J,"PlaylistLevelType",function(){return H});var Q;(function(F){F.MANIFEST="manifest",F.LEVEL="level",F.AUDIO_TRACK="audioTrack",F.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var H;(function(F){F.MAIN="main",F.AUDIO="audio",F.SUBTITLE="subtitle"})(H||(H={}))},"./src/types/transmuxer.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"ChunkMetadata",function(){return Q});var Q=function(z,W,M,O,g,p){O===void 0&&(O=0),g===void 0&&(g=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=H(),this.buffering={audio:H(),video:H(),audiovideo:H()},this.level=z,this.sn=W,this.id=M,this.size=O,this.part=g,this.partial=p};function H(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"AttrList",function(){return F});var Q=/^(\d+)x(\d+)$/,H=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,F=function(){function z(M){typeof M=="string"&&(M=z.parseAttrList(M));for(var O in M)M.hasOwnProperty(O)&&(this[O]=M[O])}var W=z.prototype;return W.decimalInteger=function(O){var g=parseInt(this[O],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},W.hexadecimalInteger=function(O){if(this[O]){var g=(this[O]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;f<g.length/2;f++)p[f]=parseInt(g.slice(f*2,f*2+2),16);return p}else return null},W.hexadecimalIntegerAsNumber=function(O){var g=parseInt(this[O],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},W.decimalFloatingPoint=function(O){return parseFloat(this[O])},W.optionalFloat=function(O,g){var p=this[O];return p?parseFloat(p):g},W.enumeratedString=function(O){return this[O]},W.bool=function(O){return this[O]==="YES"},W.decimalResolution=function(O){var g=Q.exec(this[O]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},z.parseAttrList=function(O){var g,p={},f='"';for(H.lastIndex=0;(g=H.exec(O))!==null;){var h=g[2];h.indexOf(f)===0&&h.lastIndexOf(f)===h.length-1&&(h=h.slice(1,-1)),p[g[1]]=h}return p},z}()},"./src/utils/binary-search.ts":function(le,J,P){"use strict";P.r(J);var Q={search:function(F,z){for(var W=0,M=F.length-1,O=null,g=null;W<=M;){O=(W+M)/2|0,g=F[O];var p=z(g);if(p>0)W=O+1;else if(p<0)M=O-1;else return g}return null}};J.default=Q},"./src/utils/buffer-helper.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"BufferHelper",function(){return F});var Q=P("./src/utils/logger.ts"),H={length:0,start:function(){return 0},end:function(){return 0}},F=function(){function z(){}return z.isBuffered=function(M,O){try{if(M){for(var g=z.getBuffered(M),p=0;p<g.length;p++)if(O>=g.start(p)&&O<=g.end(p))return!0}}catch(f){}return!1},z.bufferInfo=function(M,O,g){try{if(M){var p=z.getBuffered(M),f=[],h;for(h=0;h<p.length;h++)f.push({start:p.start(h),end:p.end(h)});return this.bufferedInfo(f,O,g)}}catch(n){}return{len:0,start:O,end:O,nextStart:void 0}},z.bufferedInfo=function(M,O,g){O=Math.max(0,O),M.sort(function(T,R){var C=T.start-R.start;return C||R.end-T.end});var p=[];if(g)for(var f=0;f<M.length;f++){var h=p.length;if(h){var n=p[h-1].end;M[f].start-n<g?M[f].end>n&&(p[h-1].end=M[f].end):p.push(M[f])}else p.push(M[f])}else p=M;for(var d=0,l,a=O,u=O,c=0;c<p.length;c++){var L=p[c].start,S=p[c].end;if(O+g>=L&&O<S)a=L,u=S,d=u-O;else if(O+g<L){l=L;break}}return{len:d,start:a||0,end:u||0,nextStart:l}},z.getBuffered=function(M){try{return M.buffered}catch(O){return Q.logger.log("failed to get media.buffered",O),H}},z}()},"./src/utils/cea-608-parser.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"Row",function(){return u}),P.d(J,"CaptionScreen",function(){return c});var Q=P("./src/utils/logger.ts"),H={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},F=function(x){var _=x;return H.hasOwnProperty(x)&&(_=H[x]),String.fromCharCode(_)},z=15,W=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h;(function(w){w[w.ERROR=0]="ERROR",w[w.TEXT=1]="TEXT",w[w.WARNING=2]="WARNING",w[w.INFO=2]="INFO",w[w.DEBUG=3]="DEBUG",w[w.DATA=3]="DATA"})(h||(h={}));var n=function(){function w(){this.time=null,this.verboseLevel=h.ERROR}var x=w.prototype;return x.log=function(o,b){this.verboseLevel>=o&&Q.logger.log(this.time+" ["+o+"] "+b)},w}(),d=function(x){for(var _=[],o=0;o<x.length;o++)_.push(x[o].toString(16));return _},l=function(){function w(_,o,b,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=_||"white",this.underline=o||!1,this.italics=b||!1,this.background=m||"black",this.flash=E||!1}var x=w.prototype;return x.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},x.setStyles=function(o){for(var b=["foreground","underline","italics","background","flash"],m=0;m<b.length;m++){var E=b[m];o.hasOwnProperty(E)&&(this[E]=o[E])}},x.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},x.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},x.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},x.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},w}(),a=function(){function w(_,o,b,m,E,N){this.uchar=void 0,this.penState=void 0,this.uchar=_||" ",this.penState=new l(o,b,m,E,N)}var x=w.prototype;return x.reset=function(){this.uchar=" ",this.penState.reset()},x.setChar=function(o,b){this.uchar=o,this.penState.copy(b)},x.setPenState=function(o){this.penState.copy(o)},x.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},x.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},x.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},w}(),u=function(){function w(_){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<W;o++)this.chars.push(new a);this.logger=_,this.pos=0,this.currPenState=new l}var x=w.prototype;return x.equals=function(o){for(var b=!0,m=0;m<W;m++)if(!this.chars[m].equals(o.chars[m])){b=!1;break}return b},x.copy=function(o){for(var b=0;b<W;b++)this.chars[b].copy(o.chars[b])},x.isEmpty=function(){for(var o=!0,b=0;b<W;b++)if(!this.chars[b].isEmpty()){o=!1;break}return o},x.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(h.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},x.moveCursor=function(o){var b=this.pos+o;if(o>1)for(var m=this.pos+1;m<b+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(b)},x.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},x.insertChar=function(o){o>=144&&this.backSpace();var b=F(o);if(this.pos>=W){this.logger.log(h.ERROR,"Cannot insert "+o.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},x.clearFromPos=function(o){var b;for(b=o;b<W;b++)this.chars[b].reset()},x.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},x.clearToEndOfRow=function(){this.clearFromPos(this.pos)},x.getTextString=function(){for(var o=[],b=!0,m=0;m<W;m++){var E=this.chars[m].uchar;E!==" "&&(b=!1),o.push(E)}return b?"":o.join("")},x.setPenStyles=function(o){this.currPenState.setStyles(o);var b=this.chars[this.pos];b.setPenState(this.currPenState)},w}(),c=function(){function w(_){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<z;o++)this.rows.push(new u(_));this.logger=_,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var x=w.prototype;return x.reset=function(){for(var o=0;o<z;o++)this.rows[o].clear();this.currRow=z-1},x.equals=function(o){for(var b=!0,m=0;m<z;m++)if(!this.rows[m].equals(o.rows[m])){b=!1;break}return b},x.copy=function(o){for(var b=0;b<z;b++)this.rows[b].copy(o.rows[b])},x.isEmpty=function(){for(var o=!0,b=0;b<z;b++)if(!this.rows[b].isEmpty()){o=!1;break}return o},x.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},x.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},x.insertChar=function(o){var b=this.rows[this.currRow];b.insertChar(o)},x.setPen=function(o){var b=this.rows[this.currRow];b.setPenStyles(o)},x.moveCursor=function(o){var b=this.rows[this.currRow];b.moveCursor(o)},x.setCursor=function(o){this.logger.log(h.INFO,"setCursor: "+o);var b=this.rows[this.currRow];b.setCursor(o)},x.setPAC=function(o){this.logger.log(h.INFO,"pacData = "+JSON.stringify(o));var b=o.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var m=0;m<z;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var D=N.rows[E].cueStartTime,B=this.logger.time;if(D&&B!==null&&D<B)for(var j=0;j<this.nrRollUpRows;j++)this.rows[b-this.nrRollUpRows+j+1].copy(N.rows[E+j])}}this.currRow=b;var I=this.rows[this.currRow];if(o.indent!==null){var v=o.indent,G=Math.max(v-1,0);I.setCursor(o.indent),o.color=I.chars[G].penState.foreground}var Y={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(Y)},x.setBkgData=function(o){this.logger.log(h.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},x.setRollUpRows=function(o){this.nrRollUpRows=o},x.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(h.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(h.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(o,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(h.INFO,"Rolling up")},x.getDisplayText=function(o){o=o||!1;for(var b=[],m="",E=-1,N=0;N<z;N++){var D=this.rows[N].getTextString();D&&(E=N+1,o?b.push("Row "+E+": '"+D+"'"):b.push(D.trim()))}return b.length>0&&(o?m="["+b.join(" | ")+"]":m=b.join(`
`)),m},x.getTextAndFormat=function(){return this.rows},w}(),L=function(){function w(_,o,b){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=_,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new c(b),this.nonDisplayedMemory=new c(b),this.lastOutputScreen=new c(b),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var x=w.prototype;return x.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},x.getHandler=function(){return this.outputFilter},x.setHandler=function(o){this.outputFilter=o},x.setPAC=function(o){this.writeScreen.setPAC(o)},x.setBkgData=function(o){this.writeScreen.setBkgData(o)},x.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(h.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},x.insertChars=function(o){for(var b=0;b<o.length;b++)this.writeScreen.insertChar(o[b]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(h.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(h.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},x.ccRCL=function(){this.logger.log(h.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},x.ccBS=function(){if(this.logger.log(h.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},x.ccAOF=function(){},x.ccAON=function(){},x.ccDER=function(){this.logger.log(h.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},x.ccRU=function(o){this.logger.log(h.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},x.ccFON=function(){this.logger.log(h.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},x.ccRDC=function(){this.logger.log(h.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},x.ccTR=function(){this.logger.log(h.INFO,"TR"),this.setMode("MODE_TEXT")},x.ccRTD=function(){this.logger.log(h.INFO,"RTD"),this.setMode("MODE_TEXT")},x.ccEDM=function(){this.logger.log(h.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},x.ccCR=function(){this.logger.log(h.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},x.ccENM=function(){this.logger.log(h.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},x.ccEOC=function(){if(this.logger.log(h.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(h.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},x.ccTO=function(o){this.logger.log(h.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},x.ccMIDROW=function(o){var b={flash:!1};if(b.underline=o%2===1,b.italics=o>=46,b.italics)b.foreground="white";else{var m=Math.floor(o/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=E[m]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},x.outputDataUpdate=function(o){o===void 0&&(o=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},x.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},w}(),S=function(){function w(_,o,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new n;this.channels=[null,new L(_,o,m),new L(_+1,b,m)],this.cmdHistory=C(),this.logger=m}var x=w.prototype;return x.getHandler=function(o){return this.channels[o].getHandler()},x.setHandler=function(o,b){this.channels[o].setHandler(b)},x.addData=function(o,b){var m,E,N,D=!1;this.logger.time=o;for(var B=0;B<b.length;B+=2){if(E=b[B]&127,N=b[B+1]&127,E===0&&N===0)continue;if(this.logger.log(h.DATA,"["+d([b[B],b[B+1]])+"] -> ("+d([E,N])+")"),m=this.parseCmd(E,N),m||(m=this.parseMidrow(E,N)),m||(m=this.parsePAC(E,N)),m||(m=this.parseBackgroundAttributes(E,N)),!m&&(D=this.parseChars(E,N),D)){var j=this.currentChannel;if(j&&j>0){var I=this.channels[j];I.insertChars(D)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!D&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+d([E,N])+" orig: "+d([b[B],b[B+1]]))}},x.parseCmd=function(o,b){var m=this.cmdHistory,E=(o===20||o===28||o===21||o===29)&&b>=32&&b<=47,N=(o===23||o===31)&&b>=33&&b<=35;if(!(E||N))return!1;if(R(o,b,m))return T(null,null,m),this.logger.log(h.DEBUG,"Repeated command ("+d([o,b])+") is dropped"),!0;var D=o===20||o===21||o===23?1:2,B=this.channels[D];return o===20||o===21||o===28||o===29?b===32?B.ccRCL():b===33?B.ccBS():b===34?B.ccAOF():b===35?B.ccAON():b===36?B.ccDER():b===37?B.ccRU(2):b===38?B.ccRU(3):b===39?B.ccRU(4):b===40?B.ccFON():b===41?B.ccRDC():b===42?B.ccTR():b===43?B.ccRTD():b===44?B.ccEDM():b===45?B.ccCR():b===46?B.ccENM():b===47&&B.ccEOC():B.ccTO(b-32),T(o,b,m),this.currentChannel=D,!0},x.parseMidrow=function(o,b){var m=0;if((o===17||o===25)&&b>=32&&b<=47){if(o===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(b),this.logger.log(h.DEBUG,"MIDROW ("+d([o,b])+")"),!0):!1}return!1},x.parsePAC=function(o,b){var m,E=this.cmdHistory,N=(o>=17&&o<=23||o>=25&&o<=31)&&b>=64&&b<=127,D=(o===16||o===24)&&b>=64&&b<=95;if(!(N||D))return!1;if(R(o,b,E))return T(null,null,E),!0;var B=o<=23?1:2;b>=64&&b<=95?m=B===1?M[o]:g[o]:m=B===1?O[o]:p[o];var j=this.channels[B];return j?(j.setPAC(this.interpretPAC(m,b)),T(o,b,E),this.currentChannel=B,!0):!1},x.interpretPAC=function(o,b){var m,E={color:null,italics:!1,indent:null,underline:!1,row:o};return b>95?m=b-96:m=b-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},x.parseChars=function(o,b){var m,E=null,N=null;if(o>=25?(m=2,N=o-8):(m=1,N=o),N>=17&&N<=19){var D;N===17?D=b+80:N===18?D=b+112:D=b+144,this.logger.log(h.INFO,"Special char '"+F(D)+"' in channel "+m),E=[D]}else o>=32&&o<=127&&(E=b===0?[o]:[o,b]);if(E){var B=d(E);this.logger.log(h.DEBUG,"Char codes = "+B.join(",")),T(o,b,this.cmdHistory)}return E},x.parseBackgroundAttributes=function(o,b){var m=(o===16||o===24)&&b>=32&&b<=47,E=(o===23||o===31)&&b>=45&&b<=47;if(!(m||E))return!1;var N,D={};o===16||o===24?(N=Math.floor((b-32)/2),D.background=f[N],b%2===1&&(D.background=D.background+"_semi")):b===45?D.background="transparent":(D.foreground="black",b===47&&(D.underline=!0));var B=o<=23?1:2,j=this.channels[B];return j.setBkgData(D),T(o,b,this.cmdHistory),!0},x.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var b=this.channels[o];b&&b.reset()}this.cmdHistory=C()},x.cueSplitAtTime=function(o){for(var b=0;b<this.channels.length;b++){var m=this.channels[b];m&&m.cueSplitAtTime(o)}},w}();function T(w,x,_){_.a=w,_.b=x}function R(w,x,_){return _.a===w&&_.b===x}function C(){return{a:null,b:null}}J.default=S},"./src/utils/codecs.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"isCodecType",function(){return H}),P.d(J,"isCodecSupportedInMp4",function(){return F});var Q={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 H(z,W){var M=Q[W];return!!M&&M[z.slice(0,4)]===!0}function F(z,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/utils/vttparser.ts"),H=P("./src/utils/webvtt-parser.ts"),F=P("./src/utils/texttrack-utils.ts"),z=/\s/,W={newCue:function(O,g,p,f){for(var h=[],n,d,l,a,u,c=self.VTTCue||self.TextTrackCue,L=0;L<f.rows.length;L++)if(n=f.rows[L],l=!0,a=0,u="",!n.isEmpty()){for(var S=0;S<n.chars.length;S++)z.test(n.chars[S].uchar)&&l?a++:(u+=n.chars[S].uchar,l=!1);n.cueStartTime=g,g===p&&(p+=1e-4),a>=16?a--:a++;var T=Object(Q.fixLineBreaks)(u.trim()),R=Object(H.generateCueId)(g,p,T);(!O||!O.cues||!O.cues.getCueById(R))&&(d=new c(g,p,T),d.id=R,d.line=L+1,d.align="left",d.position=10+Math.min(80,Math.floor(a*8/32)*10),h.push(d))}return O&&h.length&&(h.sort(function(C,w){return C.line==="auto"||w.line==="auto"?0:C.line>8&&w.line>8?w.line-C.line:C.line-w.line}),h.forEach(function(C){return Object(F.addCueToTrack)(O,C)})),h}};J.default=W},"./src/utils/discontinuities.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"findFirstFragWithCC",function(){return z}),P.d(J,"shouldAlignOnDiscontinuities",function(){return W}),P.d(J,"findDiscontinuousReferenceFrag",function(){return M}),P.d(J,"adjustSlidingStart",function(){return g}),P.d(J,"alignStream",function(){return p}),P.d(J,"alignPDT",function(){return h}),P.d(J,"alignFragmentByPDTDelta",function(){return n}),P.d(J,"alignMediaPlaylistByPDT",function(){return d});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/logger.ts"),F=P("./src/controller/level-helper.ts");function z(l,a){for(var u=null,c=0,L=l.length;c<L;c++){var S=l[c];if(S&&S.cc===a){u=S;break}}return u}function W(l,a,u){return!!(a.details&&(u.endCC>u.startCC||l&&l.cc<u.startCC))}function M(l,a){var u=l.fragments,c=a.fragments;if(!c.length||!u.length){H.logger.log("No fragments to align");return}var L=z(u,c[0].cc);if(!L||L&&!L.startPTS){H.logger.log("No frag in previous level to align on");return}return L}function O(l,a){if(l){var u=l.start+a;l.start=l.startPTS=u,l.endPTS=u+l.duration}}function g(l,a){for(var u=a.fragments,c=0,L=u.length;c<L;c++)O(u[c],l);a.fragmentHint&&O(a.fragmentHint,l),a.alignedSliding=!0}function p(l,a,u){if(!a)return;f(l,u,a),!u.alignedSliding&&a.details&&h(u,a.details),!u.alignedSliding&&a.details&&!u.skippedSegments&&Object(F.adjustSliding)(a.details,u)}function f(l,a,u){if(W(l,u,a)){var c=M(u.details,a);c&&Object(Q.isFiniteNumber)(c.start)&&(H.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(c.start,a))}}function h(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var u=a.fragments[0].programDateTime,c=l.fragments[0].programDateTime,L=(c-u)/1e3+a.fragments[0].start;L&&Object(Q.isFiniteNumber)(L)&&(H.logger.log("Adjusting PTS using programDateTime delta "+(c-u)+"ms, sliding:"+L.toFixed(3)+" "+l.url+" "),g(L,l))}function n(l,a){var u=l.programDateTime;if(!u)return;var c=(u-a)/1e3;l.start=l.startPTS=c,l.endPTS=c+l.duration}function d(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var u=a.fragments[0].programDateTime,c=a.fragments[0].start,L=u-c*1e3;l.fragments.forEach(function(S){n(S,L)}),l.fragmentHint&&n(l.fragmentHint,L),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/utils/ewma.ts"),H=function(){function F(W,M,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(W),this.fast_=new Q.default(M)}var z=F.prototype;return z.update=function(M,O){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new Q.default(M,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new Q.default(O,p.getEstimate(),p.getTotalWeight()))},z.sample=function(M,O){M=Math.max(M,this.minDelayMs_);var g=8*O,p=M/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},z.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},F}();J.default=H},"./src/utils/ewma.ts":function(le,J,P){"use strict";P.r(J);var Q=function(){function H(z,W,M){W===void 0&&(W=0),M===void 0&&(M=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_=W,this.totalWeight_=M}var F=H.prototype;return F.sample=function(W,M){var O=Math.pow(this.alpha_,W);this.estimate_=M*(1-O)+O*this.estimate_,this.totalWeight_+=W},F.getTotalWeight=function(){return this.totalWeight_},F.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},H}();J.default=Q},"./src/utils/fetch-loader.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"fetchSupported",function(){return n});var Q=P("./src/polyfills/number.ts"),H=P("./src/loader/load-stats.ts"),F=P("./src/demux/chunk-cache.ts");function z(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,p(c,L)}function W(c){var L=typeof Map=="function"?new Map:void 0;return W=function(T){if(T===null||!g(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(T))return L.get(T);L.set(T,R)}function R(){return M(T,arguments,f(this).constructor)}return R.prototype=Object.create(T.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),p(R,T)},W(c)}function M(c,L,S){return O()?M=Reflect.construct:M=function(R,C,w){var x=[null];x.push.apply(x,C);var _=Function.bind.apply(R,x),o=new _;return w&&p(o,w.prototype),o},M.apply(null,arguments)}function O(){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(c){return!1}}function g(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function p(c,L){return p=Object.setPrototypeOf||function(T,R){return T.__proto__=R,T},p(c,L)}function f(c){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)},f(c)}function h(){return h=Object.assign||function(c){for(var L=1;L<arguments.length;L++){var S=arguments[L];for(var T in S)Object.prototype.hasOwnProperty.call(S,T)&&(c[T]=S[T])}return c},h.apply(this,arguments)}function n(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var d=function(){function c(S){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=S.fetchSetup||a,this.controller=new self.AbortController,this.stats=new H.LoadStats}var L=c.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(T,R,C){var w=this,x=this.stats;if(x.loading.start)throw new Error("Loader can only be used once.");x.loading.start=self.performance.now();var _=l(T,this.controller.signal),o=C.onProgress,b=T.responseType==="arraybuffer",m=b?"byteLength":"length";this.context=T,this.config=R,this.callbacks=C,this.request=this.fetchSetup(T,_),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){w.abortInternal(),C.onTimeout(x,T,w.response)},R.timeout),self.fetch(this.request).then(function(E){if(w.response=w.loader=E,!E.ok){var N=E.status,D=E.statusText;throw new u(D||"fetch, bad network response",N,E)}return x.loading.first=Math.max(self.performance.now(),x.loading.start),x.total=parseInt(E.headers.get("Content-Length")||"0"),o&&Object(Q.isFiniteNumber)(R.highWaterMark)?w.loadProgressively(E,x,T,R.highWaterMark,o):b?E.arrayBuffer():E.text()}).then(function(E){var N=w.response;self.clearTimeout(w.requestTimeout),x.loading.end=Math.max(self.performance.now(),x.loading.first),x.loaded=x.total=E[m];var D={url:N.url,data:E};o&&!Object(Q.isFiniteNumber)(R.highWaterMark)&&o(x,T,E,N),C.onSuccess(D,x,T,N)}).catch(function(E){if(self.clearTimeout(w.requestTimeout),x.aborted)return;var N=E.code||0;C.onError({code:N,text:E.message},T,E.details)})},L.getCacheAge=function(){var T=null;if(this.response){var R=this.response.headers.get("age");T=R?parseFloat(R):null}return T},L.loadProgressively=function(T,R,C,w,x){w===void 0&&(w=0);var _=new F.default,o=T.body.getReader(),b=function m(){return o.read().then(function(E){if(E.done)return _.dataLength&&x(R,C,_.flush(),T),Promise.resolve(new ArrayBuffer(0));var N=E.value,D=N.length;return R.loaded+=D,D<w||_.dataLength?(_.push(N),_.dataLength>=w&&x(R,C,_.flush(),T)):x(R,C,N,T),m()}).catch(function(){return Promise.reject()})};return b()},c}();function l(c,L){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(h({},c.headers))};return c.rangeEnd&&S.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),S}function a(c,L){return new self.Request(c.url,L)}var u=function(c){z(L,c);function L(S,T,R){var C;return C=c.call(this,S)||this,C.code=void 0,C.details=void 0,C.code=T,C.details=R,C}return L}(W(Error));J.default=d},"./src/utils/imsc1-ttml-parser.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"IMSC1_CODEC",function(){return g}),P.d(J,"parseIMSC1",function(){return n});var Q=P("./src/utils/mp4-tools.ts"),H=P("./src/utils/vttparser.ts"),F=P("./src/utils/vttcue.ts"),z=P("./src/demux/id3.ts"),W=P("./src/utils/timescale-conversion.ts"),M=P("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(w){for(var x=1;x<arguments.length;x++){var _=arguments[x];for(var o in _)Object.prototype.hasOwnProperty.call(_,o)&&(w[o]=_[o])}return w},O.apply(this,arguments)}var g="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function n(w,x,_,o,b){var m=Object(Q.findBox)(new Uint8Array(w),["mdat"]);if(m.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],N=Object(z.utf8ArrayToStr)(new Uint8Array(w,E.start,E.end-E.start)),D=Object(W.toTimescaleFromScale)(x,1,_);try{o(d(N,D))}catch(B){b(B)}}function d(w,x){var _=new DOMParser,o=_.parseFromString(w,"text/xml"),b=o.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(I,v){return I[v]=b.getAttribute("ttp:"+v)||m[v],I},{}),N=b.getAttribute("xml:space")!=="preserve",D=a(l(b,"styling","style")),B=a(l(b,"layout","region")),j=l(b,"body","[begin]");return[].map.call(j,function(I){var v=u(I,N);if(!v||!I.hasAttribute("begin"))return null;var G=T(I.getAttribute("begin"),E),Y=T(I.getAttribute("dur"),E),re=T(I.getAttribute("end"),E);if(G===null)throw S(I);if(re===null){if(Y===null)throw S(I);re=G+Y}var oe=new F.default(G-x,re-x,v);oe.id=Object(M.generateCueId)(oe.startTime,oe.endTime,oe.text);var we=B[I.getAttribute("region")],pe=D[I.getAttribute("style")];oe.position=10,oe.size=80;var xe=c(we,pe),_e=xe.textAlign;if(_e){var Se=h[_e];Se&&(oe.lineAlign=Se),oe.align=_e}return O(oe,xe),oe}).filter(function(I){return I!==null})}function l(w,x,_){var o=w.getElementsByTagName(x)[0];return o?[].slice.call(o.querySelectorAll(_)):[]}function a(w){return w.reduce(function(x,_){var o=_.getAttribute("xml:id");return o&&(x[o]=_),x},{})}function u(w,x){return[].slice.call(w.childNodes).reduce(function(_,o,b){var m;return o.nodeName==="br"&&b?_+`
`:(m=o.childNodes)!==null&&m!==void 0&&m.length?u(o,x):x?_+o.textContent.trim().replace(/\s+/g," "):_+o.textContent},"")}function c(w,x){var _="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(b,m){var E=L(x,_,m)||L(w,_,m);return E&&(b[m]=E),b},{})}function L(w,x,_){return w.hasAttributeNS(x,_)?w.getAttributeNS(x,_):null}function S(w){return new Error("Could not parse ttml timestamp "+w)}function T(w,x){if(!w)return null;var _=Object(H.parseTimeStamp)(w);return _===null&&(p.test(w)?_=R(w,x):f.test(w)&&(_=C(w,x))),_}function R(w,x){var _=p.exec(w),o=(_[4]|0)+(_[5]|0)/x.subFrameRate;return(_[1]|0)*3600+(_[2]|0)*60+(_[3]|0)+o/x.frameRate}function C(w,x){var _=f.exec(w),o=Number(_[1]),b=_[2];switch(b){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/x.frameRate;case"t":return o/x.tickRate}return o}},"./src/utils/logger.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"enableLogs",function(){return M}),P.d(J,"logger",function(){return O});var Q=function(){},H={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},F=H;function z(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):Q}function W(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];f.forEach(function(n){F[n]=g[n]?g[n].bind(g):z(n)})}function M(g){if(self.console&&g===!0||typeof g=="object"){W(g,"debug","log","info","warn","error");try{F.log()}catch(p){F=H}}else F=H}var O=F},"./src/utils/mediakeys-helper.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"KeySystems",function(){return Q}),P.d(J,"requestMediaKeySystemAccess",function(){return H});var Q;(function(F){F.WIDEVINE="com.widevine.alpha",F.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var H=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"bin2str",function(){return W}),P.d(J,"readUint16",function(){return M}),P.d(J,"readUint32",function(){return O}),P.d(J,"writeUint32",function(){return g}),P.d(J,"findBox",function(){return p}),P.d(J,"parseSegmentIndex",function(){return f}),P.d(J,"parseInitSegment",function(){return h}),P.d(J,"getStartDTS",function(){return n}),P.d(J,"getDuration",function(){return d}),P.d(J,"computeRawDurationFromSamples",function(){return l}),P.d(J,"offsetStartDTS",function(){return a}),P.d(J,"segmentValidRange",function(){return u}),P.d(J,"appendUint8Array",function(){return c});var Q=P("./src/utils/typed-array.ts"),H=P("./src/loader/fragment.ts"),F=Math.pow(2,32)-1,z=[].push;function W(L){return String.fromCharCode.apply(null,L)}function M(L,S){"data"in L&&(S+=L.start,L=L.data);var T=L[S]<<8|L[S+1];return T<0?65536+T:T}function O(L,S){"data"in L&&(S+=L.start,L=L.data);var T=L[S]<<24|L[S+1]<<16|L[S+2]<<8|L[S+3];return T<0?4294967296+T:T}function g(L,S,T){"data"in L&&(S+=L.start,L=L.data),L[S]=T>>24,L[S+1]=T>>16&255,L[S+2]=T>>8&255,L[S+3]=T&255}function p(L,S){var T=[];if(!S.length)return T;var R,C,w;"data"in L?(R=L.data,C=L.start,w=L.end):(R=L,C=0,w=R.byteLength);for(var x=C;x<w;){var _=O(R,x),o=W(R.subarray(x+4,x+8)),b=_>1?x+_:w;if(o===S[0])if(S.length===1)T.push({data:R,start:x+8,end:b});else{var m=p({data:R,start:x+8,end:b},S.slice(1));m.length&&z.apply(T,m)}x=b}return T}function f(L){var S=p(L,["moov"]),T=S[0],R=T?T.end:null,C=p(L,["sidx"]);if(!C||!C[0])return null;var w=[],x=C[0],_=x.data[0],o=_===0?8:16,b=O(x,o);o+=4;var m=0,E=0;_===0?o+=8:o+=16,o+=2;var N=x.end+E,D=M(x,o);o+=2;for(var B=0;B<D;B++){var j=o,I=O(x,j);j+=4;var v=I&2147483647,G=(I&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=O(x,j);j+=4,w.push({referenceSize:v,subsegmentDuration:Y,info:{duration:Y/b,start:N,end:N+v-1}}),N+=v,j+=4,o=j}return{earliestPresentationTime:m,timescale:b,version:_,referencesCount:D,references:w,moovEndOffset:R}}function h(L){for(var S=[],T=p(L,["moov","trak"]),R=0;R<T.length;R++){var C=T[R],w=p(C,["tkhd"])[0];if(w){var x=w.data[w.start],_=x===0?12:20,o=O(w,_),b=p(C,["mdia","mdhd"])[0];if(b){x=b.data[b.start],_=x===0?12:20;var m=O(b,_),E=p(C,["mdia","hdlr"])[0];if(E){var N=W(E.data.subarray(E.start+8,E.start+12)),D={soun:H.ElementaryStreamTypes.AUDIO,vide:H.ElementaryStreamTypes.VIDEO}[N];if(D){var B=p(C,["mdia","minf","stbl","stsd"])[0],j=void 0;B&&(j=W(B.data.subarray(B.start+12,B.start+16))),S[o]={timescale:m,type:D},S[D]={timescale:m,id:o,codec:j}}}}}}var I=p(L,["moov","mvex","trex"]);return I.forEach(function(v){var G=O(v,4),Y=S[G];Y&&(Y.default={duration:O(v,12),flags:O(v,20)})}),S}function n(L,S){return p(S,["moof","traf"]).reduce(function(T,R){var C=p(R,["tfdt"])[0],w=C.data[C.start],x=p(R,["tfhd"]).reduce(function(_,o){var b=O(o,4),m=L[b];if(m){var E=O(C,4);w===1&&(E*=Math.pow(2,32),E+=O(C,8));var N=m.timescale||9e4,D=E/N;if(isFinite(D)&&(_===null||D<_))return D}return _},null);return x!==null&&isFinite(x)&&(T===null||x<T)?x:T},null)||0}function d(L,S){for(var T=0,R=0,C=0,w=p(L,["moof","traf"]),x=0;x<w.length;x++){var _=w[x],o=p(_,["tfhd"])[0],b=O(o,4),m=S[b];if(!m)continue;var E=m.default,N=O(o,0)|(E==null?void 0:E.flags),D=E==null?void 0:E.duration;N&8&&(N&2?D=O(o,12):D=O(o,8));for(var B=m.timescale||9e4,j=p(_,["trun"]),I=0;I<j.length;I++){if(D){var v=O(j[I],4);T=D*v}else T=l(j[I]);m.type===H.ElementaryStreamTypes.VIDEO?R+=T/B:m.type===H.ElementaryStreamTypes.AUDIO&&(C+=T/B)}}if(R===0&&C===0){var G=f(L);if(G!=null&&G.references)return G.references.reduce(function(Y,re){return Y+re.info.duration||0},0)}return R||C}function l(L){var S=O(L,0),T=8;S&1&&(T+=4),S&4&&(T+=4);for(var R=0,C=O(L,4),w=0;w<C;w++){if(S&256){var x=O(L,T);R+=x,T+=4}S&512&&(T+=4),S&1024&&(T+=4),S&2048&&(T+=4)}return R}function a(L,S,T){p(S,["moof","traf"]).forEach(function(R){p(R,["tfhd"]).forEach(function(C){var w=O(C,4),x=L[w];if(!x)return;var _=x.timescale||9e4;p(R,["tfdt"]).forEach(function(o){var b=o.data[o.start],m=O(o,4);if(b===0)g(o,4,m-T*_);else{m*=Math.pow(2,32),m+=O(o,8),m-=T*_,m=Math.max(m,0);var E=Math.floor(m/(F+1)),N=Math.floor(m%(F+1));g(o,4,E),g(o,8,N)}})})})}function u(L){var S={valid:null,remainder:null},T=p(L,["moof"]);if(T){if(T.length<2)return S.remainder=L,S}else return S;var R=T[T.length-1];return S.valid=Object(Q.sliceUint8)(L,0,R.start-8),S.remainder=Object(Q.sliceUint8)(L,R.start-8),S}function c(L,S){var T=new Uint8Array(L.length+S.length);return T.set(L),T.set(S,L.length),T}},"./src/utils/output-filter.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"default",function(){return Q});var Q=function(){function H(z,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=W}var F=H.prototype;return F.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},F.newCue=function(W,M,O){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=M,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},F.reset=function(){this.cueRanges=[]},H}()},"./src/utils/texttrack-utils.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"sendAddTrackEvent",function(){return H}),P.d(J,"addCueToTrack",function(){return F}),P.d(J,"clearCurrentCues",function(){return z}),P.d(J,"removeCuesInRange",function(){return W}),P.d(J,"getCuesInRange",function(){return O});var Q=P("./src/utils/logger.ts");function H(g,p){var f;try{f=new Event("addtrack")}catch(h){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function F(g,p){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(p.id))try{if(g.addCue(p),!g.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(n){Q.logger.debug("[texttrack-utils]: "+n);var h=new self.TextTrackCue(p.startTime,p.endTime,p.text);h.id=p.id,g.addCue(h)}f==="disabled"&&(g.mode=f)}function z(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var f=g.cues.length;f--;)g.removeCue(g.cues[f]);p==="disabled"&&(g.mode=p)}function W(g,p,f){var h=g.mode;if(h==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var n=O(g.cues,p,f),d=0;d<n.length;d++)g.removeCue(n[d]);h==="disabled"&&(g.mode=h)}function M(g,p){if(p<g[0].startTime)return 0;var f=g.length-1;if(p>g[f].endTime)return-1;for(var h=0,n=f;h<=n;){var d=Math.floor((n+h)/2);if(p<g[d].startTime)n=d-1;else if(p>g[d].startTime&&h<f)h=d+1;else return d}return g[h].startTime-p<p-g[n].startTime?h:n}function O(g,p,f){var h=[],n=M(g,p);if(n>-1)for(var d=n,l=g.length;d<l;d++){var a=g[d];if(a.startTime>=p&&a.endTime<=f)h.push(a);else if(a.startTime>f)return h}return h}},"./src/utils/time-ranges.ts":function(le,J,P){"use strict";P.r(J);var Q={toString:function(F){for(var z="",W=F.length,M=0;M<W;M++)z+="["+F.start(M).toFixed(3)+","+F.end(M).toFixed(3)+"]";return z}};J.default=Q},"./src/utils/timescale-conversion.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"toTimescaleFromBase",function(){return H}),P.d(J,"toTimescaleFromScale",function(){return F}),P.d(J,"toMsFromMpegTsClock",function(){return z}),P.d(J,"toMpegTsClockFromTimescale",function(){return W});var Q=9e4;function H(M,O,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=M*O*g;return p?Math.round(f):f}function F(M,O,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),H(M,O,1/g,p)}function z(M,O){return O===void 0&&(O=!1),H(M,1e3,1/Q,O)}function W(M,O){return O===void 0&&(O=1),H(M,Q,1/O)}},"./src/utils/typed-array.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"sliceUint8",function(){return Q});function Q(H,F,z){return Uint8Array.prototype.slice?H.slice(F,z):new Uint8Array(Array.prototype.slice.call(H,F,z))}},"./src/utils/vttcue.ts":function(le,J,P){"use strict";P.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],H=["start","middle","end","left","right"];function F(g,p){if(typeof p!="string")return!1;if(!Array.isArray(g))return!1;var f=p.toLowerCase();return~g.indexOf(f)?f:!1}function z(g){return F(Q,g)}function W(g){return F(H,g)}function M(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];for(var n=1;n<arguments.length;n++){var d=arguments[n];for(var l in d)g[l]=d[l]}return g}function O(g,p,f){var h=this,n={enumerable:!0};h.hasBeenReset=!1;var d="",l=!1,a=g,u=p,c=f,L=null,S="",T=!0,R="auto",C="start",w=50,x="middle",_=50,o="middle";Object.defineProperty(h,"id",M({},n,{get:function(){return d},set:function(m){d=""+m}})),Object.defineProperty(h,"pauseOnExit",M({},n,{get:function(){return l},set:function(m){l=!!m}})),Object.defineProperty(h,"startTime",M({},n,{get:function(){return a},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");a=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",M({},n,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",M({},n,{get:function(){return c},set:function(m){c=""+m,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",M({},n,{get:function(){return L},set:function(m){L=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",M({},n,{get:function(){return S},set:function(m){var E=z(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",M({},n,{get:function(){return T},set:function(m){T=!!m,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",M({},n,{get:function(){return R},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",M({},n,{get:function(){return C},set:function(m){var E=W(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");C=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",M({},n,{get:function(){return w},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");w=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",M({},n,{get:function(){return x},set:function(m){var E=W(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");x=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",M({},n,{get:function(){return _},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",M({},n,{get:function(){return o},set:function(m){var E=W(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");o=E,this.hasBeenReset=!0}})),h.displayState=void 0}return O.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"parseTimeStamp",function(){return F}),P.d(J,"fixLineBreaks",function(){return p}),P.d(J,"VTTParser",function(){return f});var Q=P("./src/utils/vttcue.ts"),H=function(){function h(){}var n=h.prototype;return n.decode=function(l,a){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},h}();function F(h){function n(l,a,u,c){return(l|0)*3600+(a|0)*60+(u|0)+parseFloat(c||0)}var d=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?n(d[2],d[3],0,d[4]):n(d[1],d[2],d[3],d[4]):null}var z=function(){function h(){this.values=Object.create(null)}var n=h.prototype;return n.set=function(l,a){!this.get(l)&&a!==""&&(this.values[l]=a)},n.get=function(l,a,u){return u?this.has(l)?this.values[l]:a[u]:this.has(l)?this.values[l]:a},n.has=function(l){return l in this.values},n.alt=function(l,a,u){for(var c=0;c<u.length;++c)if(a===u[c]){this.set(l,a);break}},n.integer=function(l,a){/^-?\d+$/.test(a)&&this.set(l,parseInt(a,10))},n.percent=function(l,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var u=parseFloat(a);if(u>=0&&u<=100)return this.set(l,u),!0}return!1},h}();function W(h,n,d,l){var a=l?h.split(l):[h];for(var u in a){if(typeof a[u]!="string")continue;var c=a[u].split(d);if(c.length!==2)continue;var L=c[0],S=c[1];n(L,S)}}var M=new Q.default(0,0,""),O=M.align==="middle"?"middle":"center";function g(h,n,d){var l=h;function a(){var L=F(h);if(L===null)throw new Error("Malformed timestamp: "+l);return h=h.replace(/^[^\sa-zA-Z-]+/,""),L}function u(L,S){var T=new z;W(L,function(w,x){var _;switch(w){case"region":for(var o=d.length-1;o>=0;o--)if(d[o].id===x){T.set(w,d[o].region);break}break;case"vertical":T.alt(w,x,["rl","lr"]);break;case"line":_=x.split(","),T.integer(w,_[0]),T.percent(w,_[0])&&T.set("snapToLines",!1),T.alt(w,_[0],["auto"]),_.length===2&&T.alt("lineAlign",_[1],["start",O,"end"]);break;case"position":_=x.split(","),T.percent(w,_[0]),_.length===2&&T.alt("positionAlign",_[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":T.percent(w,x);break;case"align":T.alt(w,x,["start",O,"end","left","right"]);break}},/:/,/\s/),S.region=T.get("region",null),S.vertical=T.get("vertical","");var R=T.get("line","auto");R==="auto"&&M.line===-1&&(R=-1),S.line=R,S.lineAlign=T.get("lineAlign","start"),S.snapToLines=T.get("snapToLines",!0),S.size=T.get("size",100),S.align=T.get("align",O);var C=T.get("position","auto");C==="auto"&&M.position===50&&(C=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=C}function c(){h=h.replace(/^\s+/,"")}if(c(),n.startTime=a(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);h=h.substr(3),c(),n.endTime=a(),c(),u(h,n)}function p(h){return h.replace(/<br(?: \/)?>/gi,`
`)}var f=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new H,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var n=h.prototype;return n.parse=function(l){var a=this;l&&(a.buffer+=a.decoder.decode(l,{stream:!0}));function u(){var C=a.buffer,w=0;for(C=p(C);w<C.length&&C[w]!=="\r"&&C[w]!==`
`;)++w;var x=C.substr(0,w);return C[w]==="\r"&&++w,C[w]===`
`&&++w,a.buffer=C.substr(w),x}function c(C){W(C,function(w,x){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=u();var S=L.match(/^()?WEBVTT([ \t].*)?$/);if(!S||!S[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var T=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;T?T=!1:L=u();switch(a.state){case"HEADER":/:/.test(L)?c(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Q.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(L,a.cue,a.regionList)}catch(C){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var R=L.indexOf("-->")!==-1;if(!L||R&&(T=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(C){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},n.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){l.onparsingerror&&l.onparsingerror(a)}return l.onflush&&l.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(le,J,P){"use strict";P.r(J),P.d(J,"generateCueId",function(){return f}),P.d(J,"parseWebVTT",function(){return n});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/vttparser.ts"),F=P("./src/demux/id3.ts"),z=P("./src/utils/timescale-conversion.ts"),W=P("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,O=function(l,a,u){return u===void 0&&(u=0),l.substr(u,a.length)===a},g=function(l){var a=parseInt(l.substr(-3)),u=parseInt(l.substr(-6,2)),c=parseInt(l.substr(-9,2)),L=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(u)||!Object(Q.isFiniteNumber)(c)||!Object(Q.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return a+=1e3*u,a+=60*1e3*c,a+=60*60*1e3*L,a},p=function(l){for(var a=5381,u=l.length;u;)a=a*33^l.charCodeAt(--u);return(a>>>0).toString()};function f(d,l,a){return p(d.toString())+p(l.toString())+p(a)}var h=function(l,a,u){var c=l[a],L=l[c.prevCC];if(!L||!L.new&&c.new){l.ccOffset=l.presentationOffset=c.start,c.new=!1;return}for(;(S=L)!==null&&S!==void 0&&S.new;){var S;l.ccOffset+=c.start-L.start,c.new=!1,c=L,L=l[c.prevCC]}l.presentationOffset=u};function n(d,l,a,u,c,L,S,T){var R=new H.VTTParser,C=Object(F.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(M,`
`).split(`
`),w=[],x=Object(z.toMpegTsClockFromTimescale)(l,a),_="00:00.000",o=0,b=0,m,E=!0,N=!1;R.oncue=function(D){var B=u[c],j=u.ccOffset,I=(o-x)/9e4;if(B!=null&&B.new&&(b!==void 0?j=u.ccOffset=B.start:h(u,c,I)),I&&(j=I-u.presentationOffset),N){var v=D.endTime-D.startTime,G=Object(W.normalizePts)((D.startTime+j-b)*9e4,L*9e4)/9e4;D.startTime=G,D.endTime=G+v}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=f(D.startTime,D.endTime,Y)),D.endTime>0&&w.push(D)},R.onparsingerror=function(D){m=D},R.onflush=function(){if(m){T(m);return}S(w)},C.forEach(function(D){if(E)if(O(D,"X-TIMESTAMP-MAP=")){E=!1,N=!0,D.substr(16).split(",").forEach(function(B){O(B,"LOCAL:")?_=B.substr(6):O(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{b=g(_)/1e3}catch(B){N=!1,m=B}return}else D===""&&(E=!1);R.parse(D+`
`)}),R.flush()}},"./src/utils/xhr-loader.ts":function(le,J,P){"use strict";P.r(J);var Q=P("./src/utils/logger.ts"),H=P("./src/loader/load-stats.ts"),F=/^age:\s*[\d.]+\s*$/m,z=function(){function W(O){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=O?O.xhrSetup:null,this.stats=new H.LoadStats,this.retryDelay=0}var M=W.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},M.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(g,p,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},M.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var n=this.xhrSetup;try{if(n)try{n(f,p.url)}catch(a){f.open("GET",p.url,!0),n(f,p.url)}f.readyState||f.open("GET",p.url,!0);var d=this.context.headers;if(d)for(var l in d)f.setRequestHeader(l,d[l])}catch(a){this.callbacks.onError({code:f.status,text:a.message},p,f);return}p.rangeEnd&&f.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),f.send()},M.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var h=p.readyState,n=this.config;if(f.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),h===4){p.onreadystatechange=null,p.onprogress=null;var d=p.status;if(d>=200&&d<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var l,a;if(g.responseType==="arraybuffer"?(l=p.response,a=l.byteLength):(l=p.responseText,a=l.length),f.loaded=f.total=a,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(f,g,l,p),!this.callbacks)return;var c={url:p.responseURL,data:l};this.callbacks.onSuccess(c,f,g,p)}else f.retry>=n.maxRetry||d>=400&&d<499?(Q.logger.error(d+" while loading "+g.url),this.callbacks.onError({code:d,text:p.statusText},g,p)):(Q.logger.warn(d+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,n.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout)},M.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},M.getCacheAge=function(){var g=null;if(this.loader&&F.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},W}();J.default=z}}).default})},vHTk:function(ct,Ye,ae){ct.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},we55:function(ct,Ye,ae){ct.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(ct,Ye,ae){"use strict";ae.d(Ye,"c",function(){return H}),ae.d(Ye,"b",function(){return F}),ae.d(Ye,"d",function(){return z}),ae.d(Ye,"a",function(){return M}),ae.d(Ye,"e",function(){return O});var le=ae("9og8"),J=ae("WmNS"),P=ae.n(J),Q=ae("ErOA");function H(g){return Object(Q.c)("libraries/".concat(g,".json"))}function F(){return Object(Q.c)("library_tags.json")}function z(g){return W.apply(this,arguments)}function W(){return W=Object(le.a)(P.a.mark(function g(p){var f;return P.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Object(Q.b)("attachments/".concat(p,".json"));case 2:return f=n.sent,n.abrupt("return",f.status===0);case 4:case"end":return n.stop()}},g)})),W.apply(this,arguments)}function M(g){return Object(Q.f)("libraries.json",g)}function O(g,p){return Object(Q.g)("libraries/".concat(g,".json"),p)}},y5JW:function(ct,Ye,ae){"use strict";ae.d(Ye,"c",function(){return d}),ae.d(Ye,"a",function(){return l});var le=ae("DZo9"),J=ae("8z0m"),P=ae("+L6B"),Q=ae("2/Rp"),H=ae("9og8"),F=ae("miYZ"),z=ae("tsqr"),W=ae("k1fw"),M=ae("oBTY"),O=ae("WmNS"),g=ae.n(O),p=ae("q1tI"),f=ae.n(p),h=ae("m3rI"),n=ae("wzkS"),d="\u3000\u3000";function l(a){var u=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var c=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,c)).toFixed(1)+" "+u[c]}Ye.b=function(a){var u=a.value,c=u===void 0?[]:u,L=a.action,S=a.onChange,T=a.className,R=a.maxSize,C=R===void 0?150:R,w=a.title,x=w===void 0?"\u6587\u4EF6\u4E0A\u4F20":w,_=a.accept,o=_===void 0?null:_,b={multiple:!1,fileList:c,accept:o,withCredentials:!0,beforeUpload:function(N){var D=N.size/1024/1024;return!0},action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var D,B,j=Object(M.a)(N.fileList);if(j=j.map(function(G){return G.name.indexOf(d)===-1&&(G.name="".concat(G.name).concat(d).concat(l(G.size))),Object(W.a)({},G)}),N.file.status==="done"&&((D=N.file)===null||D===void 0||((B=D.response)===null||B===void 0)?void 0:B.status)===-1){var I,v;z.b.error((I=N.file)===null||I===void 0||((v=I.response)===null||v===void 0)?void 0:v.message),S([]);return}S(j)},onRemove:function(){var E=Object(H.a)(g.a.mark(function D(B){var j,I,v;return g.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(j=B.size/1024/1024,!(B.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(j<C){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(I=B.response?B.response.id:B.uid,!I){Y.next=15;break}return Y.next=11,Object(n.d)(B.response?B.response.id:B.id);case 11:return v=Y.sent,Y.abrupt("return",v);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},D)}));function N(D){return E.apply(this,arguments)}return N}()};function m(E){E.preventDefault(),E.stopPropagation()}return f.a.createElement("div",{className:"single-upload ".concat(T||"")},f.a.createElement(J.a,b,f.a.createElement(Q.a,{type:"primary",title:c.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:c.length>0,ghost:!0},x),f.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",C,"M)"," ")))}},yQHh:function(ct,Ye,ae){}}]);