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

366 lines
955 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[335,6,7,9,12,17],{"+NIl":function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function(J,O){"use strict";function Z(A,S){A.cmdState.push(S)}function U(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function D(A){var S=A.cmdState.pop();S&&S.closeBracket()}function K(A){for(var S=A.cmdState,C=S.length-1;C>=0;C--){var h=S[C];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function H(A,S,C){return function(){this.name=A,this.bracketNo=0,this.style=S,this.styles=C,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var N={};N.importmodule=H("importmodule","tag",["string","builtin"]),N.documentclass=H("documentclass","tag",["","atom"]),N.usepackage=H("usepackage","tag",["atom"]),N.begin=H("begin","tag",["atom"]),N.end=H("end","tag",["atom"]),N.label=H("label","tag",["atom"]),N.ref=H("ref","tag",["atom"]),N.eqref=H("eqref","tag",["atom"]),N.cite=H("cite","tag",["atom"]),N.bibitem=H("bibitem","tag",["atom"]),N.Bibitem=H("Bibitem","tag",["atom"]),N.RBibitem=H("RBibitem","tag",["atom"]),N.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(A,S){A.f=S}function b(A,S){var C;if(A.match(/^\\[a-zA-Z@]+/)){var h=A.current().slice(1);return C=N.hasOwnProperty(h)?N[h]:N.DEFAULT,C=new C,Z(S,C),R(S,P),C.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return R(S,function(l,d){return _(l,d,"\\]")}),"keyword";if(A.match("\\("))return R(S,function(l,d){return _(l,d,"\\)")}),"keyword";if(A.match("$$"))return R(S,function(l,d){return _(l,d,"$$")}),"keyword";if(A.match("$"))return R(S,function(l,d){return _(l,d,"$")}),"keyword";var a=A.next();if(a=="%")return A.skipToEnd(),"comment";if(a=="}"||a=="]"){if(C=U(S),C)C.closeBracket(a),R(S,P);else return"error";return"bracket"}else return a=="{"||a=="["?(C=N.DEFAULT,C=new C,Z(S,C),"bracket"):/\d/.test(a)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),C=K(S),C.name=="begin"&&(C.argument=A.current()),C.styleIdentifier())}function _(A,S,C){if(A.eatSpace())return null;if(C&&A.match(C))return R(S,b),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=A.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(A.skipToEnd(),"comment"):"error"}function P(A,S){var C=A.peek(),h;return C=="{"||C=="["?(h=U(S),h.openBracket(C),A.eat(C),R(S,b),"bracket"):/[ \t\r]/.test(C)?(A.eat(C),null):(R(S,b),D(S),b(A,S))}return{startState:function(){var A=O.inMathMode?function(S,C){return _(S,C)}:b;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,S){return S.f(A,S)},blankLine:function(A){A.f=b,A.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"19Vz":function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(H,N,R){var b=R&&R!=ce.Init;if(N&&!b)H.on("blur",U),H.on("change",D),H.on("swapDoc",D),ce.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){Z(H)}),D(H);else if(!N&&b){H.off("blur",U),H.off("change",D),H.off("swapDoc",D),ce.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),J(H);var _=H.getWrapperElement();_.className=_.className.replace(" CodeMirror-empty","")}N&&!H.hasFocus()&&U(H)});function J(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function O(H){J(H);var N=H.state.placeholder=document.createElement("pre");N.style.cssText="height: 0; overflow: visible",N.style.direction=H.getOption("direction"),N.className="CodeMirror-placeholder CodeMirror-line-like";var R=H.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),N.appendChild(R),H.display.lineSpace.insertBefore(N,H.display.lineSpace.firstChild)}function Z(H){setTimeout(function(){var N=!1,R=H.getInputField();R.nodeName=="TEXTAREA"?N=!R.value:H.lineCount()==1&&(N=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),N?O(H):J(H)},20)}function U(H){K(H)&&O(H)}function D(H){var N=H.getWrapperElement(),R=K(H);N.className=N.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(H):J(H)}function K(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ce.defineMode("xml",function(Z,U){var D=Z.indentUnit,K={},H=U.htmlMode?J:O;for(var N in H)K[N]=H[N];for(var N in U)K[N]=U[N];var R,b;function _(o,E){function g(j){return E.tokenize=j,j(o,E)}var x=o.next();if(x=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?g(S("atom","]]>")):null:o.match("--")?g(S("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),g(C(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),E.tokenize=S("meta","?>"),"meta"):(R=o.eat("/")?"closeTag":"openTag",E.tokenize=P,"tag bracket");if(x=="&"){var I;return o.eat("#")?o.eat("x")?I=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):I=o.eatWhile(/[\d]/)&&o.eat(";"):I=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),I?"atom":"error"}else return o.eatWhile(/[^&<]/),null}_.isInText=!0;function P(o,E){var g=o.next();if(g==">"||g=="/"&&o.eat(">"))return E.tokenize=_,R=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return R="equals",null;if(g=="<"){E.tokenize=_,E.state=d,E.tagName=E.tagStart=null;var x=E.tokenize(o,E);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(g)?(E.tokenize=A(g),E.stringStartCol=o.column(),E.tokenize(o,E)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(o){var E=function(g,x){for(;!g.eol();)if(g.next()==o){x.tokenize=P;break}return"string"};return E.isInAttribute=!0,E}function S(o,E){return function(g,x){for(;!g.eol();){if(g.match(E)){x.tokenize=_;break}g.next()}return o}}function C(o){return function(E,g){for(var x;(x=E.next())!=null;){if(x=="<")return g.tokenize=C(o+1),g.tokenize(E,g);if(x==">")if(o==1){g.tokenize=_;break}else return g.tokenize=C(o-1),g.tokenize(E,g)}return"meta"}}function h(o,E,g){this.prev=o.context,this.tagName=E,this.indent=o.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(E)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,E){for(var g;;){if(!o.context)return;if(g=o.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(E))return;a(o)}}function d(o,E,g){return o=="openTag"?(g.tagStart=E.column(),w):o=="closeTag"?v:d}function w(o,E,g){return o=="word"?(g.tagName=E.current(),b="tag",y):K.allowMissingTagName&&o=="endTag"?(b="tag bracket",y(o,E,g)):(b="error",w)}function v(o,E,g){if(o=="word"){var x=E.current();return g.context&&g.context.tagName!=x&&K.implicitlyClosed.hasOwnProperty(g.context.tagName)&&a(g),g.context&&g.context.tagName==x||K.matchClosing===!1?(b="tag",m):(b="tag error",L)}else return K.allowMissingTagName&&o=="endTag"?(b="tag bracket",m(o,E,g)):(b="error",L)}function m(o,E,g){return o!="endTag"?(b="error",m):(a(g),d)}function L(o,E,g){return b="error",m(o,E,g)}function y(o,E,g){if(o=="word")return b="attribute",f;if(o=="endTag"||o=="selfcloseTag"){var x=g.tagName,I=g.tagStart;return g.tagName=g.tagStart=null,o=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(x)?l(g,x):(l(g,x),g.context=new h(g,x,I==g.indented)),d}return b="error",y}function f(o,E,g){return o=="equals"?p:(K.allowMissing||(b="error"),y(o,E,g))}function p(o,E,g){return o=="string"?u:o=="word"&&K.allowUnquoted?(b="string",y):(b="error",y(o,E,g))}function u(o,E,g){return o=="string"?u:y(o,E,g)}return{startState:function(o){var E={tokenize:_,state:d,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(E.baseIndent=o),E},token:function(o,E){if(!E.tagName&&o.sol()&&(E.indented=o.indentation()),o.eatSpace())return null;R=null;var g=E.tokenize(o,E);return(g||R)&&g!="comment"&&(b=null,E.state=E.state(R||g,o,E),b&&(g=b=="error"?g+" error":b)),g},indent:function(o,E,g){var x=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+D;if(x&&x.noIndent)return ce.Pass;if(o.tokenize!=P&&o.tokenize!=_)return g?g.match(/^(\s*)/)[0].length:0;if(o.tagName)return K.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+D*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var I=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(I&&I[1])for(;x;)if(x.tagName==I[2]){x=x.prev;break}else if(K.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(I)for(;x;){var j=K.contextGrabbers[x.tagName];if(j&&j.hasOwnProperty(I[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+D:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(o){o.state==p&&(o.state=y)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var E=[],g=o.context;g;g=g.prev)g.tagName&&E.push(g.tagName);return E.reverse()}}}),ce.defineMIME("text/xml","xml"),ce.defineMIME("application/xml","xml"),ce.mimeModes.hasOwnProperty("text/html")||ce.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3vs6":function(nt,ze,oe){"use strict";var ce=oe("+L6B"),J=oe("2/Rp"),O=oe("5Dmo"),Z=oe("3S7+"),U=oe("k1fw"),D=oe("miYZ"),K=oe("tsqr"),H=oe("9og8"),N=oe("2qtc"),R=oe("kLXV"),b=oe("tJVT"),_=oe("WmNS"),P=oe.n(_),A=oe("q1tI"),S=oe.n(A),C=oe("ttuQ"),h=oe.n(C),a=oe("ErOA"),l=oe("m3rI"),d=oe("IE1O"),w=oe("xKgJ"),v=oe("NLgs"),m=oe("Ty5D"),L=oe("9kvl"),y=function(p){var u=p.virtualSpaces,o=p.user,E=p.dispatch,g=Object(A.useState)(!1),x=Object(b.a)(g,2),I=x[0],j=x[1],G=Object(m.i)(),V=u.virtualSpacesDetails;Object(A.useEffect)(function(){M()},[]);var M=function(){E({type:"virtualSpaces/getVirtualSpacesDetails",payload:{id:G==null?void 0:G.virtual_spacesId}})},F=function(){if(!Object(v.f)(E))return;R.a.confirm({centered:!0,width:424,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u7533\u8BF7\u52A0\u5165",icon:null,className:"custom-modal-divider",content:S.a.createElement("div",{className:"font14"},"\u786E\u8BA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\u52A0\u5165\u8BE5\u865A\u62DF\u793E\u533A\u5417\uFF1F"),onOk:function(){var Ee=Object(H.a)(P.a.mark(function Se(){var xe;return P.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return z.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,"/apply_become_member.json"),{method:"post"});case 2:xe=z.sent,(xe==null?void 0:xe.status)!==-1&&(K.b.success(xe==null?void 0:xe.message),M());case 4:case"end":return z.stop()}},Se)}));function _e(){return Ee.apply(this,arguments)}return _e}()})},$=function(){R.a.confirm({centered:!0,width:424,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u7533\u8BF7\u516C\u5F00",icon:null,className:"custom-modal-divider",content:S.a.createElement("div",{className:"font14"},S.a.createElement("p",null,"\u786E\u8BA4\u5411\u5E73\u53F0\u7533\u8BF7\u516C\u5F00\u865A\u62DF\u793E\u533A\u5417\uFF1F"),S.a.createElement("p",null,"\u516C\u5F00\u865A\u62DF\u793E\u533A\u9700\u7ECF\u8FC7\u5E73\u53F0\u6807\u51C6\u5316\u5BA1\u6838\uFF0C\u5BA1\u6838\u5468\u671F\u4E3A1-2\u5929\uFF0C"),S.a.createElement("div",null,"\u516C\u5F00\u7684\u865A\u62DF\u793E\u533A\u5C06\u5BF9\u5E73\u53F0\u6240\u6709\u4EBA\u53EF\u89C1\u3002")),onOk:function(){var Ee=Object(H.a)(P.a.mark(function Se(){var xe;return P.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return z.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,"/apply_public.json"),{method:"post"});case 2:xe=z.sent,(xe==null?void 0:xe.status)!==-1&&(K.b.success(xe==null?void 0:xe.message),M());case 4:case"end":return z.stop()}},Se)}));function _e(){return Ee.apply(this,arguments)}return _e}()})},ie=function(){var Le=Object(H.a)(P.a.mark(function Ee(_e){var Se;return P.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return me.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,".json"),{method:"put",body:_e});case 2:Se=me.sent,(Se==null?void 0:Se.status)===0&&(M(),j(!1));case 4:case"end":return me.stop()}},Ee)}));return function(_e){return Le.apply(this,arguments)}}(),de=function(){var Le=Object(H.a)(P.a.mark(function Ee(_e){return P.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:j(Object(U.a)({},V));case 1:case"end":return xe.stop()}},Ee)}));return function(_e){return Le.apply(this,arguments)}}(),ge=(V==null?void 0:V.is_member)||Object(w.w)();return S.a.createElement("div",{className:h.a.bg,style:{background:"url('".concat(l.a.IMG_SERVER+(V==null?void 0:V.backbground_image_url),"') no-repeat center center")}},S.a.createElement("aside",null,S.a.createElement("div",null,S.a.createElement("div",{className:h.a.member},S.a.createElement("div",null,S.a.createElement(Z.a,{title:"\u6210\u5458\u603B\u6570"},S.a.createElement("i",{style:{color:"#FF8B58",fontSize:24},className:"iconfont icon-a-chengyuan1"})),S.a.createElement(Z.a,{title:"\u6210\u5458\u603B\u6570"},S.a.createElement("span",null,V==null?void 0:V.members_count))),S.a.createElement("div",null,S.a.createElement(Z.a,{title:"\u8D44\u6E90\u603B\u6570"},S.a.createElement("i",{style:{color:"#07C160",marginLeft:100},className:"iconfont icon-a-ziyuanku1"})),S.a.createElement(Z.a,{title:"\u8D44\u6E90\u603B\u6570"},S.a.createElement("span",null,V==null?void 0:V.resources_count)))),ge&&S.a.createElement(J.a,{disabled:(V==null?void 0:V.status)!==2,onClick:$,type:"primary"},S.a.createElement("i",{className:"iconfont icon-sheweigongkai2 mr5 font14"}),(V==null?void 0:V.status)===2?"\u7533\u8BF7\u516C\u5F00":(V==null?void 0:V.status)===0?"\u7533\u8BF7\u4E2D":"\u5DF2\u516C\u5F00"),!ge&&S.a.createElement(J.a,{onClick:F,type:"primary"},S.a.createElement("i",{className:"iconfont icon-shenqingjiaru2 mr5 font14"}),"\u7533\u8BF7\u52A0\u5165"))),S.a.createElement(d.b,{visible:I,title:"\u7F16\u8F91\u865A\u62DF\u793E\u533A",onCancel:function(){return j(!1)},onOk:ie}))};ze.a=Object(L.a)(function(f){var p=f.virtualSpaces,u=f.user;return{virtualSpaces:p,user:u}})(y)},"500L":function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return v});var ce=oe("+L6B"),J=oe("2/Rp"),O=oe("2qtc"),Z=oe("kLXV"),U=oe("9og8"),D=oe("k1fw"),K=oe("miYZ"),H=oe("tsqr"),N=oe("oBTY"),R=oe("tJVT"),b=oe("DZo9"),_=oe("8z0m"),P=oe("WmNS"),A=oe.n(P),S=oe("q1tI"),C=oe.n(S),h=oe("m3rI"),a=oe("wzkS"),l=oe("y5JW"),d=oe("LtfV"),w=_.a.Dragger;function v(m){var L=[];return m&&m.length>0&&(L=m.map(function(y){return{uid:y.id,id:y.id,name:y.title+l.c+y.filesize,url:y.url,filesize:y.filesize,status:"done",response:{id:y.id}}})),L}ze.b=function(m){var L=m.value,y=m.onChange,f=m.action,p=m.className,u=m.maxSize,o=u===void 0?150:u,E=m.title,g=E===void 0?"\u4E0A\u4F20\u9644\u4EF6":E,x=m.showRemoveModal,I=x===void 0?!1:x,j=m.accept,G=j===void 0?"":j,V=m.additionalText,M=m.isDragger,F=m.number,$=F===void 0?1e3:F,ie=m.aloneClear,de=ie===void 0?!1:ie,ge=Object(S.useState)(!1),Le=Object(R.a)(ge,2),Ee=Le[0],_e=Le[1],Se=Object(S.useState)(L||[]),xe=Object(R.a)(Se,2),me=xe[0],z=xe[1];Object(S.useEffect)(function(){L&&(z(Object(N.a)(L)),$===(L==null?void 0:L.length)&&_e(!0))},[L]);var s=function(){setTimeout(function(){me.pop(),z(Object(N.a)(me))},500)},c={multiple:!0,disabled:Ee,accept:G,withCredentials:!0,fileList:me,beforeUpload:function(B,se){var ve=B.size/1024/1024;return me.concat(se).length>$?(me.pop(),z(Object(N.a)(me)),H.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat($,"\u4E2A\u6587\u4EF6")),de?Promise.reject():(s(),!1)):!0},action:f||"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(B){var se,ve,Te=Object(N.a)(B.fileList);if(B.file.status==="done"&&((se=B.file)===null||se===void 0||((ve=se.response)===null||ve===void 0)?void 0:ve.status)===-1){var Pe,Ae;H.b.error((Pe=B.file)===null||Pe===void 0||((Ae=Pe.response)===null||Ae===void 0)?void 0:Ae.message);return}Te.length>=$?_e(!0):_e(!1),z(Object(N.a)(Te)),Te=Te.map(function(De){var ke;if(De!=null&&(ke=De.response)!==null&&ke!==void 0&&ke.id){var Fe;De.url="/api/attachments/".concat(De==null||((Fe=De.response)===null||Fe===void 0)?void 0:Fe.id)}return De.name.indexOf(l.c)===-1&&(De.name="".concat(De.name).concat(l.c).concat(Object(l.a)(De.size))),Object(D.a)({},De)}),console.log("info:",B),y(Te)},onRemove:function(){var X=Object(U.a)(A.a.mark(function se(ve){var Te;return A.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(Te=function(){var De=Object(U.a)(A.a.mark(function ke(){var Fe,je;return A.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(Fe=ve.response?ve.response.id:ve.id,!Fe){Ie.next=8;break}return Ie.next=4,Object(a.d)(ve.response?ve.response.id:ve.uid);case 4:return je=Ie.sent,Ie.abrupt("return",je);case 8:return Ie.abrupt("return",!0);case 9:case"end":return Ie.stop()}},ke)}));return function(){return De.apply(this,arguments)}}(),!I){Ae.next=5;break}return Ae.abrupt("return",new Promise(function(De,ke){Z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:C.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Fe=Object(U.a)(A.a.mark(function Be(){var Ie;return A.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Te();case 2:Ie=He.sent,H.b.success("\u5220\u9664\u6210\u529F"),De(!0);case 5:case"end":return He.stop()}},Be)}));function je(){return Fe.apply(this,arguments)}return je}(),onCancel:function(){return De(!1)}})}));case 5:return Ae.next=7,Te();case 7:return Ae.abrupt("return",Ae.sent);case 8:case"end":return Ae.stop()}},se)}));function B(se){return X.apply(this,arguments)}return B}()};function k(X){X.preventDefault(),X.stopPropagation()}return C.a.createElement("div",{className:"multi-upload ".concat(p||"")},M&&C.a.createElement(w,c,C.a.createElement("p",{className:"ant-upload-drag-icon"},C.a.createElement(d.a,null)),C.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",C.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB)"," "),V),!M&&C.a.createElement(_.a,c,C.a.createElement(J.a,{style:{width:"108px",height:"32px",background:"#F6F7F9 linear-gradient(180deg, #FFFFFF 0%, #F6F7F9 100%)",boxShadow:"0px 2px 4px 0px #E0DFE1, inset 0px 1px 3px 0px rgba(255,255,255,0.5)",borderRadius:"2px",border:"1px solid #BACFFE",color:"#3061D0"},icon:C.a.createElement("i",{className:"iconfont icon-shangchuan3",style:{marginRight:"6px"}}),disabled:Ee},g),C.a.createElement("span",{onClick:k,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB)"," ")))}},"7Cbv":function(nt,ze,oe){"use strict";var ce=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function O(){if(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(J)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(P){return typeof P=="string"&&Z.test(P)}for(var D=U,K=[],H=0;H<256;++H)K.push((H+256).toString(16).substr(1));function N(P){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(K[P[A+0]]+K[P[A+1]]+K[P[A+2]]+K[P[A+3]]+"-"+K[P[A+4]]+K[P[A+5]]+"-"+K[P[A+6]]+K[P[A+7]]+"-"+K[P[A+8]]+K[P[A+9]]+"-"+K[P[A+10]]+K[P[A+11]]+K[P[A+12]]+K[P[A+13]]+K[P[A+14]]+K[P[A+15]]).toLowerCase();if(!D(S))throw TypeError("Stringified UUID is invalid");return S}var R=N;function b(P,A,S){P=P||{};var C=P.random||(P.rng||O)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,A){S=S||0;for(var h=0;h<16;++h)A[S+h]=C[h];return A}return R(C)}var _=ze.a=b},"7ahc":function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return w});var ce=oe("k1fw"),J=oe("0Owb"),O=oe("+L6B"),Z=oe("2/Rp"),U=oe("y8nQ"),D=oe("Vl3Y"),K=oe("tJVT"),H=oe("OaEy"),N=oe("2fM7"),R=oe("q1tI"),b=oe.n(R),_=oe("VrN/"),P=oe.n(_),A=oe("p77/"),S=oe.n(A),C=oe("c5Ni"),h=oe.n(C),a=N.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};ze.b=function(v){var m=v.callback,L=v.onCancel,y=Object(R.useState)("python"),f=Object(K.a)(y,2),p=f[0],u=f[1];function o(g){u(d[g][1])}function E(g){m(g)}return b.a.createElement(D.a,Object(J.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(N.a,{onChange:o},Object.keys(d).map(function(g){return b.a.createElement(a,{key:g,value:g},d[g][0])}))),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(w,{mode:p})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Z.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(v){var m=v.value,L=v.onChange,y=v.mode,f=v.options,p=f===void 0?{}:f,u=Object(R.useRef)(),o=Object(R.useState)(),E=Object(K.a)(o,2),g=E[0],x=E[1];return Object(R.useEffect)(function(){if(g){function I(j){var G=j.getValue();L&&L(G)}return g.on("change",I),function(){g.off("change",I)}}},[g,L]),Object(R.useEffect)(function(){g&&g.setOption("mode",y)},[g,y]),Object(R.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(R.useEffect)(function(){if(u.current&&!g){var I=P.a.fromTextArea(u.current,Object(ce.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));x(I)}},[u.current,g]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:u}))}},"7ixt":function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return O});var ce={adjustX:1,adjustY:1},J=[0,0],O={left:{points:["cr","cl"],overflow:ce,offset:[-4,0],targetOffset:J},right:{points:["cl","cr"],overflow:ce,offset:[4,0],targetOffset:J},top:{points:["bc","tc"],overflow:ce,offset:[0,-4],targetOffset:J},bottom:{points:["tc","bc"],overflow:ce,offset:[0,4],targetOffset:J},topLeft:{points:["bl","tl"],overflow:ce,offset:[0,-4],targetOffset:J},leftTop:{points:["tr","tl"],overflow:ce,offset:[-4,0],targetOffset:J},topRight:{points:["br","tr"],overflow:ce,offset:[0,-4],targetOffset:J},rightTop:{points:["tl","tr"],overflow:ce,offset:[4,0],targetOffset:J},bottomRight:{points:["tr","br"],overflow:ce,offset:[0,4],targetOffset:J},rightBottom:{points:["bl","br"],overflow:ce,offset:[4,0],targetOffset:J},bottomLeft:{points:["tl","bl"],overflow:ce,offset:[0,4],targetOffset:J},leftBottom:{points:["br","bl"],overflow:ce,offset:[-4,0],targetOffset:J}},Z=O},"8EBN":function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){"use strict";ce.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<ce.modeInfo.length;J++){var O=ce.modeInfo[J];O.mimes&&(O.mime=O.mimes[0])}ce.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var D=ce.modeInfo[U];if(D.mime==Z)return D;if(D.mimes){for(var K=0;K<D.mimes.length;K++)if(D.mimes[K]==Z)return D}}if(/\+xml$/.test(Z))return ce.findModeByMIME("application/xml");if(/\+json$/.test(Z))return ce.findModeByMIME("application/json")},ce.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var D=ce.modeInfo[U];if(D.ext){for(var K=0;K<D.ext.length;K++)if(D.ext[K]==Z)return D}}},ce.findModeByFileName=function(Z){for(var U=0;U<ce.modeInfo.length;U++){var D=ce.modeInfo[U];if(D.file&&D.file.test(Z))return D}var K=Z.lastIndexOf("."),H=K>-1&&Z.substring(K+1,Z.length);if(H)return ce.findModeByExtension(H)},ce.findModeByName=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var D=ce.modeInfo[U];if(D.name.toLowerCase()==Z)return D;if(D.alias){for(var K=0;K<D.alias.length;K++)if(D.alias[K].toLowerCase()==Z)return D}}}})},"8hTe":function(nt,ze,oe){nt.exports={button:"button___1wy9m"}},"9Bee":function(nt,ze,oe){"use strict";var ce=oe("DYRE"),J=oe("zeV3"),O=oe("+L6B"),Z=oe("2/Rp"),U=oe("k1fw"),D=oe("9og8"),K=oe("tJVT"),H=oe("WmNS"),N=oe.n(H),R=oe("q1tI"),b=oe.n(R),_=oe("vg9a"),P=oe("DlQD"),A=oe.n(P),S=oe("rUJ1");function C(le,q){var ee=le.match(/^(\s+)(?:```)/);if(ee===null)return q;var ae=ee[1];return q.split(`
`).map(function(ue){var te=ue.match(/^\s+/);if(te===null)return ue;var ne=Object(K.a)(te,1),he=ne[0];return he.length>=ae.length?ue.slice(ae.length):ue}).join(`
`)}var h=[],a=["<ul>"],l=new A.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){h.length=0,a=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(le,q,ee,ae){if(q>=le.length||le[q].level<=ee)return q;var ue=le[q];ae.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),q++;var te=[];return q=m(le,q,ue.level,te),te.length>0&&(ae.push("<ul>"),te.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),q=m(le,q,ee,ae),q}function L(){return m(h,0,0,a),a.push("</ul>"),a.join("")}var y={heading:function(q){var ee=d.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ae=ee[0],ue=C(ae,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ne=u(),he=ue;ue=ne,o[ne]={type:"block",expression:he}}return{type:"code",raw:ae,lang:te,text:ue}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,u=function(){return"__special_katext_id_".concat(p++,"__")},o={};function E(){return o}function g(){p=0,o={}}function x(le){return le=le.replace(f,function(q,ee){var ae=u();return o[ae]={type:"inline",expression:ee},ae}),le}var I=l.listitem;l.listitem=function(le){return I(x(le))};var j=l.paragraph;l.paragraph=function(le){return j(x(le))};var G=l.tablecell;l.tablecell=function(le,q){return G(x(le),q)},l.code=function(le,q,ee){var ae=(q||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(le,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(ee?le:Object(S.escape)(le,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ee?le:Object(S.escape)(le,!0))+"</code></pre>"},l.heading=function(le,q,ee){var ae=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:ae,level:q,text:le}),"<h"+q+' id="'+ae+'">'+le+"</h"+q+">"},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:y,renderer:l});var V=A.a,M=oe("SJMd"),F=oe("ulZh"),$=oe.n(F),ie=oe("m3rI"),de=oe("Oy/b"),ge=oe("p5ED"),Le=oe("ErOA"),Ee=oe("STEk");/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var _e=function(le,q){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ae){ee.__proto__=ae}||function(ee,ae){for(var ue in ae)Object.prototype.hasOwnProperty.call(ae,ue)&&(ee[ue]=ae[ue])})(le,q)};function Se(le,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=le}_e(le,q),le.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function xe(le,q,ee,ae){return new(ee||(ee=Promise))(function(ue,te){function ne(be){try{fe(ae.next(be))}catch(Ce){te(Ce)}}function he(be){try{fe(ae.throw(be))}catch(Ce){te(Ce)}}function fe(be){var Ce;be.done?ue(be.value):(Ce=be.value,Ce instanceof ee?Ce:new ee(function(Me){Me(Ce)})).then(ne,he)}fe((ae=ae.apply(le,q||[])).next())})}function me(le,q){var ee,ae,ue,te,ne={label:0,sent:function(){if(1&ue[0])throw ue[1];return ue[1]},trys:[],ops:[]};return te={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function he(fe){return function(be){return function(Ce){if(ee)throw new TypeError("Generator is already executing.");for(;ne;)try{if(ee=1,ae&&(ue=2&Ce[0]?ae.return:Ce[0]?ae.throw||((ue=ae.return)&&ue.call(ae),0):ae.next)&&!(ue=ue.call(ae,Ce[1])).done)return ue;switch(ae=0,ue&&(Ce=[2&Ce[0],ue.value]),Ce[0]){case 0:case 1:ue=Ce;break;case 4:return ne.label++,{value:Ce[1],done:!1};case 5:ne.label++,ae=Ce[1],Ce=[0];continue;case 7:Ce=ne.ops.pop(),ne.trys.pop();continue;default:if(!(ue=ne.trys,(ue=ue.length>0&&ue[ue.length-1])||Ce[0]!==6&&Ce[0]!==2)){ne=0;continue}if(Ce[0]===3&&(!ue||Ce[1]>ue[0]&&Ce[1]<ue[3])){ne.label=Ce[1];break}if(Ce[0]===6&&ne.label<ue[1]){ne.label=ue[1],ue=Ce;break}if(ue&&ne.label<ue[2]){ne.label=ue[2],ne.ops.push(Ce);break}ue[2]&&ne.ops.pop(),ne.trys.pop();continue}Ce=q.call(le,ne)}catch(Me){Ce=[6,Me],ae=0}finally{ee=ue=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([fe,be])}}}var z=function(){function le(){}return le.addKey=function(q){le.key=q},Object.defineProperty(le,"isLicensed",{get:function(){return!!le.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(le.key)},enumerable:!1,configurable:!0}),le}(),s=function(){function le(){}return le.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},le.setAttributes=function(q,ee){for(var ae=0,ue=ee;ae<ue.length;ae++){var te=ue[ae],ne=te[0],he=te[1];q.setAttribute(ne,he)}},le.createRect=function(q,ee,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","rect");return ue.setAttribute("width",q.toString()),ue.setAttribute("height",ee.toString()),ae&&le.setAttributes(ue,ae),ue},le.createLine=function(q,ee,ae,ue,te){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",q.toString()),ne.setAttribute("y1",ee.toString()),ne.setAttribute("x2",ae.toString()),ne.setAttribute("y2",ue.toString()),te&&le.setAttributes(ne,te),ne},le.createPolygon=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",q),ee&&le.setAttributes(ae,ee),ae},le.createCircle=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(q/2).toString()),ae.setAttribute("cy",(q/2).toString()),ae.setAttribute("r",q.toString()),ee&&le.setAttributes(ae,ee),ae},le.createEllipse=function(q,ee,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ue.setAttribute("cx",(q/2).toString()),ue.setAttribute("cy",(ee/2).toString()),ue.setAttribute("rx",(q/2).toString()),ue.setAttribute("ry",(ee/2).toString()),ae&&le.setAttributes(ue,ae),ue},le.createGroup=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","g");return q&&le.setAttributes(ee,q),ee},le.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},le.createMarker=function(q,ee,ae,ue,te,ne,he){var fe=document.createElementNS("http://www.w3.org/2000/svg","marker");return le.setAttributes(fe,[["id",q],["orient",ee],["markerWidth",ae.toString()],["markerHeight",ue.toString()],["refX",te.toString()],["refY",ne.toString()]]),fe.appendChild(he),fe},le.createText=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","text");return ee.setAttribute("x","0"),ee.setAttribute("y","0"),q&&le.setAttributes(ee,q),ee},le.createTSpan=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=q,ee&&le.setAttributes(ae,ee),ae},le.createImage=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","image");return q&&le.setAttributes(ee,q),ee},le.createPoint=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=q,ae.y=ee,ae},le.createPath=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",q),ee&&le.setAttributes(ae,ee),ae},le.createElement=function(q,ee){var ae=document.createElementNS("http://www.w3.org/2000/svg",q);return ee&&le.setAttributes(ae,ee),ae},le.getHollowRectanglePath=function(q,ee,ae,ue,te,ne,he,fe){return"M"+q+","+ee+"V"+(ee+ue)+"H"+(q+ae)+"V"+ee+"H"+te+"V"+ne+"H"+(te+he)+"V"+(ne+fe)+"H"+te+"V"+ee+"Z"},le}(),c=function(){function le(q){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+q+"_"}return Object.defineProperty(le.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),le.prototype.addClass=function(q){return this.styleSheet===void 0&&this.addStyleSheet(),q.name=""+this.classNamePrefix+q.localName,this.classes.push(q),this.styleSheet.sheet.insertRule("."+q.name+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length),q},le.prototype.addRule=function(q){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(q),this.styleSheet.sheet.insertRule(q.selector+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length)},le.prototype.addStyleSheet=function(){var q;this.styleSheet=document.createElement("style"),((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).appendChild(this.styleSheet),this.addRule(new k("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new k("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new k("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new X("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new X("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},le.prototype.removeStyleSheet=function(){var q;this.styleSheet&&(((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},le}(),k=function(le,q){this.selector=le,this.style=q},X=function(le,q){this.localName=le,this.style=q},B=function(){function le(){this.blocks=[],this.display=""}return le.prototype.addButtonBlock=function(q){q.className=this.blockClassName,q.buttonClassName=this.buttonClassName,q.buttonColorsClassName=this.buttonColorsClassName,q.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(q)},le.prototype.addElementBlock=function(q){q.className===void 0&&(q.className=this.blockClassName),this.blocks.push(q)},le.prototype.getUI=function(){var q=document.createElement("div");return q.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,q.style.display=this.display,this.blocks.forEach(function(ee){return q.appendChild(ee.getUI())}),q},le}(),se=function(){function le(){}return le.prototype.getUI=function(){var q=document.createElement("div");if(q.className=this.className,this.minWidth!==void 0&&(q.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":q.style.justifyContent="flex-start";break;case"center":q.style.justifyContent="center";break;case"end":q.style.justifyContent="flex-end"}return q.style.whiteSpace="nowrap",q},le}(),ve=function(le){function q(){var ee=le!==null&&le.apply(this,arguments)||this;return ee.buttons=[],ee}return Se(q,le),q.prototype.addButton=function(ee){ee.className=this.buttonClassName,ee.colorsClassName=this.buttonColorsClassName,ee.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(ee)},q.prototype.getUI=function(){var ee=le.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return ee.appendChild(ae.getUI())}),ee},q}(se),Te=function(){function le(q,ee){this._isActive=!1,this._isHidden=!1,this._icon=q,this.title=ee,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(le.prototype,"icon",{get:function(){return this._icon},set:function(q){this._icon=q,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isActive",{get:function(){return this._isActive},set:function(q){this._isActive=q,this.adjustClassName()},enumerable:!1,configurable:!0}),le.prototype.getUI=function(){var q=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 q.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},le.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},le.prototype.hide=function(){this._isHidden=!0},le}(),Pe=function(le){function q(){var ee=le!==null&&le.apply(this,arguments)||this;return ee.elements=[],ee}return Se(q,le),q.prototype.addElement=function(ee){this.elements.push(ee)},q.prototype.getUI=function(){var ee=le.prototype.getUI.call(this);return this.elements.forEach(function(ae){return ee.appendChild(ae)}),ee},q}(se),Ae=function(){function le(q,ee){this.horizontal=q,this.vertical=ee}return Object.defineProperty(le.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),le.prototype.getVerticalLength=function(q){return q/this.ratio},le.prototype.getHorizontalLength=function(q){return q*this.ratio},le}(),De=function(){function le(){}return le.getIcon=function(q,ee){if(q>0&&ee>0){var ae=new Ae(q,ee),ue=ae.ratio>=1?20:ae.getHorizontalLength(20),te=ae.ratio<1?20:ae.getVerticalLength(20),ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ne);var he=s.createDefs();ne.appendChild(he);var fe=s.createElement("clipPath",[["id","text-bg-clip"]]);he.appendChild(fe);var be=s.createPath(s.getHollowRectanglePath((24-ue)/2,(24-te)/2,ue,te,(24-ue)/2+2,(24-te)/2+2,ue-4,te-4));ne.appendChild(be);var Ce=s.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ce.appendChild(s.createTSpan(q+":"+ee)),ne.appendChild(Ce);var Me=Ce.getBBox();s.setAttributes(Ce,[["x",((24-Me.width)/2).toString()],["y",((24-Me.height)/2-Me.y).toString()]]);var Ve=s.createPath(s.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Me.width))/2,(24-Math.ceil(Me.height))/2,Math.ceil(Me.width),Math.ceil(Me.height)));return fe.appendChild(Ve),s.setAttributes(be,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ne),ne.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},le}(),ke=function(le){function q(ee,ae,ue){var te=le.call(this,ee,ae)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=ue,te}return Se(q,le),q.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=ee.className,ae.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(Te),Fe=function(){function le(q,ee){this.GRIP_SIZE=10,this.color=q,this.fillColor=ee,this.visual=s.createGroup(),this.visual.appendChild(s.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(s.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return le.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},le.prototype.setCenter=function(q,ee){this.visual.childNodes.forEach(function(ae){return s.setAttributes(ae,[["cx",q.toString()],["cy",ee.toString()]])})},le}(),je=function(){function le(q,ee,ae,ue){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=ee,this.margin=ae,this.container=ue,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(le.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&s.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),le.prototype.open=function(){var q=this;this.cropShadeElement=s.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=s.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;ee<this.numberOfGridLines;ee++)this.horizontalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return q.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return q.gridContainer.appendChild(ae)}),this.cropRectElement=s.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},le.prototype.setCropRectangle=function(q){this.cropRect=q;var ee=Object.assign({},this.cropRect);this.zoomFactor!==1&&(ee.width=this.cropRect.width*this.zoomFactor,ee.height=this.cropRect.height*this.zoomFactor,ee.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-ee.width/2,ee.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),s.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var ae=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ne){var he=ee.y+ae*(ne+1);s.setAttributes(te,[["x1",""+ee.x],["y1",""+he],["x2",""+(ee.x+ee.width)],["y2",""+he]])});var ue=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ne){var he=ee.x+ue*(ne+1);s.setAttributes(te,[["x1",""+he],["y1",""+ee.y],["x2",""+he],["y2",""+(ee.y+ee.height)]])}),s.setAttributes(this.cropShadeElement,[["d",s.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},le.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},le.prototype.clientToLocalCoordinates=function(q,ee){var ae=this.container.getBoundingClientRect();return{x:q-ae.left+this.margin,y:ee-ae.top+this.margin}},le.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},le.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(ee)}q.preventDefault()},le.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},le.prototype.move=function(q){var ee=q.x-this.previousPoint.x,ae=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},le.prototype.resize=function(q){var ee=Object.assign({},this.cropRect),ae=q.x-this.previousPoint.x,ue=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+ae<this.margin&&(ae=this.margin-ee.x),ee.x+=ae,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=ue,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=ue}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=q,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},le.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),ue=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<ue/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=ue,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=q-this.cropRect.width/2,this.cropRect.y=ee-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},le.prototype.getRescaledRect=function(q,ee,ae,ue,te,ne){var he=ae/q,fe=ue/ee;return{x:(te.x-ne)*he+ne,y:(te.y-ne)*fe+ne,width:te.width*he,height:te.height*fe}},le.prototype.scaleCanvas=function(q,ee){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},le}(),Be=function(){function le(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(le.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),le.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},le.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},le.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},le.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},le.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();s.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},le.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},le.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var ue=ae%5==0?this.height/3:this.height/6;ee+="h4v"+-ue+"h1v"+ue}ee+="v1H0Z",this.scaleShape=s.createPath(ee);var te=s.createTransform();this.scaleShape.transform.baseVal.appendItem(te),q.appendChild(this.scaleShape),this.angleLabelElement=s.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=s.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ne=s.createTSpan("");return ne.innerHTML="&deg;",this.angleLabelElement.appendChild(ne),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},le}(),Ie=function(){function le(){this.naturalSize=!1,this.imageType="image/png"}return le.prototype.rasterize=function(q,ee,ae,ue,te,ne,he){var fe=this;return new Promise(function(be){var Ce=document.createElement("canvas");Ce.width=q.width.baseVal.value-2*ue,Ce.height=q.height.baseVal.value-2*ue;var Me=1,Ve=1;fe.naturalSize===!0?(Me=ee.naturalWidth/(q.width.baseVal.value-2*ue)/ne,Ve=ee.naturalHeight/(q.height.baseVal.value-2*ue)/he,Ce.width=ee.naturalWidth/ne,Ce.height=ee.naturalHeight/he):fe.width!==void 0&&fe.height!==void 0&&(Me=fe.width/ae.width,Ve=fe.height/ae.height,Ce.width*=Me,Ce.height*=Ve);var et=Ce.getContext("2d");et.translate(Ce.width/2,Ce.height/2),et.rotate(te*Math.PI/180),et.scale(ne,he),et.translate(-Ce.width/2,-Ce.height/2),et.drawImage(ee,0,0,Ce.width,Ce.height);var it=document.createElement("canvas");it.width=ae.width*Me,it.height=ae.height*Ve,it.getContext("2d").putImageData(et.getImageData((ae.x-ue)*Me,(ae.y-ue)*Ve,ae.width*Me,ae.height*Ve),0,0),be(it.toDataURL(fe.imageType,fe.imageQuality))})},le}(),Ye=function(){function le(q){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=le.instanceCounter++,this.styles=new c(this.instanceNo),this.target=q,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(le.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(le.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),le.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},le.prototype.show=function(){this.showUI(),this.open()},le.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},le.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},le.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},le.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},le.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},le.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},le.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=ee+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/q;this.resize(ee,ae)}},le.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},le.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",s.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},le.prototype.resize=function(q,ee){this.imageWidth=Math.round(q),this.imageHeight=Math.round(ee),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},le.prototype.setEditingTarget=function(){var q=document.createElement("canvas");q.width=this.target.naturalWidth,q.height=this.target.naturalHeight,q.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var ee=q.toDataURL();s.setAttributes(this.editingTarget,[["href",ee]]),this.setEditingTargetSize()},le.prototype.setTopLeft=function(){var q=this.target.getBoundingClientRect(),ee=this.editorCanvas.getBoundingClientRect();this.left=q.left-ee.left-this.CANVAS_MARGIN,this.top=q.top-ee.top-this.CANVAS_MARGIN},le.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=s.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=s.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=s.createGroup(),this.editingTargetRotationScaleContainer=s.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var q=s.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(q);var ee=s.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(ee),this.editingTargetContainer=s.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},le.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},le.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=s.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new je(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},le.prototype.zoomToCrop=function(){if(this.cropRect){var q=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,ee=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=q+"px "+ee+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-q+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-ee+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},le.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},le.prototype.cropRectChanged=function(q){this.cropRect=q,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},le.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},le.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},le.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},le.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var q=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,ee=this.target.offsetTop>q+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},le.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},le.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new B,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new ve;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var ae=[];this.aspectRatios.forEach(function(Ve){var et=new Te(De.getIcon(Ve.horizontal,Ve.vertical),Ve.horizontal===0&&Ve.vertical===0?"FREE":Ve.horizontal+":"+Ve.vertical);et.onClick=function(){return q.ratioButtonClicked(Ve)},ae.push(et)}),this.aspectRatioButton=new ke(De.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ue=new Te('<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");ue.isActive=this.isGridVisible,ue.onClick=function(){q.isGridVisible=!q.isGridVisible,ue.isActive=q.isGridVisible},ee.addButton(ue);var te=new Te('<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(te.isActive=this.zoomToCropEnabled,te.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,te.isActive=q.zoomToCropEnabled},ee.addButton(te),!z.isLicensed){var ne=new Pe;this.topToolbar.addElementBlock(ne);var he=document.createElement("div");he.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var fe=document.createElement("a");fe.style.color="currentColor",fe.href="https://markerjs.com/products/cropro",fe.target="_blank",fe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',he.appendChild(fe),ne.addElement(he)}var be=new ve;be.minWidth=3*this.toolbarHeight+"px",be.contentAlign="end",this.topToolbar.addButtonBlock(be);var Ce=new Te('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ce.onClick=this.startRenderAndClose,be.addButton(Ce),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ce.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Me=new Te('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Me.onClick=this.close,be.addButton(Me),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},le.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new B,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new ve;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var ae=new Te('<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");ae.onClick=this.rotateLeftButtonClicked,ee.addButton(ae);var ue=new Te('<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");ue.onClick=this.rotateRightButtonClicked,ee.addButton(ue);var te=new Pe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new Be("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(be){q.rotateBy(be),q.straightener.angle=q.rotationAngle},te.addElement(this.straightener.getUI());var ne=new ve;ne.minWidth=2*this.toolbarHeight+"px",ne.contentAlign="end",this.bottomToolbar.addButtonBlock(ne);var he=new Te('<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,ne.addButton(he);var fe=new Te('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");fe.onClick=this.flipVerticallyButtonClicked,ne.addButton(fe)},le.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},le.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=De.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},le.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ae(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},le.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},le.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},le.prototype.restoreState=function(q){if(q){var ee=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},le.prototype.clientToLocalCoordinates=function(q,ee){var ae=this.cropImage.getBoundingClientRect();return{x:q-ae.left,y:ee-ae.top}},le.prototype.onWindowResize=function(){this.positionUI()},le.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},le.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},le.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},le.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},le.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},le.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},le.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},le.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},le.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},le.prototype.startRenderAndClose=function(){return xe(this,void 0,void 0,function(){var q,ee;return me(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return q=ae.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(ue){return ue(q,ee)}),this.close(!0),[2]}})})},le.prototype.render=function(){return xe(this,void 0,void 0,function(){var q;return me(this,function(ee){switch(ee.label){case 0:return(q=new Ie).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),s.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return ee.sent(),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,ee.sent()]}})})},le.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new X("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 X("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new X("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new X("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*q)+`px;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new X("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new k("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new k("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new X("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 X("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new X("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 X("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*q)+`px;
padding: `+q+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new X("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},le.instanceCounter=0,le}(),He=oe("8hTe"),Xe=oe.n(He),Oe=/<pre[^>]*>/g;function tt(le){var q=document.createElement("div");return q.innerHTML=le,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var Qe=ze.a=function(le){var q=le.value,ee=q===void 0?"":q,ae=le.edit,ue=ae===void 0?!1:ae,te=le.className,ne=le.showTextOnly,he=le.showLines,fe=le.replaces,be=le.zoomImg,Ce=le.hasMask,Me=le.style,Ve=Me===void 0?{}:Me,et=le.stylesPrev,it=et===void 0?{}:et,vt=String(ee),st=Object(R.useRef)(),at=Object(R.useRef)(),wt=Object(R.useState)(""),Et=Object(K.a)(wt,2),It=Et[0],Ot=Et[1],xt=Object(R.useState)("office"),mr=Object(K.a)(xt,2),Cr=mr[0],Yt=mr[1],gr=function(){var Ct=new Ye(at.current);Ct.displayMode="popup",Ct.addRenderEventListener(function(){var Jt=Object(D.a)(N.a.mark(function mt(pt){var _t;return N.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return st.current.style.display="none",Ut.next=3,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt}});case 3:_t=Ut.sent,_t!=null&&_t.id&&fe(at.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(_t==null?void 0:_t.id,"?type=").concat(_t.content_type));case 5:case"end":return Ut.stop()}},mt)}));return function(mt){return Jt.apply(this,arguments)}}()),Ct.show()},cr=function(){var Ct=new Ee.a(at.current);Ct.settings.displayMode="popup",Ct.addEventListener("render",function(){var Jt=Object(D.a)(N.a.mark(function mt(pt){var _t;return N.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(st.current.style.display="none",!at.current){Ut.next=6;break}return Ut.next=4,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt.dataUrl}});case 4:_t=Ut.sent,_t!=null&&_t.id&&fe(at.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(_t==null?void 0:_t.id,"?type=").concat(_t.content_type));case 6:case"end":return Ut.stop()}},mt)}));return function(mt){return Jt.apply(this,arguments)}}()),Ct.show(),window.markerArea=Ct},Gr=Object(R.useMemo)(function(){st.current&&(st.current.style.zIndex=-1);try{var Ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ct=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Jt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;vt=vt.replace(Ze,"("+ie.a.API_SERVER+"/api/attachments/").replace(Ct,'"'+ie.a.API_SERVER+"/api/attachments/").replace(Jt,'"'+ie.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(vr){}var mt=V(vt),pt=E();if(vt.match(/\[TOC\]/)&&(mt=mt.replace("<p>[TOC]</p>",L()),w()),mt=mt.replace(/(__special_katext_id_\d+__)/g,function(vr,Ut){var We=pt[Ut],ht=We.type,ri=We.expression;return Object(de.renderToString)(tt(ri)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),mt=mt.replace(/▁/g,"\u2581\u2581\u2581"),g(),ne){var _t=document.createElement("div");return _t.innerHTML=mt,_t.innerText}return setTimeout(function(){return ti()},500),mt},[vt]),$t=Object(R.useRef)();v.WebkitLineClamp=he,he&&(Ve=Object(U.a)(Object(U.a)({},Ve),v));function Nr(Ze){var Ct=Ze.target;if(Ct.tagName.toUpperCase()==="IMG"){if(be){var Jt=Ct.getAttribute("src");Ot(Jt),Yt("image")}}else if(Ct.tagName.toUpperCase()==="A"){var mt=Ct.getAttribute("href");if(mt.indexOf("office")>-1)Ze.preventDefault(),Ot(mt),Yt("office");else if(mt.indexOf("application/pdf")>-1)Ze.preventDefault(),Ot(mt),Yt("pdf");else if(mt.indexOf("text/html")>-1)Ze.preventDefault(),Ot(mt),Yt("html");else if(mt.startsWith("#")){Ze.preventDefault();var pt=document.getElementById(mt.replace("#",""));pt&&pt.scrollIntoView(!0)}}}var ti=function(){var Ct,Jt=(Ct=$t.current)===null||Ct===void 0?void 0:Ct.querySelectorAll("video");Jt==null||Jt.forEach(function(mt){if(mt.oncontextmenu=function(){return!1},mt.src.indexOf(".m3u8")>-1&&!mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var pt=new $.a;pt.loadSource(mt.src),pt.attachMedia(mt)}}})};Object(R.useEffect)(function(){if($t.current&&Gr&&(Gr.match(Oe)&&window.PR.prettyPrint()),$t.current)return $t.current.addEventListener("click",Nr),function(){$t.current.removeEventListener("click",Nr),g(),w()}},[Gr,$t.current,Nr]);var Pt=function(Ct){if(!ue)return;Ct.target.nodeName==="IMG"?(st.current.style.zIndex=1,st.current.style.display="flex",st.current.style.width=Ct.target.clientWidth+"px",st.current.style.height=Ct.target.clientHeight+"px",st.current.style.top=Ct.target.offsetTop+"px",st.current.style.left=Ct.target.offsetLeft+"px",at.current.src=Ct.target.getAttribute("src")):st.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:$t,style:Object(U.a)({},Ve),className:"".concat(te||""," markdown-body ").concat(Xe.a.mdBody),onMouseOver:Pt,dangerouslySetInnerHTML:{__html:Gr}}),b.a.createElement("div",{ref:st,className:Xe.a.button},b.a.createElement(J.a,null,b.a.createElement(Z.a,{onClick:function(){return gr()}},"\u88C1\u526A"),b.a.createElement(Z.a,{onClick:function(){return cr()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:at,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(ge.a,{close:!0,data:It,type:It!=null&&It.length?Cr:"",style:Object(U.a)({},it),onClose:function(){return Ot("")}}))}},"9VGf":function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return O});var ce=oe("q1tI"),J=oe.n(ce);function O(Z,U){var D=Object(ce.useRef)();Object(ce.useEffect)(function(){D.current=Z}),Object(ce.useEffect)(function(){function K(){D.current()}if(U!==null){var H=setInterval(K,U);return function(){return clearInterval(H)}}},[U])}},Bd2K:function(nt,ze,oe){(function(ce){ce(oe("VrN/"),oe("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(N,R,b){if(b!=ce.Init&&b&&N.removeKeyMap("autoCloseTags"),!R)return;var _={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(_["'/'"]=function(P){return D(P)}),(typeof R!="object"||R.whenOpening!==!1)&&(_["'>'"]=function(P){return Z(P)}),N.addKeyMap(_)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Z(N){if(N.getOption("disableInput"))return ce.Pass;for(var R=N.listSelections(),b=[],_=N.getOption("autoCloseTags"),P=0;P<R.length;P++){if(!R[P].empty())return ce.Pass;var A=R[P].head,S=N.getTokenAt(A),C=ce.innerMode(N.getMode(),S.state),h=C.state,a=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(h),l=a&&a.name;if(!l)return ce.Pass;var d=C.mode.configuration=="html",w=typeof _=="object"&&_.dontCloseTags||d&&J,v=typeof _=="object"&&_.indentTags||d&&O;S.end>A.ch&&(l=l.slice(0,l.length-S.end+A.ch));var m=l.toLowerCase();if(!l||S.type=="string"&&(S.end!=A.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&a.close||S.string.indexOf("/")==A.ch-S.start-1||w&&K(w,m)>-1||H(N,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(h)||[],l,A,!0))return ce.Pass;var L=typeof _=="object"&&_.emptyTags;if(L&&K(L,l)>-1){b[P]={text:"/>",newPos:ce.Pos(A.line,A.ch+2)};continue}var y=v&&K(v,m)>-1;b[P]={indent:y,text:">"+(y?`
`:"")+"</"+l+">",newPos:y?ce.Pos(A.line+1,0):ce.Pos(A.line,A.ch+1)}}for(var f=typeof _=="object"&&_.dontIndentOnAutoClose,P=R.length-1;P>=0;P--){var p=b[P];N.replaceRange(p.text,R[P].head,R[P].anchor,"+insert");var u=N.listSelections().slice(0);u[P]={head:p.newPos,anchor:p.newPos},N.setSelections(u),!f&&p.indent&&(N.indentLine(p.newPos.line,null,!0),N.indentLine(p.newPos.line+1,null,!0))}}function U(N,R){for(var b=N.listSelections(),_=[],P=R?"/":"</",A=N.getOption("autoCloseTags"),S=typeof A=="object"&&A.dontIndentOnSlash,C=0;C<b.length;C++){if(!b[C].empty())return ce.Pass;var h=b[C].head,a=N.getTokenAt(h),l=ce.innerMode(N.getMode(),a.state),d=l.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=h.ch-1))return ce.Pass;var w,v=l.mode.name!="xml"&&N.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")w=P+"script";else if(v&&l.mode.name=="css")w=P+"style";else{var m=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!m||m.length&&H(N,m,m[m.length-1],h))return ce.Pass;w=P+m[m.length-1]}N.getLine(h.line).charAt(a.end)!=">"&&(w+=">"),_[C]=w}if(N.replaceSelections(_),b=N.listSelections(),!S)for(var C=0;C<b.length;C++)(C==b.length-1||b[C].head.line<b[C+1].head.line)&&N.indentLine(b[C].head.line)}function D(N){return N.getOption("disableInput")?ce.Pass:U(N,!0)}ce.commands.closeTag=function(N){return U(N)};function K(N,R){if(N.indexOf)return N.indexOf(R);for(var b=0,_=N.length;b<_;++b)if(N[b]==R)return b;return-1}function H(N,R,b,_,P){if(!ce.scanForClosingTag)return!1;var A=Math.min(N.lastLine()+1,_.line+500),S=ce.scanForClosingTag(N,_,null,A);if(!S||S.tag!=b)return!1;for(var C=P?1:0,h=R.length-1;h>=0&&R[h]==b;h--)++C;_=S.to;for(var h=1;h<C;h++){var a=ce.scanForClosingTag(N,_,null,A);if(!a||a.tag!=b)return!1;_=a.to}return!0}})},BjJ7:function(nt,ze,oe){"use strict";oe.d(ze,"d",function(){return J}),oe.d(ze,"c",function(){return O}),oe.d(ze,"e",function(){return Z}),oe.d(ze,"b",function(){return U}),oe.d(ze,"a",function(){return K});var ce=oe("m3rI");function J(H){var N=!0;if(H.length>0){for(var R=0;R<H.length;R++)if(H[R].compile_success==0||!H[R].compile_success){N=!1;break}}else N=!1;return N}function O(H){for(var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],b=0;b<H.length;b++){var _=H[b],P=N?"".concat(N,"/").concat(_.name):"".concat(_.name);R.push({title:_.name,isLeaf:!(_.type==="tree"),key:P})}return R}function Z(H,N,R){for(var b=0;b<H.length;b++){var _=H[b];if(_.key===N){_.children=R;break}_.children&&Z(_.children,N,R)}return H}function U(H,N,R){var b;return function(){var _=this,P=arguments,A=function(){b=null,R||H.apply(_,P)},S=R&&!b;clearTimeout(b),b=setTimeout(A,N),S&&H.apply(_,P)}}var D=!0,K=ce.a.API_SERVER},"C+DQ":function(nt,ze,oe){},DlQD:function(nt,ze,oe){(function(ce,J){nt.exports=J()})(this,function(){"use strict";function ce(ee,ae){for(var ue=0;ue<ae.length;ue++){var te=ae[ue];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ee,te.key,te)}}function J(ee,ae,ue){return ae&&ce(ee.prototype,ae),ue&&ce(ee,ue),ee}function O(ee,ae){if(!ee)return;if(typeof ee=="string")return Z(ee,ae);var ue=Object.prototype.toString.call(ee).slice(8,-1);if(ue==="Object"&&ee.constructor&&(ue=ee.constructor.name),ue==="Map"||ue==="Set")return Array.from(ee);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return Z(ee,ae)}function Z(ee,ae){(ae==null||ae>ee.length)&&(ae=ee.length);for(var ue=0,te=new Array(ae);ue<ae;ue++)te[ue]=ee[ue];return te}function U(ee,ae){var ue;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(ue=O(ee))||ae&&ee&&typeof ee.length=="number"){ue&&(ee=ue);var te=0;return function(){return te>=ee.length?{done:!0}:{done:!1,value:ee[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 ue=ee[Symbol.iterator](),ue.next.bind(ue)}function D(ee,ae){return ae={exports:{}},ee(ae,ae.exports),ae.exports}var K=D(function(ee){function ae(){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 ue(te){ee.exports.defaults=te}ee.exports={defaults:ae(),getDefaults:ae,changeDefaults:ue}}),H=K.defaults,N=K.getDefaults,R=K.changeDefaults,b=/[&<>"']/,_=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},C=function(ae){return S[ae]};function h(ee,ae){if(ae){if(b.test(ee))return ee.replace(_,C)}else if(P.test(ee))return ee.replace(A,C);return ee}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ee){return ee.replace(a,function(ae,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(ee,ae){ee=ee.source||ee,ae=ae||"";var ue={replace:function(ne,he){return he=he.source||he,he=he.replace(d,"$1"),ee=ee.replace(ne,he),ue},getRegex:function(){return new RegExp(ee,ae)}};return ue}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(ee,ae,ue){if(ee){var te;try{te=decodeURIComponent(l(ue)).replace(v,"").toLowerCase()}catch(ne){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ae&&!m.test(ue)&&(ue=o(ae,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(ne){return null}return ue}var y={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(ee,ae){y[" "+ee]||(f.test(ee)?y[" "+ee]=ee+"/":y[" "+ee]=I(ee,"/",!0)),ee=y[" "+ee];var ue=ee.indexOf(":")===-1;return ae.substring(0,2)==="//"?ue?ae:ee.replace(p,"$1")+ae:ae.charAt(0)==="/"?ue?ae:ee.replace(u,"$1")+ae:ee+ae}var E={exec:function(){}};function g(ee){for(var ae=1,ue,te;ae<arguments.length;ae++){ue=arguments[ae];for(te in ue)Object.prototype.hasOwnProperty.call(ue,te)&&(ee[te]=ue[te])}return ee}function x(ee,ae){var ue=ee.replace(/\|/g,function(he,fe,be){for(var Ce=!1,Me=fe;--Me>=0&&be[Me]==="\\";)Ce=!Ce;return Ce?"|":" |"}),te=ue.split(/ \|/),ne=0;if(te.length>ae)te.splice(ae);else for(;te.length<ae;)te.push("");for(;ne<te.length;ne++)te[ne]=te[ne].trim().replace(/\\\|/g,"|");return te}function I(ee,ae,ue){var te=ee.length;if(te===0)return"";for(var ne=0;ne<te;){var he=ee.charAt(te-ne-1);if(he===ae&&!ue)ne++;else if(he!==ae&&ue)ne++;else break}return ee.substr(0,te-ne)}function j(ee,ae){if(ee.indexOf(ae[1])===-1)return-1;for(var ue=ee.length,te=0,ne=0;ne<ue;ne++)if(ee[ne]==="\\")ne++;else if(ee[ne]===ae[0])te++;else if(ee[ne]===ae[1]&&(te--,te<0))return ne;return-1}function G(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:l,edit:w,cleanUrl:L,resolveUrl:o,noopTest:E,merge:g,splitCells:x,rtrim:I,findClosingBracket:j,checkSanitizeDeprecation:G},M=K.defaults,F=V.rtrim,$=V.splitCells,ie=V.escape,de=V.findClosingBracket;function ge(ee,ae,ue){var te=ae.href,ne=ae.title?ie(ae.title):null,he=ee[1].replace(/\\([\[\]])/g,"$1");return ee[0].charAt(0)!=="!"?{type:"link",raw:ue,href:te,title:ne,text:he}:{type:"image",raw:ue,href:te,title:ne,text:ie(he)}}function Le(ee,ae){var ue=ee.match(/^(\s+)(?:```)/);if(ue===null)return ae;var te=ue[1];return ae.split(`
`).map(function(ne){var he=ne.match(/^\s+/);if(he===null)return ne;var fe=he[0];return fe.length>=te.length?ne.slice(te.length):ne}).join(`
`)}var Ee=function(){function ee(ue){this.options=ue||M}var ae=ee.prototype;return ae.space=function(te){var ne=this.rules.block.newline.exec(te);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ae.code=function(te,ne){var he=this.rules.block.code.exec(te);if(he){var fe=ne[ne.length-1];if(fe&&fe.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:F(be,`
`)}}},ae.fences=function(te){var ne=this.rules.block.fences.exec(te);if(ne){var he=ne[0],fe=Le(he,ne[3]||"");return{type:"code",raw:he,lang:ne[2]?ne[2].trim():ne[2],text:fe}}},ae.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]}},ae.nptable=function(te){var ne=this.rules.block.nptable.exec(te);if(ne){var he={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(he.header.length===he.align.length){var fe=he.align.length,be;for(be=0;be<fe;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(fe=he.cells.length,be=0;be<fe;be++)he.cells[be]=$(he.cells[be],he.header.length);return he}}},ae.hr=function(te){var ne=this.rules.block.hr.exec(te);if(ne)return{type:"hr",raw:ne[0]}},ae.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}}},ae.list=function(te){var ne=this.rules.block.list.exec(te);if(ne){for(var he=ne[0],fe=ne[2],be=fe.length>1,Ce=fe[fe.length-1]===")",Me={type:"list",raw:he,ordered:be,start:be?+fe.slice(0,-1):"",loose:!1,items:[]},Ve=ne[0].match(this.rules.block.item),et=!1,it,vt,st,at,wt,Et,It,Ot=Ve.length,xt=0;xt<Ot;xt++)it=Ve[xt],he=it,vt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
`)&&(vt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+vt+"}","gm"),"")),xt!==Ot-1&&(st=this.rules.block.bullet.exec(Ve[xt+1])[0],(be?st.length===1||!Ce&&st[st.length-1]===")":st.length>1||this.options.smartLists&&st!==fe)&&(at=Ve.slice(xt+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-at.length),xt=Ot-1)),wt=et||/\n\n(?!\s*$)/.test(it),xt!==Ot-1&&(et=it.charAt(it.length-1)===`
`,wt||(wt=et)),wt&&(Me.loose=!0),Et=/^\[[ xX]\] /.test(it),It=void 0,Et&&(It=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:he,task:Et,checked:It,loose:wt,text:it});return Me}},ae.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]):ie(ne[0]):ne[0]}},ae.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]}}},ae.table=function(te){var ne=this.rules.block.table.exec(te);if(ne){var he={type:"table",header:$(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 fe=he.align.length,be;for(be=0;be<fe;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(fe=he.cells.length,be=0;be<fe;be++)he.cells[be]=$(he.cells[be].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},ae.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]}},ae.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]}},ae.text=function(te,ne){var he=this.rules.block.text.exec(te);if(he){var fe=ne[ne.length-1];return fe&&fe.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},ae.escape=function(te){var ne=this.rules.inline.escape.exec(te);if(ne)return{type:"escape",raw:ne[0],text:ie(ne[1])}},ae.tag=function(te,ne,he){var fe=this.rules.inline.tag.exec(te);if(fe)return!ne&&/^<a /i.test(fe[0])?ne=!0:ne&&/^<\/a>/i.test(fe[0])&&(ne=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:ne,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ie(fe[0]):fe[0]}},ae.link=function(te){var ne=this.rules.inline.link.exec(te);if(ne){var he=de(ne[2],"()");if(he>-1){var fe=ne[0].indexOf("!")===0?5:4,be=fe+ne[1].length+he;ne[2]=ne[2].substring(0,he),ne[0]=ne[0].substring(0,be).trim(),ne[3]=""}var Ce=ne[2],Me="";if(this.options.pedantic){var Ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);Ve?(Ce=Ve[1],Me=Ve[3]):Me=""}else Me=ne[3]?ne[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var et=ge(ne,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},ne[0]);return et}},ae.reflink=function(te,ne){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var fe=(he[2]||he[1]).replace(/\s+/g," ");if(fe=ne[fe.toLowerCase()],!fe||!fe.href){var be=he[0].charAt(0);return{type:"text",raw:be,text:be}}var Ce=ge(he,fe,he[0]);return Ce}},ae.strong=function(te,ne,he){he===void 0&&(he="");var fe=this.rules.inline.strong.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*te.length);var be=fe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Ce;(fe=be.exec(ne))!=null;)if(Ce=this.rules.inline.strong.middle.exec(ne.slice(0,fe.index+3)),Ce)return{type:"strong",raw:te.slice(0,Ce[0].length),text:te.slice(2,Ce[0].length-2)}}},ae.em=function(te,ne,he){he===void 0&&(he="");var fe=this.rules.inline.em.start.exec(te);if(fe&&(!fe[1]||fe[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*te.length);var be=fe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Ce;(fe=be.exec(ne))!=null;)if(Ce=this.rules.inline.em.middle.exec(ne.slice(0,fe.index+2)),Ce)return{type:"em",raw:te.slice(0,Ce[0].length),text:te.slice(1,Ce[0].length-1)}}},ae.codespan=function(te){var ne=this.rules.inline.code.exec(te);if(ne){var he=ne[2].replace(/\n/g," "),fe=/[^ ]/.test(he),be=he.startsWith(" ")&&he.endsWith(" ");return fe&&be&&(he=he.substring(1,he.length-1)),he=ie(he,!0),{type:"codespan",raw:ne[0],text:he}}},ae.br=function(te){var ne=this.rules.inline.br.exec(te);if(ne)return{type:"br",raw:ne[0]}},ae.del=function(te){var ne=this.rules.inline.del.exec(te);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ae.autolink=function(te,ne){var he=this.rules.inline.autolink.exec(te);if(he){var fe,be;return he[2]==="@"?(fe=ie(this.options.mangle?ne(he[1]):he[1]),be="mailto:"+fe):(fe=ie(he[1]),be=fe),{type:"link",raw:he[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},ae.url=function(te,ne){var he;if(he=this.rules.inline.url.exec(te)){var fe,be;if(he[2]==="@")fe=ie(this.options.mangle?ne(he[0]):he[0]),be="mailto:"+fe;else{var Ce;do Ce=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Ce!==he[0]);fe=ie(he[0]),he[1]==="www."?be="http://"+fe:be=fe}return{type:"link",raw:he[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},ae.inlineText=function(te,ne,he){var fe=this.rules.inline.text.exec(te);if(fe){var be;return ne?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):ie(fe[0]):fe[0]:be=ie(this.options.smartypants?he(fe[0]):fe[0]),{type:"text",raw:fe[0],text:be}}},ee}(),_e=V.noopTest,Se=V.edit,xe=V.merge,me={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:_e,table:_e,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=Se(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=Se(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Se(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=Se(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Se(me._paragraph).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.blockquote=Se(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=xe({},me),me.gfm=xe({},me.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),me.gfm.nptable=Se(me.gfm.nptable).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.gfm.table=Se(me.gfm.table).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.pedantic=xe({},me.normal,{html:Se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:_e,paragraph:Se(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:_e,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:_e,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",z.punctuation=Se(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=Se(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=Se(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=Se(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=Se(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=Se(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=Se(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=Se(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=Se(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=Se(z._blockSkip,"g").getRegex(),z.overlapSkip=Se(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._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])?)+(?![-_])/,z.autolink=Se(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=Se(z.tag).replace("comment",me._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=Se(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=Se(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=Se(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=xe({},z),z.pedantic=xe({},z.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:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=xe({},z.normal,{escape:Se(z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),z.gfm.url=Se(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=xe({},z.gfm,{br:Se(z.br).replace("{2,}","*").getRegex(),text:Se(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var s={block:me,inline:z},c=K.defaults,k=s.block,X=s.inline;function B(ee){return ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function se(ee){var ae="",ue,te,ne=ee.length;for(ue=0;ue<ne;ue++)te=ee.charCodeAt(ue),Math.random()>.5&&(te="x"+te.toString(16)),ae+="&#"+te+";";return ae}var ve=function(){function ee(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||c,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:k.normal,inline:X.normal};this.options.pedantic?(te.block=k.pedantic,te.inline=X.pedantic):this.options.gfm&&(te.block=k.gfm,this.options.breaks?te.inline=X.breaks:te.inline=X.gfm),this.tokenizer.rules=te}ee.lex=function(te,ne){var he=new ee(ne);return he.lex(te)};var ae=ee.prototype;return ae.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},ae.blockTokens=function(te,ne,he){ne===void 0&&(ne=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var fe,be,Ce,Me;te;){if(fe=this.tokenizer.space(te)){te=te.substring(fe.raw.length),fe.type&&ne.push(fe);continue}if(fe=this.tokenizer.code(te,ne)){te=te.substring(fe.raw.length),fe.type?ne.push(fe):(Me=ne[ne.length-1],Me.raw+=`
`+fe.raw,Me.text+=`
`+fe.text);continue}if(fe=this.tokenizer.fences(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.heading(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.nptable(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.hr(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.blockquote(te)){te=te.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],he),ne.push(fe);continue}if(fe=this.tokenizer.list(te)){for(te=te.substring(fe.raw.length),Ce=fe.items.length,be=0;be<Ce;be++)fe.items[be].tokens=this.blockTokens(fe.items[be].text,[],!1);ne.push(fe);continue}if(fe=this.tokenizer.html(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(he&&(fe=this.tokenizer.def(te))){te=te.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.lheading(te)){te=te.substring(fe.raw.length),ne.push(fe);continue}if(he&&(fe=this.tokenizer.paragraph(te))){te=te.substring(fe.raw.length),ne.push(fe);continue}if(fe=this.tokenizer.text(te,ne)){te=te.substring(fe.raw.length),fe.type?ne.push(fe):(Me=ne[ne.length-1],Me.raw+=`
`+fe.raw,Me.text+=`
`+fe.text);continue}if(te){var Ve="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return ne},ae.inline=function(te){var ne,he,fe,be,Ce,Me,Ve=te.length;for(ne=0;ne<Ve;ne++){Me=te[ne];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},be=Me.header.length,he=0;he<be;he++)Me.tokens.header[he]=[],this.inlineTokens(Me.header[he],Me.tokens.header[he]);for(be=Me.cells.length,he=0;he<be;he++)for(Ce=Me.cells[he],Me.tokens.cells[he]=[],fe=0;fe<Ce.length;fe++)Me.tokens.cells[he][fe]=[],this.inlineTokens(Ce[fe],Me.tokens.cells[he][fe]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(be=Me.items.length,he=0;he<be;he++)this.inline(Me.items[he].tokens);break}}}return te},ae.inlineTokens=function(te,ne,he,fe,be){ne===void 0&&(ne=[]),he===void 0&&(he=!1),fe===void 0&&(fe=!1),be===void 0&&(be="");var Ce,Me=te,Ve;if(this.tokens.links){var et=Object.keys(this.tokens.links);if(et.length>0)for(;(Ve=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)et.includes(Ve[0].slice(Ve[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ve=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ce=this.tokenizer.escape(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.tag(te,he,fe)){te=te.substring(Ce.raw.length),he=Ce.inLink,fe=Ce.inRawBlock,ne.push(Ce);continue}if(Ce=this.tokenizer.link(te)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,fe)),ne.push(Ce);continue}if(Ce=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,fe)),ne.push(Ce);continue}if(Ce=this.tokenizer.strong(te,Me,be)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],he,fe),ne.push(Ce);continue}if(Ce=this.tokenizer.em(te,Me,be)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],he,fe),ne.push(Ce);continue}if(Ce=this.tokenizer.codespan(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.br(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.del(te)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],he,fe),ne.push(Ce);continue}if(Ce=this.tokenizer.autolink(te,se)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(!he&&(Ce=this.tokenizer.url(te,se))){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.inlineText(te,fe,B)){te=te.substring(Ce.raw.length),be=Ce.raw.slice(-1),ne.push(Ce);continue}if(te){var it="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return ne},J(ee,null,[{key:"rules",get:function(){return{block:k,inline:X}}}]),ee}(),Te=K.defaults,Pe=V.cleanUrl,Ae=V.escape,De=function(){function ee(ue){this.options=ue||Te}var ae=ee.prototype;return ae.code=function(te,ne,he){var fe=(ne||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(te,fe);be!=null&&be!==te&&(he=!0,te=be)}return fe?'<pre><code class="'+this.options.langPrefix+Ae(fe,!0)+'">'+(he?te:Ae(te,!0))+`</code></pre>
`:"<pre><code>"+(he?te:Ae(te,!0))+`</code></pre>
`},ae.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},ae.html=function(te){return te},ae.heading=function(te,ne,he,fe){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+fe.slug(he)+'">'+te+"</h"+ne+`>
`:"<h"+ne+">"+te+"</h"+ne+`>
`},ae.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ae.list=function(te,ne,he){var fe=ne?"ol":"ul",be=ne&&he!==1?' start="'+he+'"':"";return"<"+fe+be+`>
`+te+"</"+fe+`>
`},ae.listitem=function(te){return"<li>"+te+`</li>
`},ae.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(te){return"<p>"+te+`</p>
`},ae.table=function(te,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ne+`</table>
`},ae.tablerow=function(te){return`<tr>
`+te+`</tr>
`},ae.tablecell=function(te,ne){var he=ne.header?"th":"td",fe=ne.align?"<"+he+' align="'+ne.align+'">':"<"+he+">";return fe+te+"</"+he+`>
`},ae.strong=function(te){return"<strong>"+te+"</strong>"},ae.em=function(te){return"<em>"+te+"</em>"},ae.codespan=function(te){return"<code>"+te+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(te){return"<del>"+te+"</del>"},ae.link=function(te,ne,he){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var fe='<a href="'+Ae(te)+'"';return ne&&(fe+=' title="'+ne+'"'),fe+=">"+he+"</a>",fe},ae.image=function(te,ne,he){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var fe='<img src="'+te+'" alt="'+he+'"';return ne&&(fe+=' title="'+ne+'"'),fe+=this.options.xhtml?"/>":">",fe},ae.text=function(te){return te},ee}(),ke=function(){function ee(){}var ae=ee.prototype;return ae.strong=function(te){return te},ae.em=function(te){return te},ae.codespan=function(te){return te},ae.del=function(te){return te},ae.html=function(te){return te},ae.text=function(te){return te},ae.link=function(te,ne,he){return""+he},ae.image=function(te,ne,he){return""+he},ae.br=function(){return""},ee}(),Fe=function(){function ee(){this.seen={}}var ae=ee.prototype;return ae.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},ee}(),je=K.defaults,Be=V.unescape,Ie=function(){function ee(ue){this.options=ue||je,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ke,this.slugger=new Fe}ee.parse=function(te,ne){var he=new ee(ne);return he.parse(te)};var ae=ee.prototype;return ae.parse=function(te,ne){ne===void 0&&(ne=!0);var he="",fe,be,Ce,Me,Ve,et,it,vt,st,at,wt,Et,It,Ot,xt,mr,Cr,Yt,gr=te.length;for(fe=0;fe<gr;fe++){at=te[fe];switch(at.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(at.tokens),at.depth,Be(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(vt="",it="",Me=at.header.length,be=0;be<Me;be++)it+=this.renderer.tablecell(this.parseInline(at.tokens.header[be]),{header:!0,align:at.align[be]});for(vt+=this.renderer.tablerow(it),st="",Me=at.cells.length,be=0;be<Me;be++){for(et=at.tokens.cells[be],it="",Ve=et.length,Ce=0;Ce<Ve;Ce++)it+=this.renderer.tablecell(this.parseInline(et[Ce]),{header:!1,align:at.align[Ce]});st+=this.renderer.tablerow(it)}he+=this.renderer.table(vt,st);continue}case"blockquote":{st=this.parse(at.tokens),he+=this.renderer.blockquote(st);continue}case"list":{for(wt=at.ordered,Et=at.start,It=at.loose,Me=at.items.length,st="",be=0;be<Me;be++)xt=at.items[be],mr=xt.checked,Cr=xt.task,Ot="",xt.task&&(Yt=this.renderer.checkbox(mr),It?xt.tokens.length>0&&xt.tokens[0].type==="text"?(xt.tokens[0].text=Yt+" "+xt.tokens[0].text,xt.tokens[0].tokens&&xt.tokens[0].tokens.length>0&&xt.tokens[0].tokens[0].type==="text"&&(xt.tokens[0].tokens[0].text=Yt+" "+xt.tokens[0].tokens[0].text)):xt.tokens.unshift({type:"text",text:Yt}):Ot+=Yt),Ot+=this.parse(xt.tokens,It),st+=this.renderer.listitem(Ot,Cr,mr);he+=this.renderer.list(st,wt,Et);continue}case"html":{he+=this.renderer.html(at.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(st=at.tokens?this.parseInline(at.tokens):at.text;fe+1<gr&&te[fe+1].type==="text";)at=te[++fe],st+=`
`+(at.tokens?this.parseInline(at.tokens):at.text);he+=ne?this.renderer.paragraph(st):st;continue}default:{var cr='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(cr);return}else throw new Error(cr)}}}return he},ae.parseInline=function(te,ne){ne=ne||this.renderer;var he="",fe,be,Ce=te.length;for(fe=0;fe<Ce;fe++){be=te[fe];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 Me='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return he},ee}(),Ye=V.merge,He=V.checkSanitizeDeprecation,Xe=V.escape,Oe=K.getDefaults,tt=K.changeDefaults,Qe=K.defaults;function le(ee,ae,ue){if(typeof ee=="undefined"||ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ee)+", string expected");if(typeof ae=="function"&&(ue=ae,ae=null),ae=Ye({},le.defaults,ae||{}),He(ae),ue){var te=ae.highlight,ne;try{ne=ve.lex(ee,ae)}catch(Ce){return ue(Ce)}var he=function(Me){var Ve;if(!Me)try{Ve=Ie.parse(ne,ae)}catch(et){Me=et}return ae.highlight=te,Me?ue(Me):ue(null,Ve)};if(!te||te.length<3)return he();if(delete ae.highlight,!ne.length)return he();var fe=0;le.walkTokens(ne,function(Ce){Ce.type==="code"&&(fe++,setTimeout(function(){te(Ce.text,Ce.lang,function(Me,Ve){if(Me)return he(Me);Ve!=null&&Ve!==Ce.text&&(Ce.text=Ve,Ce.escaped=!0),fe--,fe===0&&he()})},0))}),fe===0&&he();return}try{var be=ve.lex(ee,ae);return ae.walkTokens&&le.walkTokens(be,ae.walkTokens),Ie.parse(be,ae)}catch(Ce){if(Ce.message+=`
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Xe(Ce.message+"",!0)+"</pre>";throw Ce}}le.options=le.setOptions=function(ee){return Ye(le.defaults,ee),tt(le.defaults),le},le.getDefaults=Oe,le.defaults=Qe,le.use=function(ee){var ae=Ye({},ee);if(ee.renderer&&function(){var te=le.defaults.renderer||new De,ne=function(be){var Ce=te[be];te[be]=function(){for(var Me=arguments.length,Ve=new Array(Me),et=0;et<Me;et++)Ve[et]=arguments[et];var it=ee.renderer[be].apply(te,Ve);return it===!1&&(it=Ce.apply(te,Ve)),it}};for(var he in ee.renderer)ne(he);ae.renderer=te}(),ee.tokenizer&&function(){var te=le.defaults.tokenizer||new Ee,ne=function(be){var Ce=te[be];te[be]=function(){for(var Me=arguments.length,Ve=new Array(Me),et=0;et<Me;et++)Ve[et]=arguments[et];var it=ee.tokenizer[be].apply(te,Ve);return it===!1&&(it=Ce.apply(te,Ve)),it}};for(var he in ee.tokenizer)ne(he);ae.tokenizer=te}(),ee.walkTokens){var ue=le.defaults.walkTokens;ae.walkTokens=function(te){ee.walkTokens(te),ue&&ue(te)}}le.setOptions(ae)},le.walkTokens=function(ee,ae){for(var ue=U(ee),te;!(te=ue()).done;){var ne=te.value;ae(ne);switch(ne.type){case"table":{for(var he=U(ne.tokens.header),fe;!(fe=he()).done;){var be=fe.value;le.walkTokens(be,ae)}for(var Ce=U(ne.tokens.cells),Me;!(Me=Ce()).done;)for(var Ve=Me.value,et=U(Ve),it;!(it=et()).done;){var vt=it.value;le.walkTokens(vt,ae)}break}case"list":{le.walkTokens(ne.items,ae);break}default:ne.tokens&&le.walkTokens(ne.tokens,ae)}}},le.Parser=Ie,le.parser=Ie.parse,le.Renderer=De,le.TextRenderer=ke,le.Lexer=ve,le.lexer=ve.lex,le.Tokenizer=Ee,le.Slugger=Fe,le.parse=le;var q=le;return q})},ELLl:function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(S,C,h){h&&h!=ce.Init&&(S.removeKeyMap(U),S.state.closeBrackets=null),C&&(D(Z(C,"pairs")),S.state.closeBrackets=C,S.addKeyMap(U))});function Z(S,C){return C=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[C]!=null?S[C]:J[C]}var U={Backspace:N,Enter:R};function D(S){for(var C=0;C<S.length;C++){var h=S.charAt(C),a="'"+h+"'";U[a]||(U[a]=K(h))}}D(J.pairs+"`");function K(S){return function(C){return _(C,S)}}function H(S){var C=S.state.closeBrackets;if(!C||C.override)return C;var h=S.getModeAt(S.getCursor());return h.closeBrackets||C}function N(S){var C=H(S);if(!C||S.getOption("disableInput"))return ce.Pass;for(var h=Z(C,"pairs"),a=S.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ce.Pass;var d=P(S,a[l].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}for(var l=a.length-1;l>=0;l--){var w=a[l].head;S.replaceRange("",O(w.line,w.ch-1),O(w.line,w.ch+1),"+delete")}}function R(S){var C=H(S),h=C&&Z(C,"explode");if(!h||S.getOption("disableInput"))return ce.Pass;for(var a=S.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ce.Pass;var d=P(S,a[l].head);if(!d||h.indexOf(d)%2!=0)return ce.Pass}S.operation(function(){var w=S.lineSeparator()||`
`;S.replaceSelection(w+w,null),S.execCommand("goCharLeft"),a=S.listSelections();for(var v=0;v<a.length;v++){var m=a[v].head.line;S.indentLine(m,null,!0),S.indentLine(m+1,null,!0)}})}function b(S){var C=ce.cmpPos(S.anchor,S.head)>0;return{anchor:new O(S.anchor.line,S.anchor.ch+(C?-1:1)),head:new O(S.head.line,S.head.ch+(C?1:-1))}}function _(S,C){var h=H(S);if(!h||S.getOption("disableInput"))return ce.Pass;var a=Z(h,"pairs"),l=a.indexOf(C);if(l==-1)return ce.Pass;for(var d=Z(h,"closeBefore"),w=Z(h,"triples"),v=a.charAt(l+1)==C,m=S.listSelections(),L=l%2==0,y,f=0;f<m.length;f++){var p=m[f],u=p.head,o,E=S.getRange(u,O(u.line,u.ch+1));if(L&&!p.empty())o="surround";else if((v||!L)&&E==C)v&&A(S,u)?o="both":w.indexOf(C)>=0&&S.getRange(u,O(u.line,u.ch+3))==C+C+C?o="skipThree":o="skip";else if(v&&u.ch>1&&w.indexOf(C)>=0&&S.getRange(O(u.line,u.ch-2),u)==C+C){if(u.ch>2&&/\bstring/.test(S.getTokenTypeAt(O(u.line,u.ch-2))))return ce.Pass;o="addFour"}else if(v){var g=u.ch==0?" ":S.getRange(O(u.line,u.ch-1),u);if(!ce.isWordChar(E)&&g!=C&&!ce.isWordChar(g))o="both";else return ce.Pass}else if(L&&(E.length===0||/\s/.test(E)||d.indexOf(E)>-1))o="both";else return ce.Pass;if(!y)y=o;else if(y!=o)return ce.Pass}var x=l%2?a.charAt(l-1):C,I=l%2?C:a.charAt(l+1);S.operation(function(){if(y=="skip")S.execCommand("goCharRight");else if(y=="skipThree")for(var j=0;j<3;j++)S.execCommand("goCharRight");else if(y=="surround"){for(var G=S.getSelections(),j=0;j<G.length;j++)G[j]=x+G[j]+I;S.replaceSelections(G,"around"),G=S.listSelections().slice();for(var j=0;j<G.length;j++)G[j]=b(G[j]);S.setSelections(G)}else y=="both"?(S.replaceSelection(x+I,null),S.triggerElectric(x+I),S.execCommand("goCharLeft")):y=="addFour"&&(S.replaceSelection(x+x+x+x,"before"),S.execCommand("goCharRight"))})}function P(S,C){var h=S.getRange(O(C.line,C.ch-1),O(C.line,C.ch+1));return h.length==2?h:null}function A(S,C){var h=S.getTokenAt(O(C.line,C.ch+1));return/\bstring/.test(h.type)&&h.start==C.ch&&(C.ch==0||!/\bstring/.test(S.getTokenTypeAt(C)))}})},Fhpe:function(nt,ze,oe){nt.exports={flex_box_center:"flex_box_center___1W7Bl",flex_space_between:"flex_space_between___3S4Sp",flex_box_vertical_center:"flex_box_vertical_center___5mGEA",flex_box_center_end:"flex_box_center_end___1blqp",flex_box_column:"flex_box_column___4i1E0",CustomCss:"CustomCss___3thFA",CustomTipsModalCss:"CustomTipsModalCss___2aNwC",dropdownmenus:"dropdownmenus___19dGk",popupClassNames:"popupClassNames___3LOFQ",selectdown:"selectdown___1_utH"}},GfqC:function(nt,ze,oe){"use strict";var ce=oe("q1tI"),J=oe.n(ce),O=oe("TSYQ"),Z=oe.n(O);function U(V,M){var F="cannot "+V.method+" "+V.action+" "+M.status+"'",$=new Error(F);return $.status=M.status,$.method=V.method,$.url=V.action,$}function D(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(F){return M}}function K(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(de){de.total>0&&(de.percent=de.loaded/de.total*100),V.onProgress(de)});var F=new FormData;V.data&&Object.keys(V.data).forEach(function(ie){var de=V.data[ie];if(Array.isArray(de)){de.forEach(function(ge){F.append(ie+"[]",ge)});return}F.append(ie,V.data[ie])}),V.file instanceof Blob?F.append(V.filename,V.file,V.file.name):F.append(V.filename,V.file),M.onerror=function(de){V.onError(de)},M.onload=function(){return M.status<200||M.status>=300?V.onError(U(V,M),D(M)):V.onSuccess(D(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ie){$[ie]!==null&&M.setRequestHeader(ie,$[ie])}),M.send(F),{abort:function(){M.abort()}}}var H=+new Date,N=0;function R(){return"rc-upload-"+H+"-"+ ++N}function b(V,M){return V.indexOf(M,V.length-M.length)!==-1}var _=function(V,M){if(V&&M){var F=Array.isArray(M)?M:M.split(","),$=V.name||"",ie=V.type||"",de=ie.replace(/\/.*$/,"");return F.some(function(ge){var Le=ge.trim();return Le.charAt(0)==="."?b($.toLowerCase(),Le.toLowerCase()):/\/\*$/.test(Le)?de===Le.replace(/\/.*$/,""):ie===Le})}return!0};function P(V,M){var F=V.createReader(),$=[];function ie(){F.readEntries(function(de){var ge=Array.prototype.slice.apply(de);$=$.concat(ge);var Le=!ge.length;Le?M($):ie()})}ie()}var A=function(M,F,$){var ie=function de(ge,Le){Le=Le||"",ge.isFile?ge.file(function(Ee){$(Ee)&&(ge.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=ge.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),F([Ee]))}):ge.isDirectory&&P(ge,function(Ee){Ee.forEach(function(_e){de(_e,""+Le+ge.name+"/")})})};M.forEach(function(de){ie(de.webkitGetAsEntry())})},S=A,C=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var F=arguments[M];for(var $ in F)Object.prototype.hasOwnProperty.call(F,$)&&(V[$]=F[$])}return V},h=function(){function V(M,F){var $=[],ie=!0,de=!1,ge=void 0;try{for(var Le=M[Symbol.iterator](),Ee;!(ie=(Ee=Le.next()).done)&&!($.push(Ee.value),F&&$.length===F);ie=!0);}catch(_e){de=!0,ge=_e}finally{try{!ie&&Le.return&&Le.return()}finally{if(de)throw ge}}return $}return function(M,F){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,F);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function V(M,F){for(var $=0;$<F.length;$++){var ie=F[$];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,F,$){return F&&V(M.prototype,F),$&&V(M,$),M}}();function l(V,M,F){return M in V?Object.defineProperty(V,M,{value:F,enumerable:!0,configurable:!0,writable:!0}):V[M]=F,V}function d(V,M){var F={};for(var $ in V){if(M.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;F[$]=V[$]}return F}function w(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function v(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var L=function(M){return Object.keys(M).reduce(function(F,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(F[$]=M[$]),F},{})},y=function(V){m(M,V);function M(){var F,$,ie,de;w(this,M);for(var ge=arguments.length,Le=Array(ge),Ee=0;Ee<ge;Ee++)Le[Ee]=arguments[Ee];return de=($=(ie=v(this,(F=M.__proto__||Object.getPrototypeOf(M)).call.apply(F,[this].concat(Le))),ie),ie.state={uid:R()},ie.reqs={},ie.onChange=function(_e){var Se=_e.target.files;ie.uploadFiles(Se),ie.reset()},ie.onClick=function(_e){var Se=ie.fileInput;if(!Se)return;var xe=ie.props,me=xe.children,z=xe.onClick;me&&me.type==="button"&&(Se.parentNode.focus(),Se.parentNode.querySelector("button").blur()),Se.click(),z&&z(_e)},ie.onKeyDown=function(_e){_e.key==="Enter"&&ie.onClick()},ie.onFileDrop=function(_e){var Se=ie.props.multiple;if(_e.preventDefault(),_e.type==="dragover")return;if(ie.props.directory)S(Array.prototype.slice.call(_e.dataTransfer.items),ie.uploadFiles,function(me){return _(me,ie.props.accept)});else{var xe=Array.prototype.slice.call(_e.dataTransfer.files).filter(function(me){return _(me,ie.props.accept)});Se===!1&&(xe=xe.slice(0,1)),ie.uploadFiles(xe)}},ie.uploadFiles=function(_e){var Se=Array.prototype.slice.call(_e);Se.map(function(xe){return xe.uid=R(),xe}).forEach(function(xe){ie.upload(xe,Se)})},ie.saveFileInput=function(_e){ie.fileInput=_e},$),v(ie,de)}return a(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ie){var de=this,ge=this.props;if(!ge.beforeUpload)return setTimeout(function(){return de.post($)},0);var Le=ge.beforeUpload($,ie);Le&&Le.then?Le.then(function(Ee){var _e=Object.prototype.toString.call(Ee);return _e==="[object File]"||_e==="[object Blob]"?de.post(Ee):de.post($)}).catch(function(Ee){console.log(Ee)}):Le!==!1&&setTimeout(function(){return de.post($)},0);return}},{key:"post",value:function($){var ie=this;if(!this._isMounted)return;var de=this.props,ge=de.onStart,Le=de.onProgress,Ee=de.transformFile,_e=Ee===void 0?function(Se){return Se}:Ee;new Promise(function(Se){var xe=de.action;return typeof xe=="function"&&(xe=xe($)),Se(xe)}).then(function(Se){var xe=$.uid,me=de.customRequest||K,z=Promise.resolve(_e($)).then(function(s){var c=de.data;return typeof c=="function"&&(c=c(s)),Promise.all([s,c])}).catch(function(s){console.error(s)});z.then(function(s){var c=h(s,2),k=c[0],X=c[1],B={action:Se,filename:de.name,data:X,file:k,headers:de.headers,withCredentials:de.withCredentials,method:de.method||"post",onProgress:Le?function(se){Le(se,$)}:null,onSuccess:function(ve,Te){delete ie.reqs[xe],de.onSuccess(ve,$,Te)},onError:function(ve,Te){delete ie.reqs[xe],de.onError(ve,Te,$)}};ge($),ie.reqs[xe]=me(B)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function($){var ie=this.reqs;if($){var de=$;$&&$.uid&&(de=$.uid),ie[de]&&ie[de].abort&&ie[de].abort(),delete ie[de]}else Object.keys(ie).forEach(function(ge){ie[ge]&&ie[ge].abort&&ie[ge].abort(),delete ie[ge]})}},{key:"render",value:function(){var $,ie=this.props,de=ie.component,ge=ie.prefixCls,Le=ie.className,Ee=ie.disabled,_e=ie.id,Se=ie.style,xe=ie.multiple,me=ie.accept,z=ie.children,s=ie.directory,c=ie.openFileDialogOnClick,k=ie.onMouseEnter,X=ie.onMouseLeave,B=d(ie,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),se=Z()(($={},l($,ge,!0),l($,ge+"-disabled",Ee),l($,Le,Le),$)),ve=Ee?{}:{onClick:c?this.onClick:function(){},onKeyDown:c?this.onKeyDown:function(){},onMouseEnter:k,onMouseLeave:X,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(de,C({},ve,{className:se,role:"button",style:Se}),J.a.createElement("input",C({},L(B),{id:_e,type:"file",ref:this.saveFileInput,onClick:function(Pe){return Pe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:s?"directory":null,webkitdirectory:s?"webkitdirectory":null,multiple:xe,onChange:this.onChange})),z)}}]),M}(ce.Component),f=y,p=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var F=arguments[M];for(var $ in F)Object.prototype.hasOwnProperty.call(F,$)&&(V[$]=F[$])}return V},u=function(){function V(M,F){for(var $=0;$<F.length;$++){var ie=F[$];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,F,$){return F&&V(M.prototype,F),$&&V(M,$),M}}();function o(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function E(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function g(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function x(){}var I=function(V){g(M,V);function M(){var F,$,ie,de;o(this,M);for(var ge=arguments.length,Le=Array(ge),Ee=0;Ee<ge;Ee++)Le[Ee]=arguments[Ee];return de=($=(ie=E(this,(F=M.__proto__||Object.getPrototypeOf(M)).call.apply(F,[this].concat(Le))),ie),ie.saveUploader=function(_e){ie.uploader=_e},$),E(ie,de)}return u(M,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return J.a.createElement(f,p({},this.props,{ref:this.saveUploader}))}}]),M}(ce.Component);I.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:x,onError:x,onSuccess:x,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=I,G=ze.a=j},Gytx:function(nt,ze){nt.exports=function(ce,J,O,Z){var U=O?O.call(Z,ce,J):void 0;if(U!==void 0)return!!U;if(ce===J)return!0;if(typeof ce!="object"||!ce||typeof J!="object"||!J)return!1;var D=Object.keys(ce),K=Object.keys(J);if(D.length!==K.length)return!1;for(var H=Object.prototype.hasOwnProperty.bind(J),N=0;N<D.length;N++){var R=D[N];if(!H(R))return!1;var b=ce[R],_=J[R];if(U=O?O.call(Z,b,_,R):void 0,U===!1||U===void 0&&b!==_)return!1}return!0}},HmJG:function(nt,ze,oe){},IE1O:function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return f});var ce=oe("+L6B"),J=oe("2/Rp"),O=oe("2qtc"),Z=oe("kLXV"),U=oe("DZo9"),D=oe("8z0m"),K=oe("5NDa"),H=oe("5rEg"),N=oe("miYZ"),R=oe("tsqr"),b=oe("9og8"),_=oe("y8nQ"),P=oe("Vl3Y"),A=oe("tJVT"),S=oe("WmNS"),C=oe.n(S),h=oe("q1tI"),a=oe.n(h),l=oe("KeLC"),d=oe.n(l),w=oe("Fhpe"),v=oe.n(w),m=oe("m3rI"),L=oe("jN4g"),y=function(u){var o,E,g,x,I=u.visible,j=u.onOk,G=u.onCancel,V=u.title,M=V===void 0?"\u9009\u62E9\u8BA4\u8BC1\u56E2\u961F\u6559\u5E08":V,F=P.a.useForm(),$=Object(A.a)(F,1),ie=$[0],de=Object(h.useState)(!1),ge=Object(A.a)(de,2),Le=ge[0],Ee=ge[1],_e=Object(h.useState)([]),Se=Object(A.a)(_e,2),xe=Se[0],me=Se[1],z=Object(h.useState)([]),s=Object(A.a)(z,2),c=s[0],k=s[1],X=Object(h.useState)(!1),B=Object(A.a)(X,2),se=B[0],ve=B[1];Object(h.useEffect)(function(){if(I!=null&&I.name){var Be,Ie,Ye,He;ie.setFieldsValue({name:I==null?void 0:I.name});var Xe=I!=null&&(Be=I.cover_url)!==null&&Be!==void 0&&Be.includes("attachments")?[{response:{id:I==null||((Ie=I.cover_url)===null||Ie===void 0)?void 0:Ie.split("/")[3]}}]:[],Oe=I!=null&&(Ye=I.backbground_image_url)!==null&&Ye!==void 0&&Ye.includes("attachments")?[{response:{id:I==null||((He=I.backbground_image_url)===null||He===void 0)?void 0:He.split("/")[3]}}]:[];me(Xe),k(Oe)}},[I]);var Te=function(){ie.submit()},Pe=function(){G()},Ae=function(){var Be=Object(b.a)(C.a.mark(function Ie(Ye){var He,Xe,Oe,tt,Qe;return C.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:Ee(!0),console.log(xe,c,3333),Qe={name:Ye==null?void 0:Ye.name,cover_id:(xe==null||((He=xe[0])===null||He===void 0||((Xe=He.response)===null||Xe===void 0))?void 0:Xe.id)||"",backbground_image_id:(c==null||((Oe=c[0])===null||Oe===void 0||((tt=Oe.response)===null||tt===void 0))?void 0:tt.id)||""},j(Qe);case 4:case"end":return q.stop()}},Ie)}));return function(Ye){return Be.apply(this,arguments)}}(),De=function(Ie,Ye){var He=["uploading","done","removed"];He.includes(Ie.file.status)&&(Ie.file.status==="uploading"&&ve(!0),Ie.file.status==="done"&&ve(!1),Ye===1?me(Ie.fileList):k(Ie.fileList))},ke=function(Ie,Ye){Ye===1?me([]):k([])},Fe=function(Ie,Ye){var He=Ie.type==="image/jpeg"||Ie.type==="image/png";if(!He)return R.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var Xe=Ie.size/1024/1024>2;return Xe?(R.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(Ye===1?me([]):k([]),!0)},je=function(Ie){var Ye,He,Xe,Oe;return a.a.createElement("div",{className:d.a.img},a.a.createElement("img",{src:m.a.API_SERVER+"/api/attachments/"+(Ie===1?xe==null||((Ye=xe[0])===null||Ye===void 0||((He=Ye.response)===null||He===void 0))?void 0:He.id:c==null||((Xe=c[0])===null||Xe===void 0||((Oe=Xe.response)===null||Oe===void 0))?void 0:Oe.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(L.a,{onClick:function(){Ie===1?me([]):k([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(Z.a,{title:M,visible:I,onOk:Te,centered:!0,onCancel:Pe,confirmLoading:Le,okButtonProps:{disabled:se},width:686,afterClose:function(){Ee(!1),me([]),k([]),ie.resetFields()},okText:I!=null&&I.name?"\u786E\u8BA4":"\u786E\u8BA4\u65B0\u5EFA",cancelText:"\u53D6\u6D88",wrapClassName:v.a.CustomCss},a.a.createElement(P.a,{form:ie,colon:!1,onFinish:Ae,className:d.a.form},a.a.createElement(P.a.Item,{label:"\u793E\u533A\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{whitespace:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{max:60,message:"\u53EA\u80FD\u8F93\u516560\u4E2A\u5B57\u7B26"}]},a.a.createElement(H.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(P.a.Item,{name:"cover_id",label:"\u4E0A\u4F20\u5C01\u9762\u56FE",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:d.a.upload},xe!=null&&(o=xe[0])!==null&&o!==void 0&&(E=o.response)!==null&&E!==void 0&&E.id?je(1):a.a.createElement(D.a,{fileList:xe,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(Ie){return De(Ie,1)},onRemove:function(Ie){return ke(Ie,1)},beforeUpload:function(Ie){return Fe(Ie,1)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:d.a.btn},a.a.createElement("i",{className:"iconfont icon-shangchuantupian2"}),"\u4E0A\u4F20\u56FE\u7247")))),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u7528278*225\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"),a.a.createElement(P.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:d.a.upload},c!=null&&(g=c[0])!==null&&g!==void 0&&(x=g.response)!==null&&x!==void 0&&x.id?je(2):a.a.createElement(D.a,{fileList:c,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(Ie){return De(Ie,2)},onRemove:function(Ie){return ke(Ie,2)},beforeUpload:function(Ie){return Fe(Ie,2)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:d.a.btn},a.a.createElement("i",{className:"iconfont icon-shangchuantupian2"}),"\u4E0A\u4F20\u56FE\u7247")))),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u75281920*220\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002")))},f=function(u){var o,E,g,x,I=u.data,j=u.onOk,G=P.a.useForm(),V=Object(A.a)(G,1),M=V[0],F=Object(h.useState)(!1),$=Object(A.a)(F,2),ie=$[0],de=$[1],ge=Object(h.useState)([]),Le=Object(A.a)(ge,2),Ee=Le[0],_e=Le[1],Se=Object(h.useState)([]),xe=Object(A.a)(Se,2),me=xe[0],z=xe[1],s=Object(h.useState)(!1),c=Object(A.a)(s,2),k=c[0],X=c[1];Object(h.useEffect)(function(){if(I!=null&&I.name){var De,ke,Fe,je;M.setFieldsValue({name:I==null?void 0:I.name});var Be=I!=null&&(De=I.cover_url)!==null&&De!==void 0&&De.includes("attachments")?[{response:{id:I==null||((ke=I.cover_url)===null||ke===void 0)?void 0:ke.split("/")[3]}}]:[],Ie=I!=null&&(Fe=I.backbground_image_url)!==null&&Fe!==void 0&&Fe.includes("attachments")?[{response:{id:I==null||((je=I.backbground_image_url)===null||je===void 0)?void 0:je.split("/")[3]}}]:[];_e(Be),z(Ie)}},[I]);var B=function(){M.submit()},se=function(){var De=Object(b.a)(C.a.mark(function ke(Fe){var je,Be,Ie,Ye,He;return C.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:de(!0),He={name:Fe==null?void 0:Fe.name,cover_id:(Ee==null||((je=Ee[0])===null||je===void 0||((Be=je.response)===null||Be===void 0))?void 0:Be.id)||"",backbground_image_id:(me==null||((Ie=me[0])===null||Ie===void 0||((Ye=Ie.response)===null||Ye===void 0))?void 0:Ye.id)||""},j(He,function(){de(!1)});case 3:case"end":return Oe.stop()}},ke)}));return function(Fe){return De.apply(this,arguments)}}(),ve=function(ke,Fe){var je=["uploading","done","removed"];je.includes(ke.file.status)&&(ke.file.status==="uploading"&&X(!0),ke.file.status==="done"&&X(!1),Fe===1?_e(ke.fileList):z(ke.fileList))},Te=function(ke,Fe){Fe===1?_e([]):z([])},Pe=function(ke,Fe){var je=ke.type==="image/jpeg"||ke.type==="image/png";if(!je)return R.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var Be=ke.size/1024/1024>2;return Be?(R.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(Fe===1?_e([]):z([]),!0)},Ae=function(ke){var Fe,je,Be,Ie;return a.a.createElement("div",{className:d.a.img},a.a.createElement("img",{src:m.a.API_SERVER+"/api/attachments/"+(ke===1?Ee==null||((Fe=Ee[0])===null||Fe===void 0||((je=Fe.response)===null||je===void 0))?void 0:je.id:me==null||((Be=me[0])===null||Be===void 0||((Ie=Be.response)===null||Ie===void 0))?void 0:Ie.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(L.a,{onClick:function(){ke===1?_e([]):z([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(P.a,{form:M,colon:!1,onFinish:se,labelCol:{span:3},wrapperCol:{span:19},className:d.a.form},a.a.createElement(P.a.Item,{label:"\u793E\u533A\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{whitespace:!0,message:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"},{max:60,message:"\u53EA\u80FD\u8F93\u516560\u4E2A\u5B57\u7B26"}]},a.a.createElement(H.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(P.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",valuePropName:"fileList"},a.a.createElement("div",{className:d.a.upload},Ee!=null&&(o=Ee[0])!==null&&o!==void 0&&(E=o.response)!==null&&E!==void 0&&E.id?Ae(1):a.a.createElement(D.a,{fileList:Ee,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(ke){return ve(ke,1)},onRemove:function(ke){return Te(ke,1)},beforeUpload:function(ke){return Pe(ke,1)},withCredentials:!0,accept:"image/*"},a.a.createElement(J.a,null,a.a.createElement("i",{className:"iconfont icon-shangchuantupian2 mr10"}),"\u4E0A\u4F20\u56FE\u7247")),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u7528278*225\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"))),a.a.createElement(P.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList"},a.a.createElement("div",{className:d.a.upload},me!=null&&(g=me[0])!==null&&g!==void 0&&(x=g.response)!==null&&x!==void 0&&x.id?Ae(2):a.a.createElement(D.a,{fileList:me,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(ke){return ve(ke,2)},onRemove:function(ke){return Te(ke,2)},beforeUpload:function(ke){return Pe(ke,2)},withCredentials:!0,accept:"image/*"},a.a.createElement(J.a,null,a.a.createElement("i",{className:"iconfont icon-shangchuantupian2 mr10"}),"\u4E0A\u4F20\u56FE\u7247")),a.a.createElement("aside",null,"\u4EC5\u652F\u6301\u4E0A\u4F20jpg/png\u7B49\u683C\u5F0F\u6587\u4EF6\uFF0C\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC72M,\u5EFA\u8BAE\u4F7F\u75281920*220\u50CF\u7D20\uFF1B\u5982\u4E0D\u4E0A\u4F20\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u7CFB\u7EDF\u56FE\u7247\u3002"))),a.a.createElement(J.a,{disabled:k,loading:ie,type:"primary",onClick:B,style:{marginLeft:120}},"\u786E\u8BA4"))};ze.b=y},KeLC:function(nt,ze,oe){nt.exports={flex_box_center:"flex_box_center___WC8D3",flex_space_between:"flex_space_between___1oJuS",flex_box_vertical_center:"flex_box_vertical_center___wHVAB",flex_box_center_end:"flex_box_center_end___2rX0l",flex_box_column:"flex_box_column___Iu_rf",form:"form___RRVwq",btn:"btn___144Et",img:"img___qC8f0"}},LdHM:function(nt,ze,oe){"use strict";oe.d(ze,"b",function(){return d}),oe.d(ze,"a",function(){return v});var ce=oe("1OyB"),J=oe("vuIU"),O=oe("Ji7U"),Z=oe("LK+K"),U=oe("q1tI"),D=oe("rePB"),K=oe("Ff2n"),H=oe("ODXe"),N=oe("4IlW"),R=oe("bX4T"),b=oe("YrtM"),_=oe("TSYQ"),P=oe.n(_),A=oe("+nKL"),S=oe("8OUc"),C=function($,ie){var de=$.prefixCls,ge=$.id,Le=$.flattenOptions,Ee=$.childrenAsData,_e=$.values,Se=$.searchValue,xe=$.multiple,me=$.defaultActiveFirstOption,z=$.height,s=$.itemHeight,c=$.notFoundContent,k=$.open,X=$.menuItemSelectedIcon,B=$.virtual,se=$.onSelect,ve=$.onToggleOpen,Te=$.onActiveValue,Pe=$.onScroll,Ae=$.onMouseEnter,De="".concat(de,"-item"),ke=Object(b.a)(function(){return Le},[k,Le],function(q,ee){return ee[0]&&q[1]!==ee[1]}),Fe=U.useRef(null),je=function(ee){ee.preventDefault()},Be=function(ee){Fe.current&&Fe.current.scrollTo({index:ee})},Ie=function(ee){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=ke.length,te=0;te<ue;te+=1){var ne=(ee+te*ae+ue)%ue,he=ke[ne],fe=he.group,be=he.data;if(!fe&&!be.disabled)return ne}return-1},Ye=U.useState(function(){return Ie(0)}),He=Object(H.a)(Ye,2),Xe=He[0],Oe=He[1],tt=function(ee){Oe(ee);var ae=ke[ee];if(!ae){Te(null,-1);return}Te(ae.data.value,ee)};U.useEffect(function(){tt(me!==!1?Ie(0):-1)},[ke.length,Se]),U.useEffect(function(){var q=setTimeout(function(){if(!xe&&k&&_e.size===1){var ee=Array.from(_e)[0],ae=ke.findIndex(function(ue){var te=ue.data;return te.value===ee});tt(ae),Be(ae)}});return function(){return clearTimeout(q)}},[k]);var Qe=function(ee){ee!==void 0&&se(ee,{selected:!_e.has(ee)}),xe||ve(!1)};if(U.useImperativeHandle(ie,function(){return{onKeyDown:function(ee){var ae=ee.which;switch(ae){case N.a.UP:case N.a.DOWN:{var ue=0;if(ae===N.a.UP?ue=-1:ae===N.a.DOWN&&(ue=1),ue!==0){var te=Ie(Xe+ue,ue);Be(te),tt(te)}break}case N.a.ENTER:{var ne=ke[Xe];ne&&!ne.data.disabled?Qe(ne.data.value):Qe(void 0),k&&ee.preventDefault();break}case N.a.ESC:ve(!1)}},onKeyUp:function(){},scrollTo:function(ee){Be(ee)}}}),ke.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),className:"".concat(De,"-empty"),onMouseDown:je},c);function le(q){var ee=ke[q];if(!ee)return null;var ae=ee.data||{},ue=ae.value,te=ae.label,ne=ae.children,he=Object(R.a)(ae,!0),fe=Ee?ne:te;return ee?U.createElement("div",Object.assign({"aria-label":typeof fe=="string"?fe:null},he,{key:q,role:"option",id:"".concat(ge,"_list_").concat(q),"aria-selected":_e.has(ue)}),ue):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),style:{height:0,width:0,overflow:"hidden"}},le(Xe-1),le(Xe),le(Xe+1)),U.createElement(A.a,{itemKey:"key",ref:Fe,data:ke,height:z,itemHeight:s,fullHeight:!1,onMouseDown:je,onScroll:Pe,virtual:B,onMouseEnter:Ae},function(q,ee){var ae,ue=q.group,te=q.groupOption,ne=q.data,he=ne.label,fe=ne.key;if(ue)return U.createElement("div",{className:P()(De,"".concat(De,"-group"))},he!==void 0?he:fe);var be=ne.disabled,Ce=ne.value,Me=ne.title,Ve=ne.children,et=ne.style,it=ne.className,vt=Object(K.a)(ne,["disabled","value","title","children","style","className"]),st=_e.has(Ce),at="".concat(De,"-option"),wt=P()(De,at,it,(ae={},Object(D.a)(ae,"".concat(at,"-grouped"),te),Object(D.a)(ae,"".concat(at,"-active"),Xe===ee&&!be),Object(D.a)(ae,"".concat(at,"-disabled"),be),Object(D.a)(ae,"".concat(at,"-selected"),st),ae)),Et=Ee?Ve:he,It=!X||typeof X=="function"||st;return U.createElement("div",Object.assign({},vt,{"aria-selected":st,className:wt,title:Me,onMouseMove:function(){if(Xe===ee||be)return;tt(ee)},onClick:function(){be||Qe(Ce)},style:et}),U.createElement("div",{className:"".concat(at,"-content")},Et||Ce),U.isValidElement(X)||st,It&&U.createElement(S.a,{className:"".concat(De,"-option-state"),customizeIcon:X,customizeIconProps:{isSelected:st}},st?"\u2713":null))}))},h=U.forwardRef(C);h.displayName="OptionList";var a=h,l=function(){return null};l.isSelectOption=!0;var d=l,w=function(){return null};w.isSelectOptGroup=!0;var v=w,m=oe("VTBJ"),L=oe("Zm9Q");function y(F){var $=F.key,ie=F.props,de=ie.children,ge=ie.value,Le=Object(K.a)(ie,["children","value"]);return Object(m.a)({key:$,value:ge!==void 0?ge:$,children:de},Le)}function f(F){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(F).map(function(ie,de){if(!U.isValidElement(ie)||!ie.type)return null;var ge=ie.type.isSelectOptGroup,Le=ie.key,Ee=ie.props,_e=Ee.children,Se=Object(K.a)(Ee,["children"]);return $||!ge?y(ie):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Le===null?de:Le,"__"),label:Le},Se),{},{options:f(_e)})}).filter(function(ie){return ie})}var p=oe("2Qr1"),u=oe("qNPg"),o=oe("U8pU"),E=oe("Kwbf"),g=oe("WKfj");function x(F){var $=F.mode,ie=F.options,de=F.children,ge=F.backfill,Le=F.allowClear,Ee=F.placeholder,_e=F.getInputElement,Se=F.showSearch,xe=F.onSearch,me=F.defaultOpen,z=F.autoFocus,s=F.labelInValue,c=F.value,k=F.inputValue,X=F.optionLabelProp,B=$==="multiple"||$==="tags",se=Se!==void 0?Se:B||$==="combobox",ve=ie||f(de);if(Object(E.a)($!=="tags"||ve.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Te=ve.some(function(De){return De.options?De.options.some(function(ke){return typeof("value"in ke?ke.value:ke.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(E.a)(!Te,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)($!=="combobox"||!X,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)($==="combobox"||!ge,"`backfill` only works with `combobox` mode."),Object(E.a)($==="combobox"||!_e,"`getInputElement` only work with `combobox` mode."),Object(E.b)($!=="combobox"||!_e||!Le||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),xe&&!se&&$!=="combobox"&&$!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!me||z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),c!=null){var Pe=Object(g.d)(c);Object(E.a)(!s||Pe.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(E.a)(!B||Array.isArray(c),"`value` should be array when `mode` is `multiple` or `tags`")}if(de){var Ae=null;Object(L.a)(de).some(function(De){if(!U.isValidElement(De)||!De.type)return!1;var ke=De.type;if(ke.isSelectOption)return!1;if(ke.isSelectOptGroup){var Fe=Object(L.a)(De.props.children).every(function(je){return!U.isValidElement(je)||!De.type||je.type.isSelectOption?!0:(Ae=je.type,!1)});return!Fe}return Ae=ke,!0}),Ae&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ae.displayName||Ae.name||Ae,"`.")),Object(E.a)(k===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=x,j=Object(u.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:f,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:I,fillOptionsWithMissingValue:p.a}),G=function(F){Object(O.a)(ie,F);var $=Object(Z.a)(ie);function ie(){var de;return Object(ce.a)(this,ie),de=$.apply(this,arguments),de.selectRef=U.createRef(),de.focus=function(){de.selectRef.current.focus()},de.blur=function(){de.selectRef.current.blur()},de}return Object(J.a)(ie,[{key:"render",value:function(){return U.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),ie}(U.Component);G.Option=d,G.OptGroup=v;var V=G,M=ze.c=V},M8RZ:function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return N});var ce=oe("fWQN"),J=oe("mtLc"),O=oe("yKVA"),Z=oe("879j"),U=oe("q1tI"),D=oe.n(U),K=oe("i8i4"),H=oe.n(K),N=function(R){Object(O.a)(_,R);var b=Object(Z.a)(_);function _(P){var A;Object(ce.a)(this,_),A=b.call(this,P);var S=window.document;return A.node=S.createElement("div"),S.body.appendChild(A.node),A}return Object(J.a)(_,[{key:"render",value:function(){var A=this.props.children;return Object(K.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),_}(D.a.Component)},NLgs:function(nt,ze,oe){"use strict";oe.d(ze,"e",function(){return h}),oe.d(ze,"f",function(){return a}),oe.d(ze,"d",function(){return d}),oe.d(ze,"c",function(){return w}),oe.d(ze,"a",function(){return v}),oe.d(ze,"b",function(){return m});var ce=oe("miYZ"),J=oe("tsqr"),O=oe("9og8"),Z=oe("2qtc"),U=oe("kLXV"),D=oe("WmNS"),K=oe.n(D),H=oe("q1tI"),N=oe.n(H),R=oe("9kvl"),b=oe("xKgJ"),_=oe("1vsH"),P=oe("RCxd"),A=oe("yTi+"),S=oe.n(A),C=oe("m3rI"),h=function(y){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(a(y)&&l(f))},a=function(y){return Object(b.p)()?!0:(y({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},l=function(){var y,f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,p=Object(R.c)()._store.getState(),u=p.user;return(y=u.userInfo)!==null&&y!==void 0&&y.profile_completed?!0:(U.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:f?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){R.d.push("/account/profile/edit")}}),!1)},d=function(){var y,f=Object(R.c)()._store.getState(),p=f.user;return(y=p.userInfo)!==null&&y!==void 0&&y.professional_certification?!0:(U.a.confirm({title:"\u63D0\u793A",centered:!0,content:N.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(_.S)("/account/certification")}}),!1)},w=function(){var y;if(Object(b.a)())return!0;var f=Object(R.c)()._store.getState(),p=f.user,u=f.globalSetting;return U.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:N.a.createElement("div",{className:"tc",style:{marginLeft:-38}},N.a.createElement("p",null,"\u626B\u7801\u6DFB\u52A0\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),N.a.createElement("img",{src:C.a.IMG_SERVER+(u==null||((y=u.setting)===null||y===void 0)?void 0:y.authority_qrcode_url),width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1},v=function(y,f){var p;if(y)return!0;var u=Object(R.c)()._store.getState(),o=u.user,E=u.globalSetting;return U.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:N.a.createElement("div",null,N.a.createElement("p",null,f||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),N.a.createElement("div",{style:{marginLeft:"110px"}},N.a.createElement("img",{src:C.a.IMG_SERVER+(E==null||((p=E.setting)===null||p===void 0)?void 0:p.authority_qrcode_url),width:200}),N.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(_.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1},m=function(y){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",p=Object(R.c)()._store.getState(),u=p.shixunsDetail.detail;return(u==null?void 0:u.public)===2||(u==null?void 0:u.public)===1||(u==null?void 0:u.shixun_status)===3?(U.a.info({centered:!0,icon:N.a.createElement(P.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:N.a.createElement("div",{className:"tc",style:{marginLeft:-38}},N.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},N.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(u==null?void 0:u.public)===2?"\u5DF2\u516C\u5F00":(u==null?void 0:u.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",f,"\u3002"),N.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),N.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:S.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(u==null?void 0:u.shixun_status)===2?(U.a.confirm({centered:!0,icon:N.a.createElement(P.a,null),title:"\u63D0\u793A",content:N.a.createElement("div",null,N.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",f,"\u3002"),N.a.createElement("br",null),N.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){U.a.confirm({width:440,centered:!0,icon:N.a.createElement(P.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var E=Object(O.a)(K.a.mark(function x(){var I;return K.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,y({type:"shixunsDetail/cancelRelease",payload:{id:u==null?void 0:u.identifier}});case 2:I=G.sent,I.status!==401&&(J.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),y({type:"shixunsDetail/getShixunsDetail",payload:{id:u==null?void 0:u.identifier}}),y({type:"practiceSetting/getCommonData",payload:{id:u==null?void 0:u.identifier}}));case 4:case"end":return G.stop()}},x)}));function g(){return E.apply(this,arguments)}return g}()})}}),!0):!1}},OLES:function(nt,ze,oe){"use strict";var ce=oe("U8pU"),J=oe("VTBJ"),O=oe("Ff2n"),Z=oe("q1tI"),U=oe("uciX"),D=oe("7ixt"),K=function(P){var A=P.overlay,S=P.prefixCls,C=P.id,h=P.overlayInnerStyle;return Z.createElement("div",{className:"".concat(S,"-inner"),id:C,role:"tooltip",style:h},typeof A=="function"?A():A)},H=K,N=function(P,A){var S=P.overlayClassName,C=P.trigger,h=C===void 0?["hover"]:C,a=P.mouseEnterDelay,l=a===void 0?0:a,d=P.mouseLeaveDelay,w=d===void 0?.1:d,v=P.overlayStyle,m=P.prefixCls,L=m===void 0?"rc-tooltip":m,y=P.children,f=P.onVisibleChange,p=P.afterVisibleChange,u=P.transitionName,o=P.animation,E=P.placement,g=E===void 0?"right":E,x=P.align,I=x===void 0?{}:x,j=P.destroyTooltipOnHide,G=j===void 0?!1:j,V=P.defaultVisible,M=P.getTooltipContainer,F=P.overlayInnerStyle,$=Object(O.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ie=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(A,function(){return ie.current});var de=Object(J.a)({},$);"visible"in P&&(de.popupVisible=P.visible);var ge=function(){var xe=P.arrowContent,me=xe===void 0?null:xe,z=P.overlay,s=P.id;return[Z.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},me),Z.createElement(H,{key:"content",prefixCls:L,id:s,overlay:z,overlayInnerStyle:F})]},Le=!1,Ee=!1;if(typeof G=="boolean")Le=G;else if(G&&Object(ce.a)(G)==="object"){var _e=G.keepParent;Le=_e===!0,Ee=_e===!1}return Z.createElement(U.a,Object.assign({popupClassName:S,prefixCls:L,popup:ge,action:h,builtinPlacements:D.a,popupPlacement:g,ref:ie,popupAlign:I,getPopupContainer:M,onPopupVisibleChange:f,afterPopupVisibleChange:p,popupTransitionName:u,popupAnimation:o,defaultPopupVisible:V,destroyPopupOnHide:Le,autoDestroy:Ee,mouseLeaveDelay:w,popupStyle:v,mouseEnterDelay:l},de),y)},R=Object(Z.forwardRef)(N),b=ze.a=R},Ot1p:function(nt,ze,oe){"use strict";var ce=oe("2qtc"),J=oe("kLXV"),O=oe("rAM+"),Z=oe("miYZ"),U=oe("tsqr"),D=oe("9og8"),K=oe("tJVT"),H=oe("jrin"),N=oe("WmNS"),R=oe.n(N),b=oe("q1tI"),_=oe.n(b),P=oe("VrN/"),A=oe.n(P),S=oe("bdgK"),C=oe("p77/"),h=oe("Bd2K"),a=oe("ELLl"),l=oe("19Vz"),d=oe("lZu9"),w=oe("+NIl"),v=oe("kSUc"),m=oe("9Bee"),L=function(be){var Ce=be.value,Me=Ce===void 0?"":Ce,Ve=be.className,et=be.showTextOnly,it=be.showLines,vt=be.style,st=vt===void 0?{}:vt,at=Object(b.useMemo)(function(){return""},[Me]);return _.a.createElement(_.a.Fragment,null,_.a.createElement("div",{dangerouslySetInnerHTML:{__html:at}}))},y=oe("0Owb"),f=oe("dejd"),p=oe("C+DQ"),u=oe("1vsH"),o=oe("m3rI"),E=[{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 g(be){var Ce=be.onActionCallback,Me=be.title,Ve=be.icon,et=be.actionName,it=be.className,vt=it===void 0?"":it,st=be.children;function at(){Ce(et)}return _.a.createElement("a",{title:Me,className:vt,onClick:at},_.a.createElement("i",{className:"md-iconfont ".concat(Ve)}),st)}var x=function(be){var Ce=be.watch,Me=be.showNullButton,Ve=be.onActionCallback,et=be.fullScreen,it=be.insertTemp,vt=be.hidetoolBar,st=be.uuid,at=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.F)("_educoder_session"),"&key=").concat(st,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var wt=[].concat(E,[{title:"".concat(Ce?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ce?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return _.a.createElement("ul",{className:"markdown-toolbar-container"},!vt&&wt.map(function(Et,It){return _.a.createElement("li",{key:It},Et.actionName?_.a.createElement(g,Object(y.a)({},Et,{onActionCallback:Ve})):_.a.createElement("span",{className:"v-line"}))}),Me?_.a.createElement("li",null,_.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ve},_.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,it&&_.a.createElement("li",null,_.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(it),onActionCallback:Ve},_.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),_.a.createElement("li",{className:"btn-full-screen"},_.a.createElement(g,{icon:"".concat(et?"icon-shrink":"icon-enlarge"),title:et?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ve})))},I=oe("M8RZ"),j=oe("+L6B"),G=oe("2/Rp"),V=oe("y8nQ"),M=oe("Vl3Y"),F=oe("5NDa"),$=oe("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},de=function(be){var Ce=be.callback,Me=be.onCancel;function Ve(et){Ce(et)}return _.a.createElement(M.a,Object(y.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ve}),_.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},_.a.createElement($.a,null)),_.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},_.a.createElement($.a,null)),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(G.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ge=oe("7ahc"),Le=oe("HmJG"),Ee=oe("BjJ7"),_e=M.a.useForm,Se={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},me=function(be){var Ce=be.callback,Me=be.onCancel,Ve=_e(),et=Object(K.a)(Ve,1),it=et[0];function vt(wt){Ce(wt)}function st(wt,Et){if(wt.status===-1){U.b.error(wt.message);return}it.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:Et.type})}function at(wt){var Et=wt.target.files[0];s(Et,st)}return _.a.createElement(M.a,Object(y.a)({form:it},xe,{className:"upload-image-panel",onFinish:vt}),_.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},_.a.createElement("div",{className:"flex-container"},_.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},_.a.createElement($.a,{style:Se})),_.a.createElement(z,{onFileChange:at}))),_.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},_.a.createElement($.a,{style:{width:264}})),_.a.createElement(M.a.Item,{style:{textAlign:"right"}},_.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(G.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function z(be){var Ce=be.onFileChange;return _.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",_.a.createElement("input",{type:"file",onChange:Ce}))}function s(be,Ce){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",be),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var Ve=new window.XMLHttpRequest;Ve.withCredentials=!0,Ve.addEventListener("load",function(et){Ce(JSON.parse(et.target.responseText),be)},!1),Ve.addEventListener("error",function(et){console.error(et)},!1),Ve.open("POST","".concat(Ee.a,"/api/attachments.json")),Ve.send(Me)}var c=oe("giR+"),k=oe("fyUT"),X=oe("7Kak"),B=oe("9yH6"),se=B.a.Group,ve={margin:"0 8px"},Te=function(be){var Ce=be.callback,Me=be.onCancel;function Ve(et){Ce(et)}return _.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ve},_.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},_.a.createElement("span",{style:ve},"\u5355\u5143\u683C\u6570\uFF1A"),_.a.createElement("span",{style:ve},"\u884C\u6570"),_.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},_.a.createElement(k.a,null)),_.a.createElement("span",{style:ve},"\u5217\u6570"),_.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},_.a.createElement(k.a,null))),_.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},_.a.createElement("span",{style:ve},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),_.a.createElement(M.a.Item,{name:"align"},_.a.createElement(se,null,_.a.createElement(B.a,{value:"default"},_.a.createElement("i",{className:"fa fa-align-justify"})),_.a.createElement(B.a,{value:"left"},_.a.createElement("i",{className:"fa fa-align-left"})),_.a.createElement(B.a,{value:"center"},_.a.createElement("i",{className:"fa fa-align-center"})),_.a.createElement(B.a,{value:"right"},_.a.createElement("i",{className:"fa fa-align-right"}))))),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(G.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Pe=oe("ErOA"),Ae=oe("7Cbv"),De="link",ke="upload-image",Fe="code-block",je="add-table",Be="------------",Ie={default:Be,left:":".concat(Be),center:":".concat(Be,":"),right:"".concat(Be,":")},Ye=oe("9VGf"),He,Xe;function Oe(){}var tt=0,Qe=1e4,le="\u2581",q=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ee(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,ue=ae?"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=(He={},Object(H.a)(He,ue+"-B","bold"),Object(H.a)(He,ue+"-I","italic"),He),he=(Xe={},Object(H.a)(Xe,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Xe,Fe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Xe,ke,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Xe,je,"\u6DFB\u52A0\u8868\u683C"),Xe),fe=ze.a=function(be){var Ce=be.defaultValue,Me=Ce===void 0?"":Ce,Ve=be.onChange,et=be.width,it=et===void 0?"100%":et,vt=be.height,st=vt===void 0?400:vt,at=be.miniToolbar,wt=at===void 0?!1:at,Et=be.isFocus,It=Et===void 0?!1:Et,Ot=be.watch,xt=be.insertTemp,mr=be.mode,Cr=mr===void 0?"markdown":mr,Yt=be.id,gr=Yt===void 0?"markdown-editor-id":Yt,cr=be.showResizeBar,Gr=cr===void 0?!1:cr,$t=be.noStorage,Nr=$t===void 0?!1:$t,ti=be.showNullButton,Pt=ti===void 0?!1:ti,Ze=be.hidetoolBar,Ct=Ze===void 0?!1:Ze,Jt=be.fullScreen,mt=Jt===void 0?!1:Jt,pt=be.onBlur,_t=be.onCMBeforeChange,vr=be.onFullScreen,Ut=be.className,We=Ut===void 0?"":Ut,ht=be.disablePaste,ri=ht===void 0?!1:ht,bi=be.placeholder,Ei=bi===void 0?"":bi,ii=be.values,xi=ii===void 0?"":ii,ft=Object(b.useState)(null),An=Object(K.a)(ft,2),Ge=An[0],Si=An[1],xr=Object(b.useState)(Me),Ki=Object(K.a)(xr,2),ni=Ki[0],Tr=Ki[1],Vi=Object(b.useState)(Ot),Xi=Object(K.a)(Vi,2),wr=Xi[0],Yi=Xi[1],Ln=Object(b.useState)(mt),$i=Object(K.a)(Ln,2),_r=$i[0],Dn=$i[1],aa=Object(b.useState)(""),Ji=Object(K.a)(aa,2),rr=Ji[0],Kr=Ji[1],oa=Object(b.useState)(0),ai=Object(K.a)(oa,2),Ar=ai[0],Zi=ai[1],sa=Object(b.useState)(st),kn=Object(K.a)(sa,2),Rn=kn[0],Ci=kn[1],On=Object(b.useState)(!1),Pn=Object(K.a)(On,2),la=Pn[0],Ti=Pn[1],oi=Object(b.useRef)(Object(Ae.a)()),si=Object(b.useRef)(!1),wi=Object(b.useRef)(),Fr=Object(b.useRef)(),Br=Object(b.useRef)(),Ur=Object(b.useRef)(),_i=Object(b.useRef)(),Mn=function(){var ot=Object(D.a)(R.a.mark(function ct(){var ut,yt;return R.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Object(Pe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:yt=kt.sent,yt!=null&&(ut=yt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",Ge,Fr),yt.attachments.map(function(St){St.content_type.indexOf("image")>-1?Ge.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):St.content_type.indexOf("video")>-1?Ge.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):St.content_type.indexOf("pdf")>-1?Ge.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):Ge.replaceSelection("[".concat(St.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}));case 4:case"end":return kt.stop()}},ct)}));return function(){return ot.apply(this,arguments)}}();Object(b.useEffect)(function(){Tr(xi),Ge==null||Ge.setValue(xi)},[xi]),Object(b.useEffect)(function(){vr==null||vr(_r)},[_r]),Object(b.useEffect)(function(){if(Fr.current){var ot=A.a.fromTextArea(Fr.current,{mode:Cr,lineNumbers:!wt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});It&&ot.focus();function ct(ut,yt){if(ri){yt.preventDefault();return}var Tt=yt.clipboardData;if(Tt){var kt=Tt.types.toString(),St=Tt.items;if(kt==="Files"||Tt.types.indexOf("Files")>-1){if(yt.preventDefault(),Cr=="stex")return;try{var Ht,ar=St[1];((Ht=St[0])===null||Ht===void 0?void 0:Ht.kind)==="file"&&(ar=St[0]);var bt=ar.getAsFile(),jr=bt.name.split(".").pop();s(bt,function(At){if(At.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):te.includes(jr)?ot.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})}catch(At){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",ct),ot.on("dragleave",function(ut,yt){Br.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(ut,yt){Br.current.classList.add("mouse-hover-md")}),ot.on("drop",function(ut,yt){Br.current.classList.add("mouse-hover-md");var Tt;if(Tt=yt.dataTransfer.files,Tt.length>0){yt.preventDefault(),yt.stopPropagation();for(var kt=function(ar){var bt=Tt[ar],jr=bt.name.split(".").pop();s(bt,function(At){if(At.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):te.includes(jr)?ot.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})},St=0;St<Tt.length;St++)kt(St)}}),Si(ot),function(){ot.off("paste",ct)}}},[]);var yr=Object(b.useCallback)(function(){if(Br.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Rn,Br,_r]);Object(b.useEffect)(function(){function ot(){var ut=new S.default(function(yt){var Tt=Object(O.a)(yt),kt;try{for(Tt.s();!(kt=Tt.n()).done;){var St=kt.value;(St.target.offsetHeight>0||St.target.offsetWidth>0)&&(yr(),Ge.setSize("100%","100%"),Ge.refresh())}}catch(Ht){Tt.e(Ht)}finally{Tt.f()}});return ut.observe(Fr.current.parentElement),ut}if(Ge){var ct=ot();return function(){ct.unobserve(Fr.current.parentElement)}}},[Ge,yr]),Object(b.useEffect)(function(){if(Ge){for(var ot=[],ct=function(){var St=yt[ut];Tt=Object(K.a)(St,2);var Ht=Tt[0],ar=Tt[1],bt=Object(H.a)({},Ht,function(){In(ar)});ot.push(bt),Ge.addKeyMap(bt)},ut=0,yt=Object.entries(ne);ut<yt.length;ut++){var Tt;ct()}return wi.current=setInterval(function(){si.current&&Mn()},4e3),function(){clearInterval(wi.current);var kt=Object(O.a)(ot),St;try{for(kt.s();!(St=kt.n()).done;){var Ht=St.value;Ge.removeKeyMap(Ht)}}catch(ar){kt.e(ar)}finally{kt.f()}}}},[Ge]),Object(b.useEffect)(function(){mt!==_r&&Dn(mt)},[mt]),Object(Ye.a)(function(){if(!Nr&&Ar>0){var ot=new Date().getTime(),ct=window.sessionStorage.getItem(gr);ot>=Ar+Qe&&(!ct||ct!==ni)&&(window.sessionStorage.setItem(gr,ni),Ti(!0))}},Qe),Object(b.useEffect)(function(){Yi(Ot)},[Ge,Ot]),Object(b.useEffect)(function(){Ge&&(It&&Ge.focus())},[Ge,It]),Object(b.useEffect)(function(){if(wr&&Ge){var ot=Ge.getScrollerElement();function ct(ut){var yt=ut.target;if(_i.current){var Tt=yt.scrollTop/yt.scrollHeight;_i.current.scrollTop=_i.current.scrollHeight*Tt}}return ot.addEventListener("scroll",ct),function(){ot.removeEventListener("scroll",ct)}}},[Ge,wr]),Object(b.useEffect)(function(){if(Ge&&_t){function ot(ct,ut){_t(ct,ut)}return Ge.on("beforeChange",ot),function(){Ge.off("beforeChange",ot)}}},[Ge,_t]),Object(b.useEffect)(function(){if(Ge&&pt){function ot(){pt(Ge.getValue())}return Ge.on("blur",ot),function(){Ge.off("blur",ot)}}},[Ge,pt]),Object(b.useEffect)(function(){if(Ge){function ot(ct){var ut=ct.getValue();Tr(ut),Zi(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ve&&Ve(ut)}return Ge.on("change",ot),function(){Ge.off("change",ot)}}},[Ge,Ve]),Object(b.useEffect)(function(){Ge&&(Me==null?(Ge.setValue(""),Tr("")):Me!==Ge.getValue()&&(Ge.setValue(Me),Tr(Me),Ge.setCursor(Ge.lineCount(),0)))},[Ge,Me]);var In=Object(b.useCallback)(function(ot){var ct=Ge.getCursor(),ut=Ge.getSelection(),yt=ut.split(`
`);switch(ot){case"bold":return Ge.replaceSelection("**"+ut+"**"),ut===""&&Ge.setCursor(ct.line,ct.ch+2),Ge.focus();case"italic":return Ge.replaceSelection("*"+ut+"*"),ut===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.focus();case"code":return Ge.replaceSelection("`"+ut+"`"),ut===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.focus();case"inline-latex":return Ge.replaceSelection("`$$"+ut+"$$`"),ut===""&&Ge.setCursor(ct.line,ct.ch+3),Ge.focus();case"latex":return Ge.replaceSelection("```latex\n"+ut+"\n```"),Ge.setCursor(ct.line+1,ut.length+1),Ge.focus();case"line-break":return Ge.replaceSelection(`<br/>
`),Ge.focus();case"list-ul":return ut===""?Ge.replaceSelection("- "+ut):Ge.replaceSelection(yt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
`)),Ge.focus();case"list-ol":return ut===""?Ge.replaceSelection("1. "+ut):Ge.replaceSelection(yt.map(function(Tt,kt){return Tt===""?"":"".concat(kt+1,". ").concat(Tt)}).join(`
`)),Ge.focus();case"add-null-ch":return ut===""&&Ge.setCursor(ct.line,ct.ch+1),Ge.replaceSelection(le),Ge.focus();case"inster-template-1":return ut===""&&Ge.setCursor(ct.line,ct.ch),Ge.replaceSelection(q),Ge.focus();case"eraser":return Ge.setValue(""),Ge.focus();case"trigger-watch":return Yi(!wr),Ge.focus();case"trigger-full-screen":return Dn(!_r),Ge.focus();case De:Kr(De);return;case Fe:Kr(Fe);return;case ke:Kr(ke);return;case je:Kr(je);return;default:throw new Error}},[Ge,wr,_r]),Ai=Object(b.useCallback)(function(ot){Kr("");switch(rr){case De:var ct=ot.title,ut=ot.link;return Ge.replaceSelection("[".concat(ct,"](").concat(ut,")")),Ge.focus();case Fe:var yt=ot.language,Tt=ot.content;return Ge.replaceSelection(["```"+yt,Tt,"```"].join(`
`)),Ge.focus();case ke:var kt=ot.src,St=ot.alt;return St?Ge.replaceSelection("![ ".concat(St," ]( ").concat(kt,' "').concat(St,'" )')):Ge.replaceSelection("![,](".concat(kt,")")),Ge.focus();case je:for(var Ht=ot.row,ar=ot.col,bt=ot.align,jr=`
`,At=0;At<Ht;At++){for(var or=[],qt=[],Sr=0;Sr<ar;Sr++)At===1&&qt.push(Ie[bt]),or.push(" ");At===1&&(jr+="| ".concat(qt.join(" | "),` |
`)),jr+="| ".concat(or.join(ar===1?"":" | "),` |
`)}return Ge.replaceSelection(jr+`
`),Ge.focus();default:throw new Error}},[Ge,rr]),Qi=Object(b.useMemo)(function(){switch(rr){case De:return _.a.createElement(de,{callback:Ai,onCancel:Vr});case Fe:return _.a.createElement(ge.b,{callback:Ai,onCancel:Vr});case ke:return _.a.createElement(me,{callback:Ai,onCancel:Vr});case je:return _.a.createElement(Te,{callback:Ai,onCancel:Vr});default:return null}},[rr]);function Vr(){Kr("")}Object(b.useEffect)(function(){if(Ur.current){var ot=Ur.current,ct=!1,ut=0;function yt(St){ct=!0,ut=St.pageY}function Tt(){ct=!1}function kt(St){if(ct){var Ht=St.pageY-ut;Ht<0&&(Ht=0),Ht>300&&(Ht=300);var ar=st+Ht+"px";Ci(ar)}}return ot.addEventListener("mousedown",yt),document.addEventListener("mousemove",kt),document.addEventListener("mouseup",Tt),function(){ot.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",kt),document.removeEventListener("mouseup",Tt)}}},[Ge,Ur]),Object(b.useEffect)(function(){Ci(st)},[st]);var Or=ee(it),qi=ee(Rn),Lr={width:Or,height:qi},en=Object(b.useMemo)(function(){if(Ar){var ot=new Date(Ar),ct=ot.getHours(),ut=ot.getMinutes(),yt=ot.getSeconds();return ct=ct<10?"0"+ct:ct,ut=ut<10?"0"+ut:ut,yt=yt<10?"0"+yt:yt,"".concat(ct,":").concat(ut,":").concat(yt)}return 0},[Ar]);function Nn(){window.sessionStorage.removeItem(gr),Ti(!1),Zi(0)}function li(){Ti(!1),Zi(0),Ge.setValue(window.sessionStorage.getItem(gr))}function ua(ot,ct){var ut=Ge.getValue();ut=ut.replace(ot,ct),Tr(ut),Ge==null||Ge.setValue(ut)}return _.a.createElement(b.Fragment,null,_.a.createElement("div",{className:"markdown-editor-wrapper",ref:Br},_.a.createElement("div",{className:"markdown-editor-container ".concat(We," ").concat(wr?"on-preview":""," ").concat(wt?"mini":""," ").concat(_r?"full-screen":""),style:Lr},_.a.createElement(x,{insertTemp:xt,watch:wr,fullScreen:_r,showNullButton:Pt,onActionCallback:In,hidetoolBar:Ct,uuid:oi.current,setOpenPhones:function(){si.current=!0}}),_.a.createElement("div",{className:"markdown-editor-body"},_.a.createElement("div",{className:"codemirror-container"},_.a.createElement("textarea",{ref:Fr,placeholder:Ei})),wr?_.a.createElement("div",{ref:_i,className:"preview-container"},Cr==="stex"&&_.a.createElement(L,{value:ni}),Cr!=="stex"&&_.a.createElement(m.a,{edit:!0,value:ni,replaces:ua})):null))),Gr?_.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,_.a.createElement(I.a,null,he[rr]?_.a.createElement(J.a,{centered:!0,title:he[rr],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Qi):null))}},SJMd:function(nt,ze){/**
* @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 oe,ce,J,O=!1,Z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var D,K;(function(){var H=window,N=["break,continue,do,else,for,if,return,while"],R=[N,"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"],b=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[b,"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"],P=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],S="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",C=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[N,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[N,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[N,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[_,A,P,C,h,a,l,d],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",L="kwd",y="com",f="typ",p="lit",u="pun",o="pln",E="tag",g="dec",x="src",I="atn",j="atv",G="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(se){for(var ve=0,Te=!1,Pe=!1,Ae=0,De=se.length;Ae<De;++Ae){var ke=se[Ae];if(ke.ignoreCase)Pe=!0;else if(/[a-z]/i.test(ke.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Te=!0,Pe=!1;break}}var Fe={b:8,t:9,n:10,v:11,f:12,r:13};function je(Xe){var Oe=Xe.charCodeAt(0);if(Oe!==92)return Oe;var tt=Xe.charAt(1);return Oe=Fe[tt],Oe||("0"<=tt&&tt<="7"?parseInt(Xe.substring(1),8):tt==="u"||tt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Be(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Oe=String.fromCharCode(Xe);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function Ie(Xe){var Oe=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),tt=[],Qe=Oe[0]==="^",le=["["];Qe&&le.push("^");for(var q=Qe?1:0,ee=Oe.length;q<ee;++q){var ae=Oe[q];if(/\\[bdsw]/i.test(ae))le.push(ae);else{var ue=je(ae),te;q+2<ee&&Oe[q+1]==="-"?(te=je(Oe[q+2]),q+=2):te=ue,tt.push([ue,te]),te<65||ue>122||(te<65||ue>90||tt.push([Math.max(65,ue)|32,Math.min(te,90)|32]),te<97||ue>122||tt.push([Math.max(97,ue)&~32,Math.min(te,122)&~32]))}}tt.sort(function(be,Ce){return be[0]-Ce[0]||Ce[1]-be[1]});for(var ne=[],he=[],q=0;q<tt.length;++q){var fe=tt[q];fe[0]<=he[1]+1?he[1]=Math.max(he[1],fe[1]):ne.push(he=fe)}for(var q=0;q<ne.length;++q){var fe=ne[q];le.push(Be(fe[0])),fe[1]>fe[0]&&(fe[1]+1>fe[0]&&le.push("-"),le.push(Be(fe[1])))}return le.push("]"),le.join("")}function Ye(Xe){for(var Oe=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),tt=Oe.length,Qe=[],le=0,q=0;le<tt;++le){var ee=Oe[le];if(ee==="(")++q;else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&(ae<=q?Qe[ae]=-1:Oe[le]=Be(ae))}}for(var le=1;le<Qe.length;++le)Qe[le]===-1&&(Qe[le]=++ve);for(var le=0,q=0;le<tt;++le){var ee=Oe[le];if(ee==="(")++q,Qe[q]||(Oe[le]="(?:");else if(ee.charAt(0)==="\\"){var ae=+ee.substring(1);ae&&ae<=q&&(Oe[le]="\\"+Qe[ae])}}for(var le=0;le<tt;++le)Oe[le]==="^"&&Oe[le+1]!=="^"&&(Oe[le]="");if(Xe.ignoreCase&&Te)for(var le=0;le<tt;++le){var ee=Oe[le],ue=ee.charAt(0);ee.length>=2&&ue==="["?Oe[le]=Ie(ee):ue!=="\\"&&(Oe[le]=ee.replace(/[a-zA-Z]/g,function(he){var fe=he.charCodeAt(0);return"["+String.fromCharCode(fe&~32,fe|32)+"]"}))}return Oe.join("")}for(var He=[],Ae=0,De=se.length;Ae<De;++Ae){var ke=se[Ae];if(ke.global||ke.multiline)throw new Error(""+ke);He.push("(?:"+Ye(ke)+")")}return new RegExp(He.join("|"),Pe?"gi":"g")}function F(se,ve){var Te=/(?:^|\s)nocode(?:\s|$)/,Pe=[],Ae=0,De=[],ke=0;function Fe(je){var Be=je.nodeType;if(Be==1){if(Te.test(je.className))return;for(var Ie=je.firstChild;Ie;Ie=Ie.nextSibling)Fe(Ie);var Ye=je.nodeName.toLowerCase();(Ye==="br"||Ye==="li")&&(Pe[ke]=`
`,De[ke<<1]=Ae++,De[ke++<<1|1]=je)}else if(Be==3||Be==4){var He=je.nodeValue;He.length&&(ve?He=He.replace(/\r\n?/g,`
`):He=He.replace(/[ \t\r\n]+/g," "),Pe[ke]=He,De[ke<<1]=Ae,Ae+=He.length,De[ke++<<1|1]=je)}}return Fe(se),{sourceCode:Pe.join("").replace(/\n$/,""),spans:De}}function $(se,ve,Te,Pe,Ae){if(!Te)return;var De={sourceNode:se,pre:1,langExtension:null,numberLines:null,sourceCode:Te,spans:null,basePos:ve,decorations:null};Pe(De),Ae.push.apply(Ae,De.decorations)}var ie=/\S/;function de(se){for(var ve=void 0,Te=se.firstChild;Te;Te=Te.nextSibling){var Pe=Te.nodeType;ve=Pe===1?ve?se:Te:Pe===3&&ie.test(Te.nodeValue)?se:ve}return ve===se?void 0:ve}function ge(se,ve){var Te={},Pe;(function(){for(var ke=se.concat(ve),Fe=[],je={},Be=0,Ie=ke.length;Be<Ie;++Be){var Ye=ke[Be],He=Ye[3];if(He)for(var Xe=He.length;--Xe>=0;)Te[He.charAt(Xe)]=Ye;var Oe=Ye[1],tt=""+Oe;je.hasOwnProperty(tt)||(Fe.push(Oe),je[tt]=null)}Fe.push(/[\0-\uffff]/),Pe=M(Fe)})();var Ae=ve.length,De=function(ke){for(var Fe=ke.sourceCode,je=ke.basePos,Be=ke.sourceNode,Ie=[je,o],Ye=0,He=Fe.match(Pe)||[],Xe={},Oe=0,tt=He.length;Oe<tt;++Oe){var Qe=He[Oe],le=Xe[Qe],q=void 0,ee;if(typeof le=="string")ee=!1;else{var ae=Te[Qe.charAt(0)];if(ae)q=Qe.match(ae[1]),le=ae[0];else{for(var ue=0;ue<Ae;++ue)if(ae=ve[ue],q=Qe.match(ae[1]),q){le=ae[0];break}q||(le=o)}ee=le.length>=5&&le.substring(0,5)==="lang-",ee&&!(q&&typeof q[1]=="string")&&(ee=!1,le=x),ee||(Xe[Qe]=le)}var te=Ye;if(Ye+=Qe.length,!ee)Ie.push(je+te,le);else{var ne=q[1],he=Qe.indexOf(ne),fe=he+ne.length;q[2]&&(fe=Qe.length-q[2].length,he=fe-ne.length);var be=le.substring(5);$(Be,je+te,Qe.substring(0,he),De,Ie),$(Be,je+te+he,ne,z(be,ne),Ie),$(Be,je+te+fe,Qe.substring(fe),De,Ie)}}ke.decorations=Ie};return De}function Le(se){var ve=[],Te=[];se.tripleQuotedStrings?ve.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):se.multiLineStrings?ve.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ve.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),se.verbatimStrings&&Te.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=se.hashComments;Pe&&(se.cStyleComments?(Pe>1?ve.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ve.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Te.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ve.push([y,/^#[^\r\n]*/,null,"#"])),se.cStyleComments&&(Te.push([y,/^\/\/[^\r\n]*/,null]),Te.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ae=se.regexLiterals;if(Ae){var De=Ae>1?"":`
\r`,ke=De?".":"[\\S\\s]",Fe="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+ke+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+ke+")*(?:\\x5D|$))+/";Te.push(["lang-regex",RegExp("^"+V+"("+Fe+")")])}var je=se.types;je&&Te.push([f,je]);var Be=(""+se.keywords).replace(/^ | $/g,"");Be.length&&Te.push([L,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),ve.push([o,/^\s+/,null,` \r
\xA0`]);var Ie="^.[^\\s\\w.$@'\"`/\\\\]*";return se.regexLiterals&&(Ie+="(?!s*/)"),Te.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[u,new RegExp(Ie),null]),ge(ve,Te)}var Ee=Le({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function _e(se,ve,Te){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,Ae=/\r\n?|\n/,De=se.ownerDocument,ke=De.createElement("li");se.firstChild;)ke.appendChild(se.firstChild);var Fe=[ke];function je(Oe){var tt=Oe.nodeType;if(tt==1&&!Pe.test(Oe.className))if(Oe.nodeName==="br")Be(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var Qe=Oe.firstChild;Qe;Qe=Qe.nextSibling)je(Qe);else if((tt==3||tt==4)&&Te){var le=Oe.nodeValue,q=le.match(Ae);if(q){var ee=le.substring(0,q.index);Oe.nodeValue=ee;var ae=le.substring(q.index+q[0].length);if(ae){var ue=Oe.parentNode;ue.insertBefore(De.createTextNode(ae),Oe.nextSibling)}Be(Oe),ee||Oe.parentNode.removeChild(Oe)}}}function Be(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function tt(q,ee){var ae=ee?q.cloneNode(!1):q,ue=q.parentNode;if(ue){var te=tt(ue,1),ne=q.nextSibling;te.appendChild(ae);for(var he=ne;he;he=ne)ne=he.nextSibling,te.appendChild(he)}return ae}for(var Qe=tt(Oe.nextSibling,0),le;(le=Qe.parentNode)&&le.nodeType===1;)Qe=le;Fe.push(Qe)}for(var Ie=0;Ie<Fe.length;++Ie)je(Fe[Ie]);ve===(ve|0)&&Fe[0].setAttribute("value",ve);var Ye=De.createElement("ol");Ye.className="linenums";for(var He=Math.max(0,ve-1|0)||0,Ie=0,Xe=Fe.length;Ie<Xe;++Ie)ke=Fe[Ie],ke.className="L"+(Ie+He)%10,ke.firstChild||ke.appendChild(De.createTextNode("\xA0")),Ye.appendChild(ke);se.appendChild(Ye)}function Se(se){var ve=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ve=ve&&+ve[1]<=8;var Te=/\n/g,Pe=se.sourceCode,Ae=Pe.length,De=0,ke=se.spans,Fe=ke.length,je=0,Be=se.decorations,Ie=Be.length,Ye=0;Be[Ie]=Ae;var He,Xe;for(Xe=He=0;Xe<Ie;)Be[Xe]!==Be[Xe+2]?(Be[He++]=Be[Xe++],Be[He++]=Be[Xe++]):Xe+=2;for(Ie=He,Xe=He=0;Xe<Ie;){for(var Oe=Be[Xe],tt=Be[Xe+1],Qe=Xe+2;Qe+2<=Ie&&Be[Qe+1]===tt;)Qe+=2;Be[He++]=Oe,Be[He++]=tt,Xe=Qe}Ie=Be.length=He;var le=se.sourceNode,q="";le&&(q=le.style.display,le.style.display="none");try{for(var ee=null;je<Fe;){var ae=ke[je],ue=ke[je+2]||Ae,te=Be[Ye+2]||Ae,Qe=Math.min(ue,te),ne=ke[je+1],he;if(ne.nodeType!==1&&(he=Pe.substring(De,Qe))){ve&&(he=he.replace(Te,"\r")),ne.nodeValue=he;var fe=ne.ownerDocument,be=fe.createElement("span");be.className=Be[Ye+1];var Ce=ne.parentNode;Ce.replaceChild(be,ne),be.appendChild(ne),De<ue&&(ke[je+1]=ne=fe.createTextNode(Pe.substring(Qe,ue)),Ce.insertBefore(ne,be.nextSibling))}De=Qe,De>=ue&&(je+=2),De>=te&&(Ye+=2)}}finally{le&&(le.style.display=q)}}var xe={};function me(se,ve){for(var Te=ve.length;--Te>=0;){var Pe=ve[Te];xe.hasOwnProperty(Pe)?H.console&&console.warn("cannot override language handler %s",Pe):xe[Pe]=se}}function z(se,ve){return se&&xe.hasOwnProperty(se)||(se=/^\s*</.test(ve)?"default-markup":"default-code"),xe[se]}me(Ee,["default-code"]),me(ge([],[[o,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(ge([[o,/^[\s]+/,null,` \r
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),me(ge([],[[j,/^[\s\S]+/]]),["uq.val"]),me(Le({keywords:_,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),me(Le({keywords:"null,true,false"}),["json"]),me(Le({keywords:A,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),me(Le({keywords:P,cStyleComments:!0}),["java"]),me(Le({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Le({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Le({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Le({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Le({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Le({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ge([],[[m,/^[\s\S]+/]]),["regex"]);function s(se){var ve=se.langExtension;try{var Te=F(se.sourceNode,se.pre),Pe=Te.sourceCode;se.sourceCode=Pe,se.spans=Te.spans,se.basePos=0,z(ve,Pe)(se),Se(se)}catch(Ae){H.console&&console.log(Ae&&Ae.stack||Ae)}}function c(se,ve,Te){var Pe=Te||!1,Ae=ve||null,De=document.createElement("div");De.innerHTML="<pre>"+se+"</pre>",De=De.firstChild,Pe&&_e(De,Pe,!0);var ke={langExtension:Ae,numberLines:Pe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return s(ke),De.innerHTML}function k(se,ve){var Te=ve||document.body,Pe=Te.ownerDocument||document;function Ae(ae){return Te.getElementsByTagName(ae)}for(var De=[Ae("pre"),Ae("code"),Ae("xmp")],ke=[],Fe=0;Fe<De.length;++Fe)for(var je=0,Be=De[Fe].length;je<Be;++je)ke.push(De[Fe][je]);De=null;var Ie=Date;Ie.now||(Ie={now:function(){return+new Date}});var Ye=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,tt=/pre|xmp/i,Qe=/^code$/i,le=/^(?:pre|code|xmp)$/i,q={};function ee(){for(var ae=H.PR_SHOULD_USE_CONTINUATION?Ie.now()+250:Infinity;Ye<ke.length&&Ie.now()<ae;Ye++){for(var ue=ke[Ye],te=q,ne=ue;ne=ne.previousSibling;){var he=ne.nodeType,fe=(he===7||he===8)&&ne.nodeValue;if(fe?!/^\??prettify\b/.test(fe):he!==3||/\S/.test(ne.nodeValue))break;if(fe){te={},fe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ot,xt,mr){te[xt]=mr});break}}var be=ue.className;if((te!==q||Xe.test(be))&&!Oe.test(be)){for(var Ce=!1,Me=ue.parentNode;Me;Me=Me.parentNode){var Ve=Me.tagName;if(le.test(Ve)&&Me.className&&Xe.test(Me.className)){Ce=!0;break}}if(!Ce){ue.className+=" prettyprinted";var et=te.lang;if(!et){et=be.match(He);var it;!et&&(it=de(ue))&&Qe.test(it.tagName)&&(et=it.className.match(He)),et&&(et=et[1])}var vt;if(tt.test(ue.tagName))vt=1;else{var st=ue.currentStyle,at=Pe.defaultView,wt=st?st.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(ue,null).getPropertyValue("white-space"):0;vt=wt&&wt.substring(0,3)==="pre"}var Et=te.linenums;(Et=Et==="true"||+Et)||(Et=be.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&_e(ue,Et,vt);var It={langExtension:et,sourceNode:ue,numberLines:Et,pre:vt,sourceCode:null,basePos:null,spans:null,decorations:null};s(It)}}}Ye<ke.length?H.setTimeout(ee,250):typeof se=="function"&&se()}ee()}var X=H.PR={createSimpleLexer:ge,registerLangHandler:me,sourceDecorator:Le,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:j,PR_COMMENT:y,PR_DECLARATION:g,PR_KEYWORD:L,PR_LITERAL:p,PR_NOCODE:G,PR_PLAIN:o,PR_PUNCTUATION:u,PR_SOURCE:x,PR_STRING:m,PR_TAG:E,PR_TYPE:f,prettyPrintOne:O?H.prettyPrintOne=c:D=c,prettyPrint:K=O?H.prettyPrint=k:K=k},B=H.define;typeof B=="function"&&B.amd&&B("google-code-prettify",[],function(){return X})})()},STEk:function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return me});/*! *****************************************************************************
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 ce=function(z,s){return(ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,k){c.__proto__=k}||function(c,k){for(var X in k)Object.prototype.hasOwnProperty.call(k,X)&&(c[X]=k[X])})(z,s)};function J(z,s){function c(){this.constructor=z}ce(z,s),z.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function O(z,s,c,k){return new(c||(c=Promise))(function(X,B){function se(Pe){try{Te(k.next(Pe))}catch(Ae){B(Ae)}}function ve(Pe){try{Te(k.throw(Pe))}catch(Ae){B(Ae)}}function Te(Pe){var Ae;Pe.done?X(Pe.value):(Ae=Pe.value,Ae instanceof c?Ae:new c(function(De){De(Ae)})).then(se,ve)}Te((k=k.apply(z,s||[])).next())})}function Z(z,s){var c,k,X,B,se={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return B={next:ve(0),throw:ve(1),return:ve(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function ve(Te){return function(Pe){return function(Ae){if(c)throw new TypeError("Generator is already executing.");for(;se;)try{if(c=1,k&&(X=2&Ae[0]?k.return:Ae[0]?k.throw||((X=k.return)&&X.call(k),0):k.next)&&!(X=X.call(k,Ae[1])).done)return X;switch(k=0,X&&(Ae=[2&Ae[0],X.value]),Ae[0]){case 0:case 1:X=Ae;break;case 4:return se.label++,{value:Ae[1],done:!1};case 5:se.label++,k=Ae[1],Ae=[0];continue;case 7:Ae=se.ops.pop(),se.trys.pop();continue;default:if(!(X=se.trys,(X=X.length>0&&X[X.length-1])||Ae[0]!==6&&Ae[0]!==2)){se=0;continue}if(Ae[0]===3&&(!X||Ae[1]>X[0]&&Ae[1]<X[3])){se.label=Ae[1];break}if(Ae[0]===6&&se.label<X[1]){se.label=X[1],X=Ae;break}if(X&&se.label<X[2]){se.label=X[2],se.ops.push(Ae);break}X[2]&&se.ops.pop(),se.trys.pop();continue}Ae=s.call(z,se)}catch(De){Ae=[6,De],k=0}finally{c=X=0}if(5&Ae[0])throw Ae[1];return{value:Ae[0]?Ae[1]:void 0,done:!0}}([Te,Pe])}}}function U(){for(var z=0,s=0,c=arguments.length;s<c;s++)z+=arguments[s].length;var k=Array(z),X=0;for(s=0;s<c;s++)for(var B=arguments[s],se=0,ve=B.length;se<ve;se++,X++)k[X]=B[se];return k}var D=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,c){for(var k=0,X=c;k<X.length;k++){var B=X[k],se=B[0],ve=B[1];s.setAttribute(se,ve)}},z.createRect=function(s,c,k){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",c.toString()),k&&z.setAttributes(X,k),X},z.createLine=function(s,c,k,X,B){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",s.toString()),se.setAttribute("y1",c.toString()),se.setAttribute("x2",k.toString()),se.setAttribute("y2",X.toString()),B&&z.setAttributes(se,B),se},z.createPolygon=function(s,c){var k=document.createElementNS("http://www.w3.org/2000/svg","polygon");return k.setAttribute("points",s),c&&z.setAttributes(k,c),k},z.createCircle=function(s,c){var k=document.createElementNS("http://www.w3.org/2000/svg","circle");return k.setAttribute("cx",(s/2).toString()),k.setAttribute("cy",(s/2).toString()),k.setAttribute("r",s.toString()),c&&z.setAttributes(k,c),k},z.createEllipse=function(s,c,k){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(c/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(c/2).toString()),k&&z.setAttributes(X,k),X},z.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(c,s),c},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,c,k,X,B,se,ve){var Te=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Te,[["id",s],["orient",c],["markerWidth",k.toString()],["markerHeight",X.toString()],["refX",B.toString()],["refY",se.toString()]]),Te.appendChild(ve),Te},z.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&z.setAttributes(c,s),c},z.createTSpan=function(s,c){var k=document.createElementNS("http://www.w3.org/2000/svg","tspan");return k.textContent=s,c&&z.setAttributes(k,c),k},z.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(c,s),c},z.createPoint=function(s,c){var k=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return k.x=s,k.y=c,k},z.createPath=function(s,c){var k=document.createElementNS("http://www.w3.org/2000/svg","path");return k.setAttribute("d",s),c&&z.setAttributes(k,c),k},z}(),K=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),H=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,c,k){var X=this;return new Promise(function(B){var se=k!==void 0?k:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("width",c.width.baseVal.valueAsString),ve.setAttribute("height",c.height.baseVal.valueAsString),ve.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),ve.innerHTML=c.innerHTML,X.naturalSize===!0?(ve.width.baseVal.value=s.naturalWidth,ve.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(ve.width.baseVal.value=X.width,ve.height.baseVal.value=X.height),se.width=ve.width.baseVal.value,se.height=ve.height.baseVal.value;var Te=ve.outerHTML,Pe=se.getContext("2d");X.markersOnly!==!0&&Pe.drawImage(s,0,0,se.width,se.height);var Ae=window.URL,De=new Image(se.width,se.height);De.setAttribute("crossOrigin","anonymous");var ke=new Blob([Te],{type:"image/svg+xml"}),Fe=Ae.createObjectURL(ke);De.onload=function(){Pe.drawImage(De,0,0),Ae.revokeObjectURL(Fe);var je=se.toDataURL(X.imageType,X.imageQuality);B(je)},De.src=Fe})},z}(),N=function(){},R=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new b("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new _("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new _("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),b=function(z,s){this.selector=z,this.style=s},_=function(z,s){this.localName=z,this.style=s},P=function(){function z(s,c,k,X,B){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=c,this.markerItems=k,this.uiStyleSettings=X,this.styles=B,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(s){var c=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var k=document.createElement("div");k.className=this.toolbarBlockStyleClass.name,k.style.whiteSpace="nowrap",this.uiContainer.appendChild(k),this.addActionButton(k,'<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(k,'<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(k,'<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(k,'<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(k,'<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(k,'<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(k,'<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(k,'<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(B){var se=document.createElement("div");se.className=""+c.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",B.typeName),se.innerHTML=B.icon,se.addEventListener("click",function(){c.markerToolbarButtonClicked(se,B)}),c.buttons.push(se),c.markerButtons.push(se)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c<this.markerButtons.length;c++)c<s||c===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},z.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")},z.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(c){c.className=c.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,c,k){var X=this,B=document.createElement("div");switch(B.className=""+this.toolbarButtonStyleClass.name,B.innerHTML=c,B.setAttribute("data-action",k),B.addEventListener("click",function(){X.actionToolbarButtonClicked(B,k)}),k){case"select":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":B.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":B.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":B.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(B),this.buttons.push(B)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new _("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 _("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new _("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new _("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 _("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new _("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new _("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new _("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,c){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(k){return k("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(k){return k("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(k){return k.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},z.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(k){return/delete|notes/.test(k.getAttribute("data-action"))}).forEach(function(k){c.currentMarker===void 0?(k.style.fillOpacity="0.4",k.style.pointerEvents="none"):(k.style.fillOpacity="1",k.style.pointerEvents="all")})},z}(),A=function(){function z(s,c,k,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=k,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new _("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 _("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new _("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new _("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new _("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 _("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new _("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new _("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new _("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var c,k,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((k=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&k!==void 0?k:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(B){var se;B.uiStyleSettings=X.uiStyleSettings;var ve=document.createElement("div");ve.className=X.toolboxButtonStyleClass.name+" "+((se=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:X.toolboxButtonStyleColorsClass.name),ve.innerHTML=B.icon,ve.title=B.title,ve.addEventListener("click",function(){X.panelButtonClick(B)}),X.panelButtons.push(ve),X.buttonRow.appendChild(ve)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var c=this,k=-1;if(s!==this.activePanel){k=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,se){var ve,Te;B.className=c.toolboxButtonStyleClass.name+" "+(se===k?""+((ve=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ve!==void 0?ve:c.toolboxActiveButtonStyleColorsClass.name):""+((Te=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Te!==void 0?Te:c.toolboxButtonStyleColorsClass.name))})},z}(),S=function(z,s){this.title=z,this.icon=s},C=function(z){function s(c,k,X,B){var se=z.call(this,c,B||'<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 se.colors=[],se.addTransparent=!1,se.colorBoxes=[],se.colors=k,se.currentColor=X,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");return k.style.overflow="hidden",k.style.whiteSpace="nowrap",this.colors.forEach(function(X){var B=c.getColorBox(X);k.appendChild(B),c.colorBoxes.push(B)}),k},s.prototype.getColorBox=function(c){var k=this,X=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-X,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=B-2+"px",se.style.height=B-2+"px",se.style.padding="1px",se.style.marginRight="2px",se.style.marginBottom="2px",se.style.borderWidth="2px",se.style.borderStyle="solid",se.style.borderRadius=(B+2)/2+"px",se.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){k.setCurrentColor(c,se)});var ve=document.createElement("div");return ve.style.display="inline-block",ve.style.width=B-2+"px",ve.style.height=B-2+"px",ve.style.backgroundColor=c,ve.style.borderRadius=B/2+"px",c==="transparent"&&(ve.style.fill=this.uiStyleSettings.toolboxAccentColor,ve.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>`),se.appendChild(ve),se},s.prototype.setCurrentColor=function(c,k){var X=this;this.currentColor=c,this.colorBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(S),h=function(){function z(s,c,k){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=k,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(s){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(s,c){},z.prototype.dblClick=function(s,c){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,c){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),a=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),l=function(){function z(){this.GRIP_SIZE=10,this.visual=D.createGroup(),this.visual.appendChild(D.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(D.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),d=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},z}(),w=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(D.createTransform()),B.setupControlBox(),B}return J(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var k=D.createTransform();this._visual.transform.baseVal.appendItem(k)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!z.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(c);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(k),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(k)){this.activeGrip=this.rotatorGrip;var B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var se=this.container.transform.baseVal.getItem(0);se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var k=this.state;z.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",k==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var k=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(k.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(k.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(k):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var k=this.manipulationStartLeft,X=this.manipulationStartWidth,B=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:k=this.manipulationStartLeft+c.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-k;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+c.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+c.y-this.manipulationStartY}X>=0?(this.left=k,this.width=X):(this.left=k+X,this.width=-X),se>=0?(this.top=B,this.height=se):(this.top=B+se,this.height=-se),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var k=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*k,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var k=this.container.getCTM(),X=D.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(k)).x,y:X.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var k=this.container.getCTM();k=k.inverse();var X=D.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(k)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.createGroup();var c=D.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=D.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=D.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 a,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},s.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,k=-c/2,X=k,B=(this.width+this.CB_DISTANCE)/2-c/2,se=(this.height+this.CB_DISTANCE)/2-c/2,ve=this.height+this.CB_DISTANCE-c/2,Te=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,k,X),this.positionGrip(this.controlGrips.topCenter.visual,B,X),this.positionGrip(this.controlGrips.topRight.visual,Te,X),this.positionGrip(this.controlGrips.centerLeft.visual,k,se),this.positionGrip(this.controlGrips.centerRight.visual,Te,se),this.positionGrip(this.controlGrips.bottomLeft.visual,k,ve),this.positionGrip(this.controlGrips.bottomCenter.visual,B,ve),this.positionGrip(this.controlGrips.bottomRight.visual,Te,ve),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,k,X){var B=c.transform.baseVal.getItem(0);B.setTranslate(k,X),c.transform.baseVal.replaceItem(B,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:d.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:d.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var k=c;this.left=k.left,this.top=k.top,this.width=k.width,this.height=k.height,this.rotationAngle=k.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,k.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,k.containerTransformMatrix))},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k);var X=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:X.x*c,y:X.y*k});this.left=B.x,this.top=B.y,this.width=this.width*c,this.height=this.height*k,this.adjustControlBox()},s}(h),v=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){z.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},s.prototype.restoreState=function(c){var k=c;this.fillColor=k.fillColor,this.strokeColor=k.strokeColor,this.strokeWidth=k.strokeWidth,this.strokeDasharray=k.strokeDasharray,this.opacity=k.opacity,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.setSize()},s.title="Rectangle marker",s}(w),m=function(z){function s(c,k,X,B){var se=z.call(this,c,B||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return se.widths=[],se.widthBoxes=[],se.widths=k,se.currentWidth=X,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");return k.style.display="flex",k.style.overflow="hidden",k.style.flexGrow="2",this.widths.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=X===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){c.setCurrentWidth(X,B)}),k.appendChild(B);var se=document.createElement("div");se.innerText=X.toString(),se.style.marginRight="5px",B.appendChild(se);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.display="flex",ve.style.alignItems="center";var Te=document.createElement("hr");Te.style.minWidth="20px",Te.style.border="0px",Te.style.borderTop=X+"px solid "+c.uiStyleSettings.toolboxColor,Te.style.flexGrow="2",ve.appendChild(Te),B.appendChild(ve),c.widthBoxes.push(B)}),k},s.prototype.setCurrentWidth=function(c,k){var X=this;this.currentWidth=c,this.widthBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(S),L=function(z){function s(c,k,X,B){var se=z.call(this,c,B||'<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 se.styles=[],se.styleBoxes=[],se.styles=k,se.currentStyle=X,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");return k.style.display="flex",k.style.overflow="hidden",k.style.flexGrow="2",this.styles.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/c.styles.length-5+"%",B.style.borderColor=X===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){c.setCurrentStyle(X,B)}),k.appendChild(B);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var ve=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;se.innerHTML=ve,B.appendChild(se),c.styleBoxes.push(B)}),k},s.prototype.setCurrentStyle=function(c,k){var X=this;this.currentStyle=c,this.styleBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(S),y=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return J(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(v),f=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},p=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return J(s,z),s.prototype.ownsTarget=function(c){return!!z.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(k)?this.activeGrip=this.grip1:this.grip2.ownsTarget(k)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var k=this.state;z.prototype.pointerUp.call(this,c),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(c),this._state="select",k==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,k,X){var B=c.transform.baseVal.getItem(0);B.setTranslate(k,X),c.transform.baseVal.replaceItem(B,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var k=c;this.x1=k.x1,this.y1=k.y1,this.x2=k.x2,this.y2=k.y2},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.x1=this.x1*c,this.y1=this.y1*k,this.x2=this.x2*c,this.y2=this.y2*k,this.adjustVisual(),this.adjustControlBox()},s}(h),u=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.selectorLine=D.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=D.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),D.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var k=c;this.strokeColor=k.strokeColor,this.strokeWidth=k.strokeWidth,this.strokeDasharray=k.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(p),o=function(z){function s(c,k,X,B){var se=z.call(this,c,B||'<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 se.fonts=[],se.fontBoxes=[],se.fonts=k,se.currentFont=X,se.setCurrentFont=se.setCurrentFont.bind(se),se}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");return k.style.overflow="hidden",k.style.flexGrow="2",this.fonts.forEach(function(X){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/c.fonts.length-5+"%",B.style.borderColor=X===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){c.setCurrentFont(X,B)}),k.appendChild(B);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=X,se.style.overflow="hidden";var ve=document.createElement("div");ve.style.whiteSpace="nowrap",ve.style.overflow="hidden",ve.style.textOverflow="ellipsis",ve.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(ve),B.appendChild(se),c.fontBoxes.push(B)}),k},s.prototype.setCurrentFont=function(c,k){var X=this;this.currentFont=c,this.fontBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(S),E=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=X.defaultColor,B.fontFamily=X.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new C("Color",X.defaultColorSet,X.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new o("Font",X.defaultFontFamilies,X.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return J(s,z),s.prototype.ownsTarget=function(c){if(z.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var k=!1;return this.textElement.childNodes.forEach(function(X){X===c&&(k=!0)}),k},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.bgRectangle=D.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=D.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(k){c.textElement.appendChild(D.createTSpan(k.trim()===""?" ":k.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),k=1;if(c.width>0&&c.height>0){var X=(1*this.width-this.width*this.padding*2/100)/c.width,B=(1*this.height-this.height*this.padding*2/100)/c.height;k=Math.min(X,B)}return k},s.prototype.getTextPosition=function(c){var k=this.textElement.getBBox(),X=0,B=0;return k.width>0&&k.height>0&&(X=(this.width-k.width*c)/2,B=this.height/2-k.height*c/2),{x:X,y:B}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),k=this.getTextScale(),X=this.getTextPosition(k);X.y-=c.y*k,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+k+", "+k+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(k,k))},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var k=this.state;k==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,c),this.setSize(),(k==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(k){k.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var k=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&k>.9;)k-=.1,c.textEditor.style.fontSize=Math.max(k,.9)+"em"}),this.textEditor.addEventListener("keyup",function(k){k.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(k){if(k.clipboardData){var X=k.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(X)),k.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),k=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),B={x:X.width*c,y:X.height*c};k.x-=B.x/2,k.y-=B.y/2,this.textEditor.style.top=k.y+"px",this.textEditor.style.left=k.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-k.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(c,k){z.prototype.dblClick.call(this,c,k),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&D.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&D.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var k=c;this.color=k.color,this.fontFamily=k.fontFamily,this.padding=k.padding,this.text=k.text,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',s}(w),g=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=X.defaultColor,B.lineWidth=X.defaultStrokeWidth,B.pixelRatio=X.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new C("Color",X.defaultColorSet,X.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.drawingImage=D.createImage(),this.visual.appendChild(this.drawingImage);var c=D.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,k){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(c.x,c.y),this.drawing=!0):z.prototype.pointerDown.call(this,c,k)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,c)},s.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),k=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=k[0],B=k[1],se=k[2],ve=k[3],Te=!1,Pe=0;Pe<this.canvasElement.height;Pe++)for(var Ae=0;Ae<this.canvasElement.width;Ae++)c.data[Pe*this.canvasElement.width*4+4*Ae+3]>0&&(Te=!0,Pe<B&&(B=Pe),Ae<X&&(X=Ae),Pe>ve&&(ve=Pe),Ae>se&&(se=Ae));if(Te){this.left=X/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(se-X)/this.pixelRatio,this.height=(ve-B)/this.pixelRatio;var De=document.createElement("canvas");De.width=se-X,De.height=ve-B,De.getContext("2d").putImageData(this.canvasContext.getImageData(X,B,se-X,ve-B),0,0),this.drawingImgUrl=De.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),z.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',s}(w),x=function(z){function s(c,k,X){var B=z.call(this,c,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return B.typeBoxes=[],B.currentType=k,B.setCurrentType=B.setCurrentType.bind(B),B}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");k.style.display="flex",k.style.overflow="hidden",k.style.flexGrow="2";for(var X=function(ve){var Te="both";switch(ve){case 0:Te="both";break;case 1:Te="start";break;case 2:Te="end";break;case 3:Te="none"}var Pe=document.createElement("div");if(Pe.style.display="flex",Pe.style.flexGrow="2",Pe.style.alignItems="center",Pe.style.justifyContent="space-between",Pe.style.padding="5px",Pe.style.borderWidth="2px",Pe.style.borderStyle="solid",Pe.style.borderColor=Te===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",Pe.addEventListener("click",function(){c.setCurrentType(Te,Pe)}),k.appendChild(Pe),Te==="both"||Te==="start"){var Ae=document.createElement("div");Ae.style.display="flex",Ae.style.alignItems="center",Ae.style.minHeight="20px",Ae.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="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ae.style.marginLeft="5px",Pe.appendChild(Ae)}var De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.style.flexGrow="2";var ke=document.createElement("hr");if(ke.style.minWidth="20px",ke.style.border="0px",ke.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),ke.style.flexGrow="2",De.appendChild(ke),Pe.appendChild(De),Te==="both"||Te==="end"){var Fe=document.createElement("div");Fe.style.display="flex",Fe.style.alignItems="center",Fe.style.minHeight="20px",Fe.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="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Fe.style.marginRight="5px",Pe.appendChild(Fe)}B.typeBoxes.push(Pe)},B=this,se=0;se<4;se++)X(se);return k},s.prototype.setCurrentType=function(c,k){var X=this;this.currentType=c,this.typeBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(S),I=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new x("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,k){var X=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return c-X/2+","+(k+B/2)+" "+c+","+(k-B/2)+" "+(c+X/2)+","+(k+B/2)},s.prototype.createTips=function(){this.arrow1=D.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=D.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.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",D.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),D.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),k=this.arrow1.transform.baseVal.getItem(0);k.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(k,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var k=c;this.arrowType=k.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(u),j=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.fillColor=X.defaultFillColor,B.strokeWidth=0,B.fillPanel=new C("Color",X.defaultColorSet,X.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return J(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(v),G=function(z){function s(c,k,X,B){var se=z.call(this,c,B||'<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 se.opacities=[],se.opacityBoxes=[],se.opacities=k,se.currentOpacity=X,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return J(s,z),s.prototype.getUi=function(){var c=this,k=document.createElement("div");return k.style.display="flex",k.style.overflow="hidden",k.style.flexGrow="2",k.style.justifyContent="space-between",this.opacities.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=X===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){c.setCurrentOpacity(X,B)}),k.appendChild(B);var se=document.createElement("div");se.innerText=100*X+"%",B.appendChild(se),c.opacityBoxes.push(B)}),k},s.prototype.setCurrentOpacity=function(c,k){var X=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===k?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(S),V=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=X.defaultHighlightColor,B.strokeWidth=0,B.opacity=X.defaultHighlightOpacity,B.fillPanel=new C("Color",X.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new G("Opacity",X.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return J(s,z),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',s}(j),M='<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>',F=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=X.defaultStrokeColor,B.bgColor=X.defaultFillColor,B.fontFamily=X.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new C("Text color",X.defaultColorSet,B.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>'),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new C("Fill color",X.defaultColorSet,B.bgColor,M),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new o("Font",X.defaultFontFamilies,X.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new l,B.tipGrip.visual.transform.baseVal.appendItem(D.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return J(s,z),s.prototype.ownsTarget=function(c){return z.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){D.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=D.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,k){this.state==="new"&&z.prototype.pointerDown.call(this,c,k),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(k)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,c,k)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,c);else{var k=this.state==="creating";z.prototype.pointerUp.call(this,c),this.setTipPoints(k),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var k=this.unrotatePoint(c);this.tipPosition={x:k.x-this.manipulationStartLeft,y:k.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(D.setAttributes(this.bgRectangle,[["fill",c]]),D.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var k=Math.min(this.height/2,15),X=this.height/5;c&&(this.tipPosition={x:k+X/2,y:this.height+20});var B=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,k=Math.min(this.width/2,15),this.tipBase1Position={x:k,y:0},this.tipBase2Position={x:k+X,y:0}):(this.tipBase1Position={x:0,y:k},this.tipBase2Position={x:0,y:k+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,k=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-k-X,y:0},this.tipBase2Position={x:this.width-k,y:0}):(this.tipBase1Position={x:this.width,y:k},this.tipBase2Position={x:this.width,y:k+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?B<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,k=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-k-X,y:this.height},this.tipBase2Position={x:this.width-k,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-k-X},this.tipBase2Position={x:this.width,y:this.height-k}):B<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,k=Math.min(this.width/2,15),this.tipBase1Position={x:k,y:this.height},this.tipBase2Position={x:k+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-k},this.tipBase2Position={x:0,y:this.height-k-X})},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.positionTip()},s.prototype.positionTip=function(){D.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var k=c;this.bgColor=k.bgColor,this.tipPosition=k.tipPosition,z.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*k},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',s}(E),$=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.fillColor=X.defaultFillColor,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.setOpacity=B.setOpacity.bind(B),B.createVisual=B.createVisual.bind(B),B.strokePanel=new C("Line color",U(X.defaultColorSet,["transparent"]),X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.fillPanel=new C("Fill color",U(X.defaultColorSet,["transparent"]),B.fillColor,M),B.fillPanel.onColorChanged=B.setFillColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B.opacityPanel=new G("Opacity",X.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){z.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),D.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(c){z.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var k=c;this.fillColor=k.fillColor,this.strokeColor=k.strokeColor,this.strokeWidth=k.strokeWidth,this.strokeDasharray=k.strokeDasharray,this.opacity=k.opacity,this.createVisual(),z.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,k){z.prototype.scale.call(this,c,k),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(w),ie=function(z){function s(c,k,X){return z.call(this,c,k,X)||this}return J(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=D.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(D.createTransform()),this.visual.appendChild(this.tip1),this.tip2=D.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(D.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(D.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()]]),D.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),k=this.tip1.transform.baseVal.getItem(0);k.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(k,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(u),de=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.strokePanel.colors=X.defaultColorSet,B.fillColor="transparent",B}return J(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=z.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}($),ge=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),Le=function(z){function s(c,k,X){var B=z.call(this,c,k,X)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new C("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new L("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return J(s,z),s.prototype.ownsTarget=function(c){return!(!z.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.selectorCurve=D.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=D.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,k){z.prototype.pointerDown.call(this,c,k),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(k)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),D.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=D.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=D.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},s.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),z.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),z.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,k){this.curveX=this.curveX*c,this.curveY=this.curveY*k,z.prototype.scale.call(this,c,k)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){z.prototype.restoreState.call(this,c);var k=c;this.strokeColor=k.strokeColor,this.strokeWidth=k.strokeWidth,this.strokeDasharray=k.strokeDasharray,this.curveX=k.curveX,this.curveY=k.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',s}(p),Ee=function(){function z(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),_e=function(z){function s(c,k,X){var B=z.call(this,c,!1)||this;return B.dataUrl=k,B.state=X,B}return J(s,z),s}(Ee),Se=function(z){function s(c,k,X){X===void 0&&(X=!1);var B=z.call(this,c,X)||this;return B.marker=k,B}return J(s,z),s}(Ee),xe=function(){function z(){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 z.prototype.addEventListener=function(s,c){this[s].push(c)},z.prototype.removeEventListener=function(s,c){var k=this[s].indexOf(c);k>-1&&this[s].splice(k,1)},z}(),me=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new f,this._isOpen=!1,this.undoRedoManager=new ge,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 xe,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new R(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[y,g,I,E,de,$,V,F,ie,j,u,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[y,g,I,E,$,V,F]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[y,g,I,E,V]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(k){if(typeof k=="string"){var X=c.ALL_MARKER_TYPES.find(function(B){return B.typeName===k});X!==void 0&&c._availableMarkerTypes.push(X)}else c._availableMarkerTypes.push(k)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),K.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&N.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=N.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new Ee(s))})},z.prototype.render=function(){return O(this,void 0,void 0,function(){var s;return Z(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new H).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},z.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var k=!1;s||this.eventListeners.beforeclose.forEach(function(X){var B=new Ee(c,!0);X(B),B.defaultPrevented&&(k=!0)}),k||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new Ee(c))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,c=[],k=0;k<arguments.length;k++)c[k]=arguments[k];(s=this._availableMarkerTypes).push.apply(s,c)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(c){s(c.dataUrl,c.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,k=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(c,k)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,c){this._isResizing=!0;var k=s/this.imageWidth,X=c/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(k,X),this._isResizing=!1},z.prototype.scaleMarkers=function(s,c){var k,X=this;this._currentMarker&&this._currentMarker instanceof E?this._currentMarker.scale(s,c):(k=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(B){B!==X._currentMarker&&B.scale(s,c)}),k!==void 0&&this.setCurrentMarker(k)},z.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"},z.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left,this.top=s.top-c.top},z.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)},z.prototype.addDefs=function(){for(var s,c=[],k=0;k<arguments.length;k++)c[k]=arguments[k];this.defs=D.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,c)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.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)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.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)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.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)},z.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new P(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 A(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},z.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var B=new Se(s,s._currentMarker,!0);X(B),B.defaultPrevented&&(c=!0)}),!c){var k=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new Se(s,k))})}}},z.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var ve=new Se(s,void 0,!0);se(ve),ve.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var k=function(se){var ve=X.markers[se];X.setCurrentMarker(X.markers[se]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(Te){return Te(new Se(s,ve))})},X=this,B=this.markers.length-1;B>=0;B--)k(B);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),k=this.undoRedoManager.getLastUndoStep();if(!k||k.width===c.width&&k.height===c.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(B){return B(new Ee(s))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(B){return B(new Ee(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(k){return k(new Ee(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(k){return k(new Ee(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return O(this,void 0,void 0,function(){var s,c,k=this;return Z(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),c=this.getState(),this.eventListeners.render.forEach(function(B){return B(new _e(k,s,c))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(k){return c.markers.push(k.getState())}),c},z.prototype.restoreState=function(s){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(k){var X=c._availableMarkerTypes.find(function(se){return se.typeName===k.typeName});if(X!==void 0){var B=c.addNewMarker(X);B.restoreState(k),c.markers.push(B)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(k){return k(new Ee(c))})},z.prototype.addNewMarker=function(s){var c=D.createGroup();return this.markerImage.appendChild(c),new s(c,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var c,k=this;(c=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new Se(k,k._currentMarker))}))},z.prototype.markerCreated=function(s){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof g&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(g):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(k){return k(new Se(c,c._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var c=this;this.eventListeners.markerchange.forEach(function(k){return k(new Se(c,s))})},z.prototype.setCurrentMarker=function(s){var c=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(k){return k(new Se(c,c._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(k){return k(new Se(c,c._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var c=this.markers.find(function(k){return k.ownsTarget(s.target)});c!==void 0?(this.setCurrentMarker(c),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(k){return k.ownsTarget(s.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,c){var k=this.markerImage.getBoundingClientRect();return{x:(s-k.left)/this.zoomLevel,y:(c-k.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},z.prototype.addLicenseKey=function(s){K.addKey(s)},z.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},z.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new Ee(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new Ee(s))}))},z.instanceCounter=0,z}()},"VrN/":function(nt,ze,oe){(function(ce,J){nt.exports=J()})(this,function(){"use strict";var ce=navigator.userAgent,J=navigator.platform,O=/gecko\/\d/i.test(ce),Z=/MSIE \d/.test(ce),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),D=/Edge\/(\d+)/.exec(ce),K=Z||U||D,H=K&&(Z?document.documentMode||6:+(D||U)[1]),N=!D&&/WebKit\//.test(ce),R=N&&/Qt\/\d+\.\d+/.test(ce),b=!D&&/Chrome\//.test(ce),_=/Opera\//.test(ce),P=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ce),S=/PhantomJS/.test(ce),C=!D&&/AppleWebKit/.test(ce)&&/Mobile\/\w+/.test(ce),h=/Android/.test(ce),a=C||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ce),l=C||/Mac/.test(J),d=/\bCrOS\b/.test(ce),w=/win/i.test(J),v=_&&ce.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(_=!1,N=!0);var m=l&&(R||_&&(v==null||v<12.11)),L=O||K&&H>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var i=e.className,r=y(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return p(e).appendChild(t)}function o(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)n.appendChild(t[T]);return n}function E(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var g;document.createRange?g=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:g=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function x(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function j(e,t){var i=e.className;y(t).test(i)||(e.className+=(i?" ":"")+t)}function G(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!y(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};C?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,W=n||0;;){var Y=e.indexOf(" ",T);if(Y<0||Y>=t)return W+(t-T);W+=Y-T,W+=i-W%i,T=Y+1}}var ie=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ie.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ie.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function de(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var ge=50,Le={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},_e={origin:"*mouse"},Se={origin:"+move"};function xe(e,t,i){for(var r=0,n=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var W=T-r;if(T==e.length||n+W>=t)return r+Math.min(W,t-n);if(n+=T-r,n+=i-n%i,r=T+1,n>=t)return r}}var me=[""];function z(e){for(;me.length<=e;)me.push(s(me)+" ");return me[e]}function s(e){return e[e.length-1]}function c(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function k(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function X(){}function B(e,t){var i;return Object.create?i=Object.create(e):(X.prototype=e,i=new X),t&&F(t,i),i}var se=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ve(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||se.test(e))}function Te(e,t){return t?t.source.indexOf("\\w")>-1&&ve(e)?!0:t.test(e):ve(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ae=/[\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&&Ae.test(e)}function ke(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Fe(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,T=r<0?Math.ceil(n):Math.floor(n);if(T==t)return e(T)?t:i;e(T)?i=T:t=T+r}}function je(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,T=0;T<e.length;++T){var W=e[T];(W.from<i&&W.to>t||t==i&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,i),W.level==1?"rtl":"ltr",T),n=!0)}n||r(t,i,"ltr")}var Be=null;function Ie(e,t,i){var r;Be=null;for(var n=0;n<e.length;++n){var T=e[n];if(T.from<t&&T.to>t)return n;T.to==t&&(T.from!=T.to&&i=="before"?r=n:Be=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:Be=n)}return r!=null?r:Be}var Ye=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,W=/[Lb1n]/,Y=/[1n]/;function Q(re,pe,ye){this.level=re,this.from=pe,this.to=ye}return function(re,pe){var ye=pe=="ltr"?"L":"R";if(re.length==0||pe=="ltr"&&!r.test(re))return!1;for(var Re=re.length,we=[],Ne=0;Ne<Re;++Ne)we.push(i(re.charCodeAt(Ne)));for(var Ue=0,Ke=ye;Ue<Re;++Ue){var $e=we[Ue];$e=="m"?we[Ue]=Ke:Ke=$e}for(var qe=0,Je=ye;qe<Re;++qe){var rt=we[qe];rt=="1"&&Je=="r"?we[qe]="n":T.test(rt)&&(Je=rt,rt=="r"&&(we[qe]="R"))}for(var dt=1,lt=we[0];dt<Re-1;++dt){var gt=we[dt];gt=="+"&&lt=="1"&&we[dt+1]=="1"?we[dt]="1":gt==","&&lt==we[dt+1]&&(lt=="1"||lt=="n")&&(we[dt]=lt),lt=gt}for(var Rt=0;Rt<Re;++Rt){var Vt=we[Rt];if(Vt==",")we[Rt]="N";else if(Vt=="%"){var Nt=void 0;for(Nt=Rt+1;Nt<Re&&we[Nt]=="%";++Nt);for(var pr=Rt&&we[Rt-1]=="!"||Nt<Re&&we[Nt]=="1"?"1":"N",ur=Rt;ur<Nt;++ur)we[ur]=pr;Rt=Nt-1}}for(var jt=0,dr=ye;jt<Re;++jt){var Qt=we[jt];dr=="L"&&Qt=="1"?we[jt]="L":T.test(Qt)&&(dr=Qt)}for(var zt=0;zt<Re;++zt)if(n.test(we[zt])){var Wt=void 0;for(Wt=zt+1;Wt<Re&&n.test(we[Wt]);++Wt);for(var Ft=(zt?we[zt-1]:ye)=="L",hr=(Wt<Re?we[Wt]:ye)=="L",zi=Ft==hr?Ft?"L":"R":ye,ei=zt;ei<Wt;++ei)we[ei]=zi;zt=Wt-1}for(var tr=[],Ir,Xt=0;Xt<Re;)if(W.test(we[Xt])){var Va=Xt;for(++Xt;Xt<Re&&W.test(we[Xt]);++Xt);tr.push(new Q(0,Va,Xt))}else{var zr=Xt,vi=tr.length,yi=pe=="rtl"?1:0;for(++Xt;Xt<Re&&we[Xt]!="L";++Xt);for(var nr=zr;nr<Xt;)if(Y.test(we[nr])){zr<nr&&(tr.splice(vi,0,new Q(1,zr,nr)),vi+=yi);var Gi=nr;for(++nr;nr<Xt&&Y.test(we[nr]);++nr);tr.splice(vi,0,new Q(2,Gi,nr)),vi+=yi,zr=nr}else++nr;zr<Xt&&tr.splice(vi,0,new Q(1,zr,Xt))}return pe=="ltr"&&(tr[0].level==1&&(Ir=re.match(/^\s+/))&&(tr[0].from=Ir[0].length,tr.unshift(new Q(0,0,Ir[0].length))),s(tr).level==1&&(Ir=re.match(/\s+$/))&&(s(tr).to-=Ir[0].length,tr.push(new Q(0,Re-Ir[0].length,Re)))),pe=="rtl"?tr.reverse():tr}}();function He(e,t){var i=e.order;return i==null&&(i=e.order=Ye(e.text,t)),i}var Xe=[],Oe=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Xe).concat(i)}};function tt(e,t){return e._handlers&&e._handlers[t]||Xe}function Qe(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var T=de(n,i);T>-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function le(e,t){var i=tt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function q(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),le(e,i||t.type,e,t),he(t)||t.codemirrorIgnore}function ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)de(i,t[r])==-1&&i.push(t[r])}function ae(e,t){return tt(e,t).length>0}function ue(e){e.prototype.on=function(t,i){Oe(this,t,i)},e.prototype.off=function(t,i){Qe(this,t,i)}}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 fe(e){te(e),ne(e)}function be(e){return e.target||e.srcElement}function Ce(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(K&&H<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),Ve;function et(e){if(Ve==null){var t=o("span","\u200B");u(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&H<8))}var i=Ve?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var it;function vt(e){if(it!=null)return it;var t=u(e,document.createTextNode("A\u062EA")),i=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return p(e),!i||i.left==i.right?!1:it=r.right-i.right<3}var st=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var T=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),W=T.indexOf("\r");W!=-1?(i.push(T.slice(0,W)),t+=W+1):(i.push(T),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},at=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function It(e){if(Et!=null)return Et;var t=u(e,o("span","x")),i=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return Et=Math.abs(i.left-r.left)>1}var Ot={},xt={};function mr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function Cr(e,t){xt[e]=t}function Yt(e){if(typeof e=="string"&&xt.hasOwnProperty(e))e=xt[e];else if(e&&typeof e.name=="string"&&xt.hasOwnProperty(e.name)){var t=xt[e.name];typeof t=="string"&&(t={name:t}),e=B(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=Yt(t);var i=Ot[t.name];if(!i)return gr(e,"text/plain");var r=i(e,t);if(cr.hasOwnProperty(t.name)){var n=cr[t.name];for(var T in n){if(!n.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=n[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var cr={};function Gr(e,t){var i=cr.hasOwnProperty(e)?cr[e]:cr[e]={};F(t,i)}function $t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Nr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function ti(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(W){return i?W.toLowerCase():W},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],T=n.chunkSize();if(t<T){i=n;break}t-=T}return i.lines[t]}function Ct(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(T){var W=T.text;n==i.line&&(W=W.slice(0,i.ch)),n==t.line&&(W=W.slice(t.ch)),r.push(W),++n}),r}function Jt(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function mt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function pt(e){if(e.parent==null)return null;for(var t=e.parent,i=de(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function _t(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],T=n.height;if(t<T){e=n;continue e}t-=T,i+=n.chunkSize()}return i}while(!e.lines);for(var W=0;W<e.lines.length;++W){var Y=e.lines[W],Q=Y.height;if(t<Q)break;t-=Q}return i+W}function vr(e,t){return t>=e.first&&t<e.first+e.size}function Ut(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function We(e,t,i){if(i===void 0&&(i=null),!(this instanceof We))return new We(e,t,i);this.line=e,this.ch=t,this.sticky=i}function ht(e,t){return e.line-t.line||e.ch-t.ch}function ri(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function bi(e){return We(e.line,e.ch)}function Ei(e,t){return ht(e,t)<0?t:e}function ii(e,t){return ht(e,t)<0?e:t}function xi(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return We(e.first,0);var i=e.first+e.size-1;return t.line>i?We(i,Ze(e,i).text.length):An(t,Ze(e,t.line).text.length)}function An(e,t){var i=e.ch;return i==null||i>t?We(e.line,t):i<0?We(e.line,0):e}function Ge(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=ft(e,t[r]);return i}var Si=function(e,t){this.state=e,this.lookAhead=t},xr=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};xr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},xr.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}},xr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xr.fromSaved=function(e,t,i){return t instanceof Si?new xr(e,$t(e.mode,t.state),i,t.lookAhead):new xr(e,$t(e.mode,t),i)},xr.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Si(t,this.maxLookAhead):t};function Ki(e,t,i,r){var n=[e.state.modeGen],T={};_r(e,t.text,e.doc.mode,i,function(re,pe){return n.push(re,pe)},T,r);for(var W=i.state,Y=function(re){i.baseTokens=n;var pe=e.state.overlays[re],ye=1,Re=0;i.state=!0,_r(e,t.text,pe.mode,i,function(we,Ne){for(var Ue=ye;Re<we;){var Ke=n[ye];Ke>we&&n.splice(ye,1,we,n[ye+1],Ke),ye+=2,Re=Math.min(we,Ke)}if(!Ne)return;if(pe.opaque)n.splice(Ue,ye-Ue,we,"overlay "+Ne),ye=Ue+2;else for(;Ue<ye;Ue+=2){var $e=n[Ue+1];n[Ue+1]=($e?$e+" ":"")+"overlay "+Ne}},T),i.state=W,i.baseTokens=null,i.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:n,classes:T.bgClass||T.textClass?T:null}}function ni(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Tr(e,pt(t)),n=t.text.length>e.options.maxHighlightLength&&$t(e.doc.mode,r.state),T=Ki(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Tr(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new xr(r,!0,t);var T=Dn(e,t,i),W=T>r.first&&Ze(r,T-1).stateAfter,Y=W?xr.fromSaved(r,W,T):new xr(r,ti(r.mode),T);return r.iter(T,t,function(Q){Vi(e,Q.text,Y);var re=Y.line;Q.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&re<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function Vi(e,t,i,r){var n=e.doc.mode,T=new Pt(t,e.options.tabSize,i);for(T.start=T.pos=r||0,t==""&&Xi(n,i.state);!T.eol();)wr(n,T,i.state),T.start=T.pos}function Xi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Nr(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function wr(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Nr(e,i).mode);var T=e.token(t,i);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yi=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Ln(e,t,i,r){var n=e.doc,T=n.mode,W;t=ft(n,t);var Y=Ze(n,t.line),Q=Tr(e,t.line,i),re=new Pt(Y.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,W=wr(T,re,Q.state),r&&pe.push(new Yi(re,W,$t(n.mode,Q.state)));return r?pe:new Yi(re,W,Q.state)}function $i(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function _r(e,t,i,r,n,T,W){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,re=null,pe=new Pt(t,e.options.tabSize,r),ye,Re=e.options.addModeClass&&[null];for(t==""&&$i(Xi(i,r.state),T);!pe.eol();){if(pe.pos>e.options.maxHighlightLength?(Y=!1,W&&Vi(e,t,r,pe.pos),pe.pos=t.length,ye=null):ye=$i(wr(i,pe,r.state,Re),T),Re){var we=Re[0].name;we&&(ye="m-"+(ye?we+" "+ye:we))}if(!Y||re!=ye){for(;Q<pe.start;)Q=Math.min(pe.start,Q+5e3),n(Q,re);re=ye}pe.start=pe.pos}for(;Q<pe.pos;){var Ne=Math.min(pe.pos,Q+5e3);n(Ne,re),Q=Ne}}function Dn(e,t,i){for(var r,n,T=e.doc,W=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>W;--Y){if(Y<=T.first)return T.first;var Q=Ze(T,Y-1),re=Q.stateAfter;if(re&&(!i||Y+(re instanceof Si?re.lookAhead:0)<=T.modeFrontier))return Y;var pe=$(Q.text,null,e.options.tabSize);(n==null||r>pe)&&(n=Y-1,r=pe)}return n}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=Ze(e,r).stateAfter;if(n&&(!(n instanceof Si)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ji=!1,rr=!1;function Kr(){Ji=!0}function oa(){rr=!0}function ai(e,t,i){this.marker=e,this.from=t,this.to=i}function Ar(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Zi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function kn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],W=T.marker,Y=T.from==null||(W.inclusiveLeft?T.from<=t:T.from<t);if(Y||T.from==t&&W.type=="bookmark"&&(!i||!T.marker.insertLeft)){var Q=T.to==null||(W.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new ai(W,T.from,Q?null:T.to))}}return r}function Rn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],W=T.marker,Y=T.to==null||(W.inclusiveRight?T.to>=t:T.to>t);if(Y||T.from==t&&W.type=="bookmark"&&(!i||T.marker.insertLeft)){var Q=T.from==null||(W.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new ai(W,Q?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Ci(e,t){if(t.full)return null;var i=vr(e,t.from.line)&&Ze(e,t.from.line).markedSpans,r=vr(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,T=t.to.ch,W=ht(t.from,t.to)==0,Y=kn(i,n,W),Q=Rn(r,T,W),re=t.text.length==1,pe=s(t.text).length+(re?n:0);if(Y)for(var ye=0;ye<Y.length;++ye){var Re=Y[ye];if(Re.to==null){var we=Ar(Q,Re.marker);we?re&&(Re.to=we.to==null?null:we.to+pe):Re.to=n}}if(Q)for(var Ne=0;Ne<Q.length;++Ne){var Ue=Q[Ne];if(Ue.to!=null&&(Ue.to+=pe),Ue.from==null){var Ke=Ar(Y,Ue.marker);Ke||(Ue.from=pe,re&&(Y||(Y=[])).push(Ue))}else Ue.from+=pe,re&&(Y||(Y=[])).push(Ue)}Y&&(Y=On(Y)),Q&&Q!=Y&&(Q=On(Q));var $e=[Y];if(!re){var qe=t.text.length-2,Je;if(qe>0&&Y)for(var rt=0;rt<Y.length;++rt)Y[rt].to==null&&(Je||(Je=[])).push(new ai(Y[rt].marker,null,null));for(var dt=0;dt<qe;++dt)$e.push(Je);$e.push(Q)}return $e}function On(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Pn(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var Ne=0;Ne<we.markedSpans.length;++Ne){var Ue=we.markedSpans[Ne].marker;Ue.readOnly&&(!r||de(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var n=[{from:t,to:i}],T=0;T<r.length;++T)for(var W=r[T],Y=W.find(0),Q=0;Q<n.length;++Q){var re=n[Q];if(ht(re.to,Y.from)<0||ht(re.from,Y.to)>0)continue;var pe=[Q,1],ye=ht(re.from,Y.from),Re=ht(re.to,Y.to);(ye<0||!W.inclusiveLeft&&!ye)&&pe.push({from:re.from,to:Y.from}),(Re>0||!W.inclusiveRight&&!Re)&&pe.push({from:Y.to,to:re.to}),n.splice.apply(n,pe),Q+=pe.length-3}return n}function la(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Ti(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function oi(e){return e.inclusiveLeft?-1:0}function si(e){return e.inclusiveRight?1:0}function wi(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),T=ht(r.from,n.from)||oi(e)-oi(t);if(T)return-T;var W=ht(r.to,n.to)||si(e)-si(t);return W||t.id-e.id}function Fr(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=void 0,T=0;T<i.length;++T)n=i[T],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||wi(r,n.marker)<0)&&(r=n.marker);return r}function Br(e){return Fr(e,!0)}function Ur(e){return Fr(e,!1)}function _i(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var T=i[n];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||wi(r,T.marker)<0)&&(r=T.marker)}return r}function Mn(e,t,i,r,n){var T=Ze(e,t),W=rr&&T.markedSpans;if(W)for(var Y=0;Y<W.length;++Y){var Q=W[Y];if(!Q.marker.collapsed)continue;var re=Q.marker.find(0),pe=ht(re.from,i)||oi(Q.marker)-oi(n),ye=ht(re.to,r)||si(Q.marker)-si(n);if(pe>=0&&ye<=0||pe<=0&&ye>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ht(re.to,i)>=0:ht(re.to,i)>0)||pe>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ht(re.from,r)<=0:ht(re.from,r)<0))return!0}}function yr(e){for(var t;t=Br(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function Ai(e){for(var t,i;t=Ur(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Qi(e,t){var i=Ze(e,t),r=yr(i);return i==r?t:pt(r)}function Vr(e,t){if(t>e.lastLine())return t;var i=Ze(e,t),r;if(!Or(e,i))return t;for(;r=Ur(i);)i=r.find(1,!0).line;return pt(i)+1}function Or(e,t){var i=rr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qi(e,t,r))return!0}}function qi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return qi(e,r.line,Ar(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,T=0;T<t.markedSpans.length;++T)if(n=t.markedSpans[T],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&qi(e,t,n))return!0}function Lr(e){e=yr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var T=i.parent;T;i=T,T=i.parent)for(var W=0;W<T.children.length;++W){var Y=T.children[W];if(Y==i)break;t+=Y.height}return t}function en(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Br(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ur(r);){var T=i.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function Nn(e){var t=e.display,i=e.doc;t.maxLine=Ze(i,i.first),t.maxLineLength=en(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=en(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var li=function(e,t,i){this.text=e,Ti(this,t),this.height=i?i(this):1};li.prototype.lineNo=function(){return pt(this)},ue(li);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Ti(e,i);var n=r?r(e):1;n!=e.height&&mt(e,n)}function ot(e){e.parent=null,la(e)}var ct={},ut={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?ut:ct;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Tt(e,t){var i=E("span",null,null,N?"padding-right: .1px":null),r={pre:E("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var T=n?t.rest[n-1]:t.line,W=void 0;r.pos=0,r.addToken=St,vt(e.display.measure)&&(W=He(T,e.doc.direction))&&(r.addToken=ar(r.addToken,W)),r.map=[];var Y=t!=e.display.externalMeasured&&pt(T);jr(T,r,ni(e,T,Y)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=G(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=G(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(et(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(N){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=G(r.pre.className,r.textClass||"")),r}function kt(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 St(e,t,i,r,n,T,W){if(!t)return;var Y=e.splitSpaces?Ht(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,pe),K&&H<9&&(re=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ye=0;;){Q.lastIndex=ye;var Re=Q.exec(t),we=Re?Re.index-ye:t.length-ye;if(we){var Ne=document.createTextNode(Y.slice(ye,ye+we));K&&H<9?pe.appendChild(o("span",[Ne])):pe.appendChild(Ne),e.map.push(e.pos,e.pos+we,Ne),e.col+=we,e.pos+=we}if(!Re)break;ye+=we+1;var Ue=void 0;if(Re[0]==" "){var Ke=e.cm.options.tabSize,$e=Ke-e.col%Ke;Ue=pe.appendChild(o("span",z($e),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=$e}else Re[0]=="\r"||Re[0]==`
`?(Ue=pe.appendChild(o("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",Re[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(Re[0]),Ue.setAttribute("cm-text",Re[0]),K&&H<9?pe.appendChild(o("span",[Ue])):pe.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||re||T||W){var qe=i||"";r&&(qe+=r),n&&(qe+=n);var Je=o("span",[pe],qe,T);if(W)for(var rt in W)W.hasOwnProperty(rt)&&rt!="style"&&rt!="class"&&Je.setAttribute(rt,W[rt]);return e.content.appendChild(Je)}e.content.appendChild(pe)}function Ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var T=e.charAt(n);T==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(T="\xA0"),r+=T,i=T==" "}return r}function ar(e,t){return function(i,r,n,T,W,Y,Q){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,pe=re+r.length;;){for(var ye=void 0,Re=0;Re<t.length&&!(ye=t[Re],ye.to>re&&ye.from<=re);Re++);if(ye.to>=pe)return e(i,r,n,T,W,Y,Q);e(i,r.slice(0,ye.to-re),n,T,null,Y,Q),T=null,r=r.slice(ye.to-re),re=ye.to}}}function bt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function jr(e,t,i){var r=e.markedSpans,n=e.text,T=0;if(!r){for(var W=1;W<i.length;W+=2)t.addToken(t,n.slice(T,T=i[W]),yt(i[W+1],t.cm.options));return}for(var Y=n.length,Q=0,re=1,pe="",ye,Re,we=0,Ne,Ue,Ke,$e,qe;;){if(we==Q){Ne=Ue=Ke=Re="",qe=null,$e=null,we=Infinity;for(var Je=[],rt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],gt=lt.marker;if(gt.type=="bookmark"&&lt.from==Q&&gt.widgetNode)Je.push(gt);else if(lt.from<=Q&&(lt.to==null||lt.to>Q||gt.collapsed&&lt.to==Q&&lt.from==Q)){if(lt.to!=null&&lt.to!=Q&&we>lt.to&&(we=lt.to,Ue=""),gt.className&&(Ne+=" "+gt.className),gt.css&&(Re=(Re?Re+";":"")+gt.css),gt.startStyle&&lt.from==Q&&(Ke+=" "+gt.startStyle),gt.endStyle&&lt.to==we&&(rt||(rt=[])).push(gt.endStyle,lt.to),gt.title&&((qe||(qe={})).title=gt.title),gt.attributes)for(var Rt in gt.attributes)(qe||(qe={}))[Rt]=gt.attributes[Rt];gt.collapsed&&(!$e||wi($e.marker,gt)<0)&&($e=lt)}else lt.from>Q&&we>lt.from&&(we=lt.from)}if(rt)for(var Vt=0;Vt<rt.length;Vt+=2)rt[Vt+1]==we&&(Ue+=" "+rt[Vt]);if(!$e||$e.from==Q)for(var Nt=0;Nt<Je.length;++Nt)bt(t,0,Je[Nt]);if($e&&($e.from||0)==Q){if(bt(t,($e.to==null?Y+1:$e.to)-Q,$e.marker,$e.from==null),$e.to==null)return;$e.to==Q&&($e=!1)}}if(Q>=Y)break;for(var pr=Math.min(Y,we);;){if(pe){var ur=Q+pe.length;if(!$e){var jt=ur>pr?pe.slice(0,pr-Q):pe;t.addToken(t,jt,ye?ye+Ne:Ne,Ke,Q+jt.length==we?Ue:"",Re,qe)}if(ur>=pr){pe=pe.slice(pr-Q),Q=pr;break}Q=ur,Ke=""}pe=n.slice(T,T=i[re++]),ye=yt(i[re++],t.cm.options)}}}function At(e,t,i){this.line=t,this.rest=Ai(t),this.size=this.rest?pt(s(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Or(e,t)}function or(e,t,i){for(var r=[],n,T=t;T<i;T=n){var W=new At(e.doc,Ze(e.doc,T),T);n=T+W.size,r.push(W)}return r}var qt=null;function Sr(e){qt?qt.ops.push(e):e.ownsGroup=qt={ops:[e],delayedCallbacks:[]}}function ks(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Rs(e,t){var i=e.ownsGroup;if(!i)return;try{ks(i)}finally{qt=null,t(i)}}var tn=null;function Zt(e,t){var i=tt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;qt?n=qt.delayedCallbacks:tn?n=tn:(n=tn=[],setTimeout(Os,0));for(var T=function(Y){n.push(function(){return i[Y].apply(null,r)})},W=0;W<i.length;++W)T(W)}function Os(){var e=tn;tn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,i,r){for(var n=0;n<t.changes.length;n++){var T=t.changes[n];T=="text"?Ms(e,t):T=="gutter"?Ja(e,t,i,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function rn(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),K&&H<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=rn(t);t.background=r.insertBefore(o("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Tt(e,t)}function Ms(e,t){var i=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):i&&(t.text.className=i)}function da(e,t){Ps(e,t),t.line.wrapClass?rn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Ja(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=rn(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var W=rn(t),Y=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),W.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(o("div",Ut(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=e.display.gutterSpecs[Q].className,pe=T.hasOwnProperty(re)&&T[re];pe&&Y.appendChild(o("div",[pe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),n=t.node.firstChild,T=void 0;n;n=T)T=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Za(e,t,i)}function Ns(e,t,i,r){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),da(e,t),Ja(e,t,i,r),Za(e,t,r),t.node}function Za(e,t,i){if(Qa(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,i,!1)}function Qa(e,t,i,r,n){if(!t.widgets)return;for(var T=rn(i),W=0,Y=t.widgets;W<Y.length;++W){var Q=Y[W],re=o("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Fs(Q,re,i,r),e.display.input.setUneditable(re),n&&Q.above?T.insertBefore(re,i.gutter||i.text):T.appendChild(re),Zt(Q,"redraw")}}function Fs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function nn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!x(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Wr(e,t){for(var i=be(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Fn(e){return e.lineSpace.offsetTop}function ha(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,o("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Pr(e){return ge-e.display.nativeBarWidth}function ui(e){return e.display.scroller.clientWidth-Pr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Pr(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&ui(e);if(!t.measure.heights||r&&t.measure.width!=n){var T=t.measure.heights=[];if(r){t.measure.width=n;for(var W=t.text.firstChild.getClientRects(),Y=0;Y<W.length-1;Y++){var Q=W[Y],re=W[Y+1];Math.abs(Q.bottom-re.bottom)>2&&T.push((Q.bottom+re.top)/2-i.top)}}T.push(i.bottom-i.top)}}function eo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(pt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=yr(t);var i=pt(t),r=e.display.externalMeasured=new At(e.doc,t,i);r.lineN=i;var n=r.built=Tt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Mr(e,Li(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ci(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Li(e,t){var i=pt(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=eo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Mr(e,t,i,r,n){t.before&&(i=-1);var T=i+(r||""),W;return t.cache.hasOwnProperty(T)?W=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,i,r),W.bogus||(t.cache[T]=W)),{left:W.left,right:W.right,top:n?W.rtop:W.top,bottom:n?W.rbottom:W.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,T,W,Y,Q,re=0;re<e.length;re+=3)if(Y=e[re],Q=e[re+1],t<Y?(n=0,T=1,W="left"):t<Q?(n=t-Y,T=n+1):(re==e.length-3||t==Q&&e[re+3]>t)&&(T=Q-Y,n=T-1,t>=Q&&(W="right")),n!=null){if(r=e[re+2],Y==Q&&i==(r.insertLeft?"left":"right")&&(W=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],W="left";if(i=="right"&&n==Q-Y)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],W="right";break}return{node:r,start:n,end:T,collapse:W,coverStart:Y,coverEnd:Q}}function js(e,t){var i=ro;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=io(t.map,i,r),T=n.node,W=n.start,Y=n.end,Q=n.collapse,re;if(T.nodeType==3){for(var pe=0;pe<4;pe++){for(;W&&De(t.line.text.charAt(n.coverStart+W));)--W;for(;n.coverStart+Y<n.coverEnd&&De(t.line.text.charAt(n.coverStart+Y));)++Y;if(K&&H<9&&W==0&&Y==n.coverEnd-n.coverStart?re=T.parentNode.getBoundingClientRect():re=js(g(T,W,Y).getClientRects(),r),re.left||re.right||W==0)break;Y=W,W=W-1,Q="right"}K&&H<11&&(re=Hs(e.display.measure,re))}else{W>0&&(Q=r="right");var ye;e.options.lineWrapping&&(ye=T.getClientRects()).length>1?re=ye[r=="right"?ye.length-1:0]:re=T.getBoundingClientRect()}if(K&&H<9&&!W&&(!re||!re.left&&!re.right)){var Re=T.parentNode.getClientRects()[0];Re?re={left:Re.left,right:Re.left+ki(e.display),top:Re.top,bottom:Re.bottom}:re=ro}for(var we=re.top-t.rect.top,Ne=re.bottom-t.rect.top,Ue=(we+Ne)/2,Ke=t.view.measure.heights,$e=0;$e<Ke.length-1&&!(Ue<Ke[$e]);$e++);var qe=$e?Ke[$e-1]:0,Je=Ke[$e],rt={left:(Q=="right"?re.right:re.left)-t.rect.left,right:(Q=="left"?re.left:re.right)-t.rect.left,top:qe,bottom:Je};return!re.left&&!re.right&&(rt.bogus=!0),e.options.singleCursorHeightPerLine||(rt.rtop=we,rt.rbottom=Ne),rt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!It(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function no(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 ao(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function an(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return b&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&h?-(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 i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=nn(e.widgets[i]));return t}function Bn(e,t,i,r,n){if(!n){var T=pa(t);i.top+=T,i.bottom+=T}if(r=="line")return i;r||(r="local");var W=Lr(t);if(r=="local"?W+=Fn(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();W+=Y.top+(r=="window"?0:so());var Q=Y.left+(r=="window"?0:oo());i.left+=Q,i.right+=Q}return i.top+=W,i.bottom+=W,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var T=e.display.sizer.getBoundingClientRect();r+=T.left,n+=T.top}var W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:n-W.top}}function ma(e,t,i,r,n){return r||(r=Ze(e.doc,t.line)),Bn(e,r,to(e,r,t.ch,n),i)}function Dr(e,t,i,r,n,T){r=r||Ze(e.doc,t.line),n||(n=Li(e,r));function W(Ne,Ue){var Ke=Mr(e,n,Ne,Ue?"right":"left",T);return Ue?Ke.left=Ke.right:Ke.right=Ke.left,Bn(e,r,Ke,i)}var Y=He(r,e.doc.direction),Q=t.ch,re=t.sticky;if(Q>=r.text.length?(Q=r.text.length,re="before"):Q<=0&&(Q=0,re="after"),!Y)return W(re=="before"?Q-1:Q,re=="before");function pe(Ne,Ue,Ke){var $e=Y[Ue],qe=$e.level==1;return W(Ke?Ne-1:Ne,qe!=Ke)}var ye=Ie(Y,Q,re),Re=Be,we=pe(Q,ye,re=="before");return Re!=null&&(we.other=pe(Q,Re,re!="before")),we}function uo(e,t){var i=0;t=ft(e.doc,t),e.options.lineWrapping||(i=ki(e.display)*t.ch);var r=Ze(e.doc,t.line),n=Lr(r)+Fn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var T=We(e,t,i);return T.xRel=n,r&&(T.outside=r),T}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=_t(r,i),T=r.first+r.size-1;if(n>T)return ga(r.first+r.size-1,Ze(r,T).text.length,null,1,1);t<0&&(t=0);for(var W=Ze(r,n);;){var Y=zs(e,W,n,t,i),Q=_i(W,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var re=Q.find(1);if(re.line==n)return re;W=Ze(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,T=Fe(function(W){return Mr(e,i,W-1).bottom<=r},n,0);return n=Fe(function(W){return Mr(e,i,W).top>r},T,n),{begin:T,end:n}}function co(e,t,i,r){i||(i=Li(e,t));var n=Bn(e,t,Mr(e,i,r),"line").top;return ho(e,t,i,n)}function ya(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zs(e,t,i,r,n){n-=Lr(t);var T=Li(e,t),W=pa(t),Y=0,Q=t.text.length,re=!0,pe=He(t,e.doc.direction);if(pe){var ye=(e.options.lineWrapping?Ks:Gs)(e,t,i,T,pe,r,n);re=ye.level!=1,Y=re?ye.from:ye.to-1,Q=re?ye.to:ye.from-1}var Re=null,we=null,Ne=Fe(function(dt){var lt=Mr(e,T,dt);return lt.top+=W,lt.bottom+=W,ya(lt,r,n,!1)?(lt.top<=n&&lt.left<=r&&(Re=dt,we=lt),!0):!1},Y,Q),Ue,Ke,$e=!1;if(we){var qe=r-we.left<we.right-r,Je=qe==re;Ne=Re+(Je?0:1),Ke=Je?"after":"before",Ue=qe?we.left:we.right}else{!re&&(Ne==Q||Ne==Y)&&Ne++,Ke=Ne==0?"after":Ne==t.text.length?"before":Mr(e,T,Ne-(re?1:0)).bottom+W<=n==re?"after":"before";var rt=Dr(e,We(i,Ne,Ke),"line",t,T);Ue=rt.left,$e=n<rt.top?-1:n>=rt.bottom?1:0}return Ne=ke(t.text,Ne,1),ga(i,Ne,Ke,$e,r-Ue)}function Gs(e,t,i,r,n,T,W){var Y=Fe(function(ye){var Re=n[ye],we=Re.level!=1;return ya(Dr(e,We(i,we?Re.to:Re.from,we?"before":"after"),"line",t,r),T,W,!0)},0,n.length-1),Q=n[Y];if(Y>0){var re=Q.level!=1,pe=Dr(e,We(i,re?Q.from:Q.to,re?"after":"before"),"line",t,r);ya(pe,T,W,!0)&&pe.top>W&&(Q=n[Y-1])}return Q}function Ks(e,t,i,r,n,T,W){var Y=ho(e,t,r,W),Q=Y.begin,re=Y.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var pe=null,ye=null,Re=0;Re<n.length;Re++){var we=n[Re];if(we.from>=re||we.to<=Q)continue;var Ne=we.level!=1,Ue=Mr(e,r,Ne?Math.min(re,we.to)-1:Math.max(Q,we.from)).right,Ke=Ue<T?T-Ue+1e9:Ue-T;(!pe||ye>Ke)&&(pe=we,ye=Ke)}return pe||(pe=n[n.length-1]),pe.from<Q&&(pe={from:Q,to:pe.to,level:pe.level}),pe.to>re&&(pe={from:pe.from,to:re,level:pe.level}),pe}var di;function Di(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(di==null){di=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)di.appendChild(document.createTextNode("x")),di.appendChild(o("br"));di.appendChild(document.createTextNode("x"))}u(e.measure,di);var i=di.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),p(e.measure),i||1}function ki(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,T=t.gutters.firstChild,W=0;T;T=T.nextSibling,++W){var Y=e.display.gutterSpecs[W].className;i[Y]=T.offsetLeft+T.clientLeft+n,r[Y]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Di(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ki(e.display)-3);return function(n){if(Or(e.doc,n))return 0;var T=0;if(n.widgets)for(var W=0;W<n.widgets.length;W++)n.widgets[W].height&&(T+=n.widgets[W].height);return i?T+(Math.ceil(n.text.length/r)||1)*t:T+t}}function xa(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&mt(r,n)})}function hi(e,t,i,r){var n=e.display;if(!i&&be(t).getAttribute("cm-not-content")=="true")return null;var T,W,Y=n.lineSpace.getBoundingClientRect();try{T=t.clientX-Y.left,W=t.clientY-Y.top}catch(ye){return null}var Q=va(e,T,W),re;if(r&&Q.xRel>0&&(re=Ze(e.doc,Q.line).text).length==Q.ch){var pe=$(re,re.length,e.options.tabSize)-re.length;Q=We(Q.line,Math.max(0,Math.round((T-qa(e.display).left)/ki(e.display))-pe))}return Q}function ci(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function sr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&Qi(e.doc,t)<n.viewTo&&Yr(e);else if(i<=n.viewFrom)rr&&Vr(e.doc,i+r)>n.viewFrom?Yr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Yr(e);else if(t<=n.viewFrom){var T=Un(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):Yr(e)}else if(i>=n.viewTo){var W=Un(e,t,t,-1);W?(n.view=n.view.slice(0,W.index),n.viewTo=W.lineN):Yr(e)}else{var Y=Un(e,t,t,-1),Q=Un(e,i,i+r,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(or(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=r):Yr(e)}var re=n.externalMeasured;re&&(i<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(n.externalMeasured=null))}function Xr(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[ci(e,t)];if(T.node==null)return;var W=T.changes||(T.changes=[]);de(W,i)==-1&&W.push(i)}function Yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,i,r){var n=ci(e,t),T,W=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Q=0;Q<n;Q++)Y+=W[Q].size;if(Y!=t){if(r>0){if(n==W.length-1)return null;T=Y+W[n].size-t,n++}else T=Y-t;t+=T,i+=T}for(;Qi(e.doc,i)!=i;){if(n==(r<0?0:W.length-1))return null;i+=r*W[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=or(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=or(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ci(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(or(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ci(e,i)))),r.viewTo=i}function po(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function on(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),W=0;W<i.sel.ranges.length;W++){if(!t&&W==i.sel.primIndex)continue;var Y=i.sel.ranges[W];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,Y.head,n),Q||Xs(e,Y,T)}return r}function go(e,t,i){var r=Dr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(o("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function jn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,T=document.createDocumentFragment(),W=qa(e.display),Y=W.left,Q=Math.max(r.sizerWidth,ui(e)-r.sizer.offsetLeft)-W.right,re=n.direction=="ltr";function pe(Je,rt,dt,lt){rt<0&&(rt=0),rt=Math.round(rt),lt=Math.round(lt),T.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
top: `+rt+"px; width: "+(dt==null?Q-Je:dt)+`px;
height: `+(lt-rt)+"px"))}function ye(Je,rt,dt){var lt=Ze(n,Je),gt=lt.text.length,Rt,Vt;function Nt(jt,dr){return ma(e,We(Je,jt),"div",lt,dr)}function pr(jt,dr,Qt){var zt=co(e,lt,null,jt),Wt=dr=="ltr"==(Qt=="after")?"left":"right",Ft=Qt=="after"?zt.begin:zt.end-(/\s/.test(lt.text.charAt(zt.end-1))?2:1);return Nt(Ft,Wt)[Wt]}var ur=He(lt,n.direction);return je(ur,rt||0,dt==null?gt:dt,function(jt,dr,Qt,zt){var Wt=Qt=="ltr",Ft=Nt(jt,Wt?"left":"right"),hr=Nt(dr-1,Wt?"right":"left"),zi=rt==null&&jt==0,ei=dt==null&&dr==gt,tr=zt==0,Ir=!ur||zt==ur.length-1;if(hr.top-Ft.top<=3){var Xt=(re?zi:ei)&&tr,Va=(re?ei:zi)&&Ir,zr=Xt?Y:(Wt?Ft:hr).left,vi=Va?Q:(Wt?hr:Ft).right;pe(zr,Ft.top,vi-zr,Ft.bottom)}else{var yi,nr,Gi,Xa;Wt?(yi=re&&zi&&tr?Y:Ft.left,nr=re?Q:pr(jt,Qt,"before"),Gi=re?Y:pr(dr,Qt,"after"),Xa=re&&ei&&Ir?Q:hr.right):(yi=re?pr(jt,Qt,"before"):Y,nr=!re&&zi&&tr?Q:Ft.right,Gi=!re&&ei&&Ir?Y:hr.left,Xa=re?pr(dr,Qt,"after"):Q),pe(yi,Ft.top,nr-yi,Ft.bottom),Ft.bottom<hr.top&&pe(Y,Ft.bottom,null,hr.top),pe(Gi,hr.top,Xa-Gi,hr.bottom)}(!Rt||jn(Ft,Rt)<0)&&(Rt=Ft),jn(hr,Rt)<0&&(Rt=hr),(!Vt||jn(Ft,Vt)<0)&&(Vt=Ft),jn(hr,Vt)<0&&(Vt=hr)}),{start:Rt,end:Vt}}var Re=t.from(),we=t.to();if(Re.line==we.line)ye(Re.line,Re.ch,we.ch);else{var Ne=Ze(n,Re.line),Ue=Ze(n,we.line),Ke=yr(Ne)==yr(Ue),$e=ye(Re.line,Re.ch,Ke?Ne.text.length+1:null).end,qe=ye(we.line,Ke?0:null,we.ch).start;Ke&&($e.top<qe.top-2?(pe($e.right,$e.top,null,$e.bottom),pe(Y,qe.top,qe.left,qe.bottom)):pe($e.right,$e.top,qe.left-$e.right,$e.bottom)),$e.bottom<qe.top&&pe(Y,$e.bottom,null,qe.top)}i.appendChild(T)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ri(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ri(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(le(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),N&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Ri(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(le(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],T=e.options.lineWrapping,W=void 0,Y=0;if(n.hidden)continue;if(K&&H<8){var Q=n.node.offsetTop+n.node.offsetHeight;W=Q-i,i=Q}else{var re=n.node.getBoundingClientRect();W=re.bottom-re.top,!T&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var pe=n.line.height-W;if((pe>.005||pe<-.005)&&(mt(n.line,W),bo(n.line),n.rest))for(var ye=0;ye<n.rest.length;ye++)bo(n.rest[ye]);if(Y>e.display.sizerWidth){var Re=Math.ceil(Y/ki(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Hn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Fn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,T=_t(t,r),W=_t(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Q=i.ensure.to.line;Y<T?(T=Y,W=_t(t,Lr(Ze(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=W&&(T=_t(t,Lr(Ze(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:T,to:Math.max(W,T+1)}}function Ys(e,t){if(q(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!S){var T=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Fn(e.display))+`px;
height: `+(t.bottom-t.top+Pr(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(n),e.display.lineSpace.removeChild(T)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?We(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?We(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var W=!1,Y=Dr(e,t),Q=!i||i==t?Y:Dr(e,i);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var re=Ta(e,n),pe=e.doc.scrollTop,ye=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(W=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(W=!0)),!W)break}return n}function Js(e,t){var i=Ta(e,t);i.scrollTop!=null&&ln(e,i.scrollTop),i.scrollLeft!=null&&fi(e,i.scrollLeft)}function Ta(e,t){var i=e.display,r=Di(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,T=ca(e),W={};t.bottom-t.top>T&&(t.bottom=t.top+T);var Y=e.doc.height+ha(i),Q=t.top<r,re=t.bottom>Y-r;if(t.top<n)W.scrollTop=Q?0:t.top;else if(t.bottom>n+T){var pe=Math.min(t.top,(re?Y:t.bottom)-T);pe!=n&&(W.scrollTop=pe)}var ye=e.options.fixedGutter?0:i.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ye,we=ui(e)-i.gutters.offsetWidth,Ne=t.right-t.left>we;return Ne&&(t.right=t.left+we),t.left<10?W.scrollLeft=0:t.left<Re?W.scrollLeft=Math.max(0,t.left+ye-(Ne?0:10)):t.right>we+Re-3&&(W.scrollLeft=t.right+(Ne?0:10)-we),W}function wa(e,t){if(t==null)return;zn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Oi(e){zn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sn(e,t,i){(t!=null||i!=null)&&zn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Zs(e,t){zn(e),e.curOp.scrollToPos=t}function zn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);Eo(e,i,r,t.margin)}}function Eo(e,t,i,r){var n=Ta(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});sn(e,n.scrollLeft,n.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Aa(e,{top:t}),xo(e,t,!0),O&&Aa(e),hn(e,100)}function xo(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ha(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Pr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var pi=function(e,t,i){this.cm=i;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=l&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ie,this.disableVert=new ie},pi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),T=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var dn=function(){};dn.prototype.update=function(){return{bottom:0,right:0}},dn.prototype.setScrollLeft=function(){},dn.prototype.setScrollTop=function(){},dn.prototype.clear=function(){};function Pi(e,t){t||(t=un(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Wn(e),So(e,un(e)),i=e.display.barWidth,r=e.display.barHeight}function So(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Co={native:pi,null:dn};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?fi(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function mi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},Sr(e.curOp)}function gi(e){var t=e.curOp;t&&Rs(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var T=0;T<t.length;T++)il(t[T]);for(var W=0;W<t.length;W++)nl(t[W])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Nn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Wn(t),e.barMeasure=un(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Pr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-ui(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&vo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var T=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(T)for(var Y=0;Y<T.length;++Y)T[Y].lines.length||le(T[Y],"hide");if(W)for(var Q=0;Q<W.length;++Q)W[Q].lines.length&&le(W[Q],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function fr(e,t){if(e.curOp)return t();mi(e);try{return t()}finally{gi(e)}}function Gt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mi(e);try{return t.apply(e,arguments)}finally{gi(e)}}}function ir(e){return function(){if(this.curOp)return e.apply(this,arguments);mi(this);try{return e.apply(this,arguments)}finally{gi(this)}}}function Kt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mi(t);try{return e.apply(this,arguments)}finally{gi(t)}}}function hn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Tr(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var W=T.styles,Y=T.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,Q=Ki(e,T,r,!0);Y&&(r.state=Y),T.styles=Q.styles;var re=T.styleClasses,pe=Q.classes;pe?T.styleClasses=pe:re&&(T.styleClasses=null);for(var ye=!W||W.length!=T.styles.length||re!=pe&&(!re||!pe||re.bgClass!=pe.bgClass||re.textClass!=pe.textClass),Re=0;!ye&&Re<W.length;++Re)ye=W[Re]!=T.styles[Re];ye&&n.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Vi(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return hn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&fr(e,function(){for(var T=0;T<n.length;T++)Xr(e,n[T],"text")})}var Gn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Hn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ui(e),this.force=i,this.dims=ba(e),this.events=[]};Gn.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Gn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)le.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Pr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Pr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();if(!t||!x(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Yr(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&po(e)==0)return!1;Ao(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<T&&T-i.viewFrom<20&&(T=Math.max(r.first,i.viewFrom)),i.viewTo>W&&i.viewTo-W<20&&(W=Math.min(n,i.viewTo)),rr&&(T=Qi(e.doc,T),W=Vr(e.doc,W));var Y=T!=i.viewFrom||W!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,W),i.viewOffset=Lr(Ze(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Q=po(e);if(!Y&&Q==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return Q>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Q>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),p(i.cursorDiv),p(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,hn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ha(e.display)-ca(e),i.top)}),t.visible=Hn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hn(e.display,e.doc,i));if(!_a(e,t))break;Wn(e);var n=un(e);on(e),Pi(e,n),Da(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var i=new Gn(e,t);if(_a(e,i)){Wn(e),wo(e,i);var r=un(e);on(e),Pi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,T=r.lineDiv,W=T.firstChild;function Y(Ne){var Ue=Ne.nextSibling;return N&&l&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),Ue}for(var Q=r.view,re=r.viewFrom,pe=0;pe<Q.length;pe++){var ye=Q[pe];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=T){var Re=Ns(e,ye,re,i);T.insertBefore(Re,W)}else{for(;W!=ye.node;)W=Y(W);var we=n&&t!=null&&t<=re&&ye.lineNumber;ye.changes&&(de(ye.changes,"gutter")>-1&&(we=!1),Ya(e,ye,re,i)),we&&(p(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(Ut(e.options,re)))),W=ye.node.nextSibling}re+=ye.size}for(;W;)W=Y(W)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Pr(e)+"px"}function _o(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,T=r+"px",W=0;W<i.length;W++)if(!i[W].hidden){e.options.fixedGutter&&(i[W].gutter&&(i[W].gutter.style.left=T),i[W].gutterBackground&&(i[W].gutterBackground.style.left=T));var Y=i[W].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Ut(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=n.firstChild.offsetWidth,W=n.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function ka(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var T=e[n],W=null;if(typeof T!="string"&&(W=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:T,style:W})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Lo(e){var t=e.gutters,i=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],T=n.className,W=n.style,Y=t.appendChild(o("div",null,"CodeMirror-gutter "+T));W&&(Y.style.cssText=W),T=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function cn(e){Lo(e.display),sr(e),_o(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=E("div",null,"CodeMirror-code"),n.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=o("div",null,"CodeMirror-cursors"),n.measure=o("div",null,"CodeMirror-measure"),n.lineMeasure=o("div",null,"CodeMirror-measure"),n.lineSpace=E("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var T=E("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[T],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+ge+"px; width: 1px;"),n.gutters=o("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=o("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=o("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),K&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!N&&!(O&&a)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=ka(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var Kn=0,br=null;K?br=-.53:O?br=15:b?br=-.7:P&&(br=-1/3);function Do(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=Do(e);return t.x*=br,t.y*=br,t}function ko(e,t){var i=Do(t),r=i.x,n=i.y,T=e.display,W=T.scroller,Y=W.scrollWidth>W.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&Y||n&&Q))return;if(n&&l&&N){e:for(var re=t.target,pe=T.view;re!=W;re=re.parentNode)for(var ye=0;ye<pe.length;ye++)if(pe[ye].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!O&&!_&&br!=null){n&&Q&&ln(e,Math.max(0,W.scrollTop+n*br)),fi(e,Math.max(0,W.scrollLeft+r*br)),(!n||n&&Q)&&te(t),T.wheelStartX=null;return}if(n&&br!=null){var Re=n*br,we=e.doc.scrollTop,Ne=we+T.wrapper.clientHeight;Re<0?we=Math.max(0,we+Re-50):Ne=Math.min(e.doc.height,Ne+Re+50),Aa(e,{top:we,bottom:Ne})}Kn<20&&(T.wheelStartX==null?(T.wheelStartX=W.scrollLeft,T.wheelStartY=W.scrollTop,T.wheelDX=r,T.wheelDY=n,setTimeout(function(){if(T.wheelStartX==null)return;var Ue=W.scrollLeft-T.wheelStartX,Ke=W.scrollTop-T.wheelStartY,$e=Ke&&T.wheelDY&&Ke/T.wheelDY||Ue&&T.wheelDX&&Ue/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!$e)return;br=(br*Kn+$e)/(Kn+1),++Kn},200)):(T.wheelDX+=r,T.wheelDY+=n))}var Er=function(e,t){this.ranges=e,this.primIndex=t};Er.prototype.primary=function(){return this.ranges[this.primIndex]},Er.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!ri(i.anchor,r.anchor)||!ri(i.head,r.head))return!1}return!0},Er.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Lt(bi(this.ranges[t].anchor),bi(this.ranges[t].head));return new Er(e,this.primIndex)},Er.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Er.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return i}return-1};var Lt=function(e,t){this.anchor=e,this.head=t};Lt.prototype.from=function(){return ii(this.anchor,this.head)},Lt.prototype.to=function(){return Ei(this.anchor,this.head)},Lt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function kr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Re,we){return ht(Re.from(),we.from())}),i=de(t,n);for(var T=1;T<t.length;T++){var W=t[T],Y=t[T-1],Q=ht(Y.to(),W.from());if(r&&!W.empty()?Q>0:Q>=0){var re=ii(Y.from(),W.from()),pe=Ei(Y.to(),W.to()),ye=Y.empty()?W.from()==W.head:Y.from()==Y.head;T<=i&&--i,t.splice(--T,2,new Lt(ye?pe:re,ye?re:pe))}}return new Er(t,i)}function $r(e,t){return new Er([new Lt(e,t||e)],0)}function Jr(e){return e.text?We(e.from.line+e.text.length-1,s(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Jr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Jr(t).ch-t.to.ch),We(i,r)}function Ra(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Lt(Ro(n.anchor,t),Ro(n.head,t)))}return kr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?We(i.line,e.ch-t.ch+i.ch):We(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=We(e.first,0),T=n,W=0;W<t.length;W++){var Y=t[W],Q=Oo(Y.from,n,T),re=Oo(Jr(Y),n,T);if(n=Y.to,T=re,i=="around"){var pe=e.sel.ranges[W],ye=ht(pe.head,pe.anchor)<0;r[W]=new Lt(ye?re:Q,ye?Q:re)}else r[W]=new Lt(Q,Q)}return new Er(r,e.sel.primIndex)}function Oa(e){e.doc.mode=gr(e.options,e.doc.modeOption),fn(e)}function fn(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,hn(e,100),e.state.modeGen++,e.curOp&&sr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&s(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(qe){return i?i[qe]:null}function T(qe,Je,rt){ua(qe,Je,rt,r),Zt(qe,"change",qe,t)}function W(qe,Je){for(var rt=[],dt=qe;dt<Je;++dt)rt.push(new li(re[dt],n(dt),r));return rt}var Y=t.from,Q=t.to,re=t.text,pe=Ze(e,Y.line),ye=Ze(e,Q.line),Re=s(re),we=n(re.length-1),Ne=Q.line-Y.line;if(t.full)e.insert(0,W(0,re.length)),e.remove(re.length,e.size-re.length);else if(Po(e,t)){var Ue=W(0,re.length-1);T(ye,ye.text,we),Ne&&e.remove(Y.line,Ne),Ue.length&&e.insert(Y.line,Ue)}else if(pe==ye)if(re.length==1)T(pe,pe.text.slice(0,Y.ch)+Re+pe.text.slice(Q.ch),we);else{var Ke=W(1,re.length-1);Ke.push(new li(Re+pe.text.slice(Q.ch),we,r)),T(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),e.insert(Y.line+1,Ke)}else if(re.length==1)T(pe,pe.text.slice(0,Y.ch)+re[0]+ye.text.slice(Q.ch),n(0)),e.remove(Y.line+1,Ne);else{T(pe,pe.text.slice(0,Y.ch)+re[0],n(0)),T(ye,Re+ye.text.slice(Q.ch),we);var $e=W(1,re.length-1);Ne>1&&e.remove(Y.line+1,Ne-1),e.insert(Y.line+1,$e)}Zt(e,"change",e,t)}function Zr(e,t,i){function r(n,T,W){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Q=n.linked[Y];if(Q.doc==T)continue;var re=W&&Q.sharedHist;if(i&&!re)continue;t(Q.doc,re),r(Q.doc,n,re)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Oa(e),Io(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,sr(e)}function Io(e){(e.doc.direction=="rtl"?j:f)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){fr(e,function(){Io(e),sr(e)})}function Vn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var i={from:bi(t.from),to:Jr(t),text:Ct(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Zr(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=s(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),s(e.done);if(e.done.length&&!s(e.done).ranges)return s(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),s(e.done)}function Fo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,W,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(n,n.lastOp==r)))Y=s(W.changes),ht(t.from,t.to)==0&&ht(t.from,Y.to)==0?Y.to=Jr(t):W.changes.push(Ma(e,t));else{var Q=s(n.done);for((!Q||!Q.ranges)&&Xn(e.sel,n.done),W={changes:[Ma(e,t)],generation:n.generation},n.done.push(W);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=T,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||le(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,s(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Xn(e,t){var i=s(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(e,t,i,r){var n=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((n||(n=t["spans_"+e.id]={}))[T]=W.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Uo(e,t){var i=yl(e,t),r=Ci(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var T=i[n],W=r[n];if(T&&W){e:for(var Y=0;Y<W.length;++Y){for(var Q=W[Y],re=0;re<T.length;++re)if(T[re].marker==Q.marker)continue e;T.push(Q)}}else W&&(i[n]=W)}return i}function Mi(e,t,i){for(var r=[],n=0;n<e.length;++n){var T=e[n];if(T.ranges){r.push(i?Er.prototype.deepCopy.call(T):T);continue}var W=T.changes,Y=[];r.push({changes:Y});for(var Q=0;Q<W.length;++Q){var re=W[Q],pe=void 0;if(Y.push({from:re.from,to:re.to,text:re.text}),t)for(var ye in re)(pe=ye.match(/^spans_(\d+)$/))&&(de(t,Number(pe[1]))>-1&&(s(Y)[ye]=re[ye],delete re[ye]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var T=ht(t,n)<0;T!=ht(i,n)<0?(n=t,t=i):T!=ht(t,i)<0&&(t=i)}return new Lt(n,t)}else return new Lt(i||t,t)}function Yn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),er(e,new Er([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,n);var W=kr(e.cm,r,e.sel.primIndex);er(e,W,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,er(e,kr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){er(e,$r(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var T=0;T<n.length;T++)this.ranges[T]=new Lt(ft(e,n[T].anchor),ft(e,n[T].head))},origin:i&&i.origin};return le(e,"beforeSelectionChange",e,r),e.cm&&le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?kr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=s(r);n&&n.ranges?(r[r.length-1]=t,$n(e,t,i)):er(e,t,i)}function er(e,t,i){$n(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function $n(e,t,i){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);zo(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Oi(e.cm)}function zo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ee(e.cm)),Zt(e,"cursorActivity",e)}function Go(e){zo(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,T=0;T<t.ranges.length;T++){var W=t.ranges[T],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],Q=Jn(e,W.anchor,Y&&Y.anchor,i,r),re=Jn(e,W.head,Y&&Y.head,i,r);(n||Q!=W.anchor||re!=W.head)&&(n||(n=t.ranges.slice(0,T)),n[T]=new Lt(Q,re))}return n?kr(e.cm,n,t.primIndex):t}function Ii(e,t,i,r,n){var T=Ze(e,t.line);if(T.markedSpans)for(var W=0;W<T.markedSpans.length;++W){var Y=T.markedSpans[W],Q=Y.marker,re="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,pe="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(re?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(pe?Y.to>=t.ch:Y.to>t.ch))){if(n&&(le(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(T.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(i){var ye=Q.find(r<0?1:-1),Re=void 0;if((r<0?pe:re)&&(ye=Vo(e,ye,-r,ye&&ye.line==t.line?T:null)),ye&&ye.line==t.line&&(Re=ht(ye,i))&&(r<0?Re<0:Re>0))return Ii(e,ye,t,r,n)}var we=Q.find(r<0?-1:1);return(r<0?re:pe)&&(we=Vo(e,we,r,we.line==t.line?T:null)),we?Ii(e,we,t,r,n):null}}return t}function Jn(e,t,i,r,n){var T=r||1,W=Ii(e,t,i,T,n)||!n&&Ii(e,t,i,T,!0)||Ii(e,t,i,-T,n)||!n&&Ii(e,t,i,-T,!0);return W||(e.cantEdit=!0,We(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ft(e,We(t.line-1)):null:i>0&&t.ch==(r||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?We(t.line+1,0):null:new We(t.line,t.ch+i)}function Xo(e){e.setSelection(We(e.firstLine(),0),We(e.lastLine()),Ee)}function Yo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,T,W,Y){n&&(r.from=ft(e,n)),T&&(r.to=ft(e,T)),W&&(r.text=W),Y!==void 0&&(r.origin=Y)}),le(e,"beforeChange",e,r),e.cm&&le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ni(e,t,i){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Ni)(e,t,i);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Ji&&!i&&Pn(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)$o(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var i=Ra(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),pn(e,t,i,Ci(e,t));var r=[];Zr(e,function(n,T){!T&&de(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),pn(n,t,null,Ci(n,t))})}function Zn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,W=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,re=0;re<Y.length&&!(T=Y[re],i?T.ranges&&!T.equals(e.sel):!T.ranges);re++);if(re==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(T=Y.pop(),T.ranges){if(Xn(T,Q),i&&!T.equals(e.sel)){er(e,T,{clearRedo:!1});return}W=T}else if(r){Y.push(T);return}else break;var pe=[];Xn(W,Q),Q.push({changes:pe,generation:n.generation}),n.generation=T.generation||++n.maxGeneration;for(var ye=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),Re=function(Ue){var Ke=T.changes[Ue];if(Ke.origin=t,ye&&!Yo(e,Ke,!1))return Y.length=0,{};pe.push(Ma(e,Ke));var $e=Ue?Ra(e,Ke):s(Y);pn(e,Ke,$e,Uo(e,Ke)),!Ue&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Jr(Ke)});var qe=[];Zr(e,function(Je,rt){!rt&&de(qe,Je.history)==-1&&(qo(Je.history,Ke),qe.push(Je.history)),pn(Je,Ke,null,Uo(Je,Ke))})},we=T.changes.length-1;we>=0;--we){var Ne=Re(we);if(Ne)return Ne.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Er(c(e.sel.ranges,function(n){return new Lt(We(n.anchor.line+t,n.anchor.ch),We(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){sr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Xr(e.cm,r,"gutter")}}function pn(e,t,i,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,pn)(e,t,i,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Jo(e,n),t={from:We(e.first,0),to:We(t.to.line+n,t.to.ch),text:[s(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:We(T,Ze(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ct(e,t.from,t.to),i||(i=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),$n(e,i,Ee),e.cantEdit&&Jn(e,We(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,i){var r=e.doc,n=e.display,T=t.from,W=t.to,Y=!1,Q=T.line;e.options.lineWrapping||(Q=pt(yr(Ze(r,T.line))),r.iter(Q,W.line+1,function(we){if(we==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ee(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Q,T.line+t.text.length,function(we){var Ne=en(we);Ne>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=Ne,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),hn(e,400);var re=t.text.length-(W.line-T.line)-1;t.full?sr(e):T.line==W.line&&t.text.length==1&&!Po(e.doc,t)?Xr(e,T.line,"text"):sr(e,T.line,W.line+1,re);var pe=ae(e,"changes"),ye=ae(e,"change");if(ye||pe){var Re={from:T,to:W,text:t.text,removed:t.removed,origin:t.origin};ye&&Zt(e,"change",e,Re),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function Fi(e,t,i,r,n){var T;r||(r=i),ht(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:i,to:r,text:t,origin:n})}function Zo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,i,r){for(var n=0;n<e.length;++n){var T=e[n],W=!0;if(T.ranges){T.copied||(T=e[n]=T.deepCopy(),T.copied=!0);for(var Y=0;Y<T.ranges.length;Y++)Zo(T.ranges[Y].anchor,t,i,r),Zo(T.ranges[Y].head,t,i,r);continue}for(var Q=0;Q<T.changes.length;++Q){var re=T.changes[Q];if(i<re.from.line)re.from=We(re.from.line+r,re.from.ch),re.to=We(re.to.line+r,re.to.ch);else if(t<=re.to.line){W=!1;break}}W||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Qo(e.done,i,r,n),Qo(e.undone,i,r,n)}function mn(e,t,i,r){var n=t,T=t;return typeof t=="number"?T=Ze(e,xi(e,t)):n=pt(t),n==null?null:(r(T,n)&&e.cm&&Xr(e.cm,n,i),T)}function gn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}gn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,ot(n),Zt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function vn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}vn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var T=Math.min(t,n-e),W=r.height;if(r.removeInner(e,T),this.height-=W-r.height,n==T&&(this.children.splice(i--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gn))){var Y=[];this.collapse(Y),this.children=[new gn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],T=n.chunkSize();if(e<=T){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var W=n.lines.length%25+25,Y=W;Y<n.lines.length;){var Q=new gn(n.lines.slice(Y,Y+=25));n.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}n.lines=n.lines.slice(0,W),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new vn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=de(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new vn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],T=n.chunkSize();if(e<T){var W=Math.min(t,T-e);if(n.iterN(e,W,i))return!0;if((t-=W)==0)break;e=0}else e-=T}}};var yn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};yn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=pt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var T=nn(this);mt(i,Math.max(0,i.height-T)),e&&(fr(e,function(){es(e,i,-T),Xr(e,r,"widget")}),Zt(e,"lineWidgetCleared",e,this,r))},yn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=nn(this)-t;if(!n)return;Or(this.doc,r)||mt(r,r.height+n),i&&fr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),Zt(i,"lineWidgetChanged",i,e,pt(r))})},ue(yn);function es(e,t,i){Lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function xl(e,t,i,r){var n=new yn(e,i,r),T=e.cm;return T&&n.noHScroll&&(T.display.alignWidgets=!0),mn(e,t,"widget",function(W){var Y=W.widgets||(W.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=W,T&&!Or(e,W)){var Q=Lr(W)<e.scrollTop;mt(W,W.height+nn(n)),Q&&wa(T,n.height),T.curOp.forceUpdate=!0}return!0}),T&&Zt(T,"lineWidgetAdded",T,n,typeof t=="number"?t:pt(t)),n}var ts=0,Qr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Qr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mi(e),ae(this,"clear")){var i=this.find();i&&Zt(this,"clear",i.from,i.to)}for(var r=null,n=null,T=0;T<this.lines.length;++T){var W=this.lines[T],Y=Ar(W.markedSpans,this);e&&!this.collapsed?Xr(e,pt(W),"text"):e&&(Y.to!=null&&(n=pt(W)),Y.from!=null&&(r=pt(W))),W.markedSpans=Zi(W.markedSpans,Y),Y.from==null&&this.collapsed&&!Or(this.doc,W)&&e&&mt(W,Di(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var re=yr(this.lines[Q]),pe=en(re);pe>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&sr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Zt(e,"markerCleared",e,this,r,n),t&&gi(e),this.parent&&this.parent.clear()},Qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var T=this.lines[n],W=Ar(T.markedSpans,this);if(W.from!=null&&(i=We(t?T:pt(T),W.from),e==-1))return i;if(W.to!=null&&(r=We(t?T:pt(T),W.to),e==1))return r}return i&&{from:i,to:r}},Qr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;fr(r,function(){var n=t.line,T=pt(t.line),W=fa(r,T);if(W&&(no(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Or(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Q=nn(i)-Y;Q&&mt(n,n.height+Q)}Zt(r,"markerChanged",r,e)})},Qr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||de(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Qr.prototype.detachLine=function(e){if(this.lines.splice(de(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Qr);function Bi(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return Gt(e.cm,Bi)(e,t,i,r,n);var T=new Qr(e,n),W=ht(t,i);if(r&&F(r,T,!1),W>0||W==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=E("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Mn(e,t.line,t,i,T)||t.line!=i.line&&Mn(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,re;if(e.iter(Y,i.line+1,function(ye){Q&&T.collapsed&&!Q.options.lineWrapping&&yr(ye)==Q.display.maxLine&&(re=!0),T.collapsed&&Y!=t.line&&mt(ye,0),sa(ye,new ai(T,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),T.collapsed&&e.iter(t.line,i.line+1,function(ye){Or(e,ye)&&mt(ye,0)}),T.clearOnEnter&&Oe(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),T.collapsed)sr(Q,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var pe=t.line;pe<=i.line;pe++)Xr(Q,pe,"text");T.atomic&&Go(Q.doc),Zt(Q,"markerAdded",Q,T)}return T}var bn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};bn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Zt(this,"clear")},bn.prototype.find=function(e,t){return this.primary.find(e,t)},ue(bn);function Sl(e,t,i,r,n){r=F(r),r.shared=!1;var T=[Bi(e,t,i,r,n)],W=T[0],Y=r.widgetNode;return Zr(e,function(Q){Y&&(r.widgetNode=Y.cloneNode(!0)),T.push(Bi(Q,ft(Q,t),ft(Q,i),r,n));for(var re=0;re<Q.linked.length;++re)if(Q.linked[re].isParent)return;W=s(T)}),new bn(T,W)}function rs(e){return e.findMarks(We(e.first,0),e.clipPos(We(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),T=e.clipPos(n.from),W=e.clipPos(n.to);if(ht(T,W)){var Y=Bi(e,T,W,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],T=[n.primary.doc];Zr(n.primary.doc,function(Q){return T.push(Q)});for(var W=0;W<n.markers.length;W++){var Y=n.markers[W];de(T,Y.doc)==-1&&(Y.parent=null,n.markers.splice(W--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,lr=function(e,t,i,r,n){if(!(this instanceof lr))return new lr(e,t,i,r,n);i==null&&(i=0),vn.call(this,[new gn([new li("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var T=We(i,0);this.sel=$r(T),this.history=new Vn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:T,to:T,text:e}),er(this,$r(T),Ee)};lr.prototype=B(vn.prototype,{constructor:lr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Jt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Kt(function(e){var t=We(this.first,0),i=this.first+this.size-1;Ni(this,{from:t,to:We(i,Ze(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&sn(this.cm,0,0),er(this,$r(t),Ee)}),replaceRange:function(e,t,i,r){t=ft(this,t),i=i?ft(this,i):t,Fi(this,e,t,i,r)},getRange:function(e,t,i){var r=Ct(this,ft(this,e),ft(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(vr(this,e))return Ze(this,e)},getLineNumber:function(e){return pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),yr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Kt(function(e,t,i){Wo(this,ft(this,typeof e=="number"?We(e,t||0):e),null,i)}),setSelection:Kt(function(e,t,i){Wo(this,ft(this,e),ft(this,t||e),i)}),extendSelection:Kt(function(e,t,i){Yn(this,ft(this,e),t&&ft(this,t),i)}),extendSelections:Kt(function(e,t){jo(this,Ge(this,e),t)}),extendSelectionsBy:Kt(function(e,t){var i=c(this.sel.ranges,e);jo(this,Ge(this,i),t)}),setSelections:Kt(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Lt(ft(this,e[n].anchor),ft(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),er(this,kr(this.cm,r,t),i)}),addSelection:Kt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Lt(ft(this,e),ft(this,t||e))),er(this,kr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Ct(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Ct(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:Kt(function(e,t,i){for(var r=[],n=this.sel,T=0;T<n.ranges.length;T++){var W=n.ranges[T];r[T]={from:W.from(),to:W.to(),text:this.splitLines(e[T]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)Ni(this,r[Q]);Y?Ho(this,Y):this.cm&&Oi(this.cm)}),undo:Kt(function(){Zn(this,"undo")}),redo:Kt(function(){Zn(this,"redo")}),undoSelection:Kt(function(){Zn(this,"undo",!0)}),redoSelection:Kt(function(){Zn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Vn(this.history.maxGeneration),Zr(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:Mi(this.history.done),undone:Mi(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=Mi(e.done.slice(0),null,!0),t.undone=Mi(e.undone.slice(0),null,!0)},setGutterMarker:Kt(function(e,t,i){return mn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Pe(n)&&(r.gutterMarkers=null),!0})}),clearGutter:Kt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&mn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!vr(this,e))return null;if(t=e,e=Ze(this,e),!e)return null}else if(t=pt(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:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(y(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:Kt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[n];if(T)if(i==null)r[n]=null;else{var W=T.match(y(i));if(!W)return!1;var Y=W.index+W[0].length;r[n]=T.slice(0,W.index)+(!W.index||Y==T.length?"":" ")+T.slice(Y)||null}else return!1;return!0})}),addLineWidget:Kt(function(e,t,i){return xl(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Bi(this,ft(this,e),ft(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ft(this,e),Bi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],i=Ze(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ft(this,e),t=ft(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var W=T.markedSpans;if(W)for(var Y=0;Y<W.length;Y++){var Q=W[Y];!(Q.to!=null&&n==e.line&&e.ch>=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!i||i(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var T=n.text.length+r;if(T>e)return t=e,!0;e-=T,++i}),ft(this,We(i,t))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new lr(Jt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new lr(Jt(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Mt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Zr(e,function(n){return r.push(n.id)},!0),e.history=new Vn(null),e.history.done=Mi(this.history.done,r),e.history.undone=Mi(this.history.undone,r)}},iterLinkedDocs:function(e){Zr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):st(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Kt(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)})}),lr.prototype.eachLine=lr.prototype.iter;var is=0;function _l(e){var t=this;if(ns(t),q(t,e)||Wr(t.display,e))return;te(e),K&&(is=+new Date);var i=hi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,T=Array(n),W=0,Y=function(){++W==n&&Gt(t,function(){i=ft(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(T.filter(function(Ne){return Ne!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ni(t.doc,we),Ho(t.doc,$r(ft(t.doc,i),ft(t.doc,Jr(we))))})()},Q=function(we,Ne){if(t.options.allowDropFileTypes&&de(t.options.allowDropFileTypes,we.type)==-1){Y();return}var Ue=new FileReader;Ue.onerror=function(){return Y()},Ue.onload=function(){var Ke=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){Y();return}T[Ne]=Ke,Y()},Ue.readAsText(we)},re=0;re<r.length;re++)Q(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),$n(t.doc,$r(i,i)),ye)for(var Re=0;Re<ye.length;++Re)Fi(t.doc,"",ye[Re].anchor,ye[Re].head,"drag");t.replaceSelection(pe,"around","paste"),t.display.input.focus()}}catch(we){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-is<100)){fe(t);return}if(q(e,t)||Wr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",_&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),_&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=hi(e,t);if(!i)return;var r=document.createDocumentFragment();go(e,i,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var T=0;T<i.length;T++)e(i[T])})}var os=!1;function Dl(){if(os)return;kl(),os=!0}function kl(){var e;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Oe(window,"blur",function(){return as(Ri)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qr={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"},En=0;En<10;En++)qr[En+48]=qr[En+96]=String(En);for(var Qn=65;Qn<=90;Qn++)qr[Qn]=String.fromCharCode(Qn);for(var xn=1;xn<=12;xn++)qr[xn+111]=qr[xn+63235]="F"+xn;var Hr={};Hr.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"},Hr.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"},Hr.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"},Hr.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"]},Hr.default=l?Hr.macDefault:Hr.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,T,W=0;W<t.length-1;W++){var Y=t[W];if(/^(cmd|meta|m)$/i.test(Y))T=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=c(i.split(" "),Ol),T=0;T<n.length;T++){var W=void 0,Y=void 0;T==n.length-1?(Y=n.join(" "),W=r):(Y=n.slice(0,T+1).join(" "),W="...");var Q=t[Y];if(!Q)t[Y]=W;else if(Q!=W)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var re in t)e[re]=t[re];return e}function Ui(e,t,i,r){t=qn(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ui(e,t.fallthrough,i,r);for(var T=0;T<t.fallthrough.length;T++){var W=Ui(e,t.fallthrough[T],i,r);if(W)return W}}}function ss(e){var t=typeof e=="string"?e:qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(_&&e.keyCode==34&&e.char)return!1;var i=qr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function qn(e){return typeof e=="string"?Hr[e]:e}function ji(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var T=t(i[n]);r.length&&ht(T.from,s(r).to)<=0;){var W=r.pop();if(ht(W.from,T.from)<0){T.from=W.from;break}}r.push(T)}fr(e,function(){for(var Y=r.length-1;Y>=0;Y--)Fi(e.doc,"",r[Y].from,r[Y].to,"+delete");Oi(e)})}function Fa(e,t,i){var r=ke(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ba(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new We(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=He(i,t.doc.direction);if(T){var W=n<0?s(T):T[0],Y=n<0==(W.level==1),Q=Y?"after":"before",re;if(W.level>0||t.doc.direction=="rtl"){var pe=Li(t,i);re=n<0?i.text.length-1:0;var ye=Mr(t,pe,re).top;re=Fe(function(Re){return Mr(t,pe,Re).top==ye},n<0==(W.level==1)?W.from:W.to-1,re),Q=="before"&&(re=Fa(i,re,1))}else re=n<0?W.to:W.from;return new We(r,re,Q)}}return new We(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=He(t,e.doc.direction);if(!n)return Ba(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var T=Ie(n,i.ch,i.sticky),W=n[T];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>i.ch:W.from<i.ch))return Ba(t,i,r);var Y=function($e,qe){return Fa(t,$e instanceof We?$e.ch:$e,qe)},Q,re=function($e){return e.options.lineWrapping?(Q=Q||Li(e,t),co(e,t,Q,$e)):{begin:0,end:t.text.length}},pe=re(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||W.level==1){var ye=W.level==1==r<0,Re=Y(i,ye?1:-1);if(Re!=null&&(ye?Re<=W.to&&Re<=pe.end:Re>=W.from&&Re>=pe.begin)){var we=ye?"before":"after";return new We(i.line,Re,we)}}var Ne=function($e,qe,Je){for(var rt=function(Rt,Vt){return Vt?new We(i.line,Y(Rt,1),"before"):new We(i.line,Rt,"after")};$e>=0&&$e<n.length;$e+=qe){var dt=n[$e],lt=qe>0==(dt.level!=1),gt=lt?Je.begin:Y(Je.end,-1);if(dt.from<=gt&&gt<dt.to)return rt(gt,lt);if(gt=lt?dt.from:Y(dt.to,-1),Je.begin<=gt&&gt<Je.end)return rt(gt,lt)}},Ue=Ne(T+r,r,pe);if(Ue)return Ue;var Ke=r>0?pe.end:Y(pe.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ue=Ne(r>0?0:n.length-1,r,re(Ke)),Ue)?Ue:null}var Sn={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return ji(e,function(t){if(t.empty()){var i=Ze(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:We(t.head.line+1,0)}:{from:t.head,to:We(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ji(e,function(t){return{from:We(t.from().line,0),to:ft(e.doc,We(t.to().line+1,0))}})},delLineLeft:function(e){return ji(e,function(t){return{from:We(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ji(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(We(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(We(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Se)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?hs(e,t.head):r},Se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var T=i[n].from(),W=$(e.getLine(T.line),T.ch,r);t.push(z(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return fr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,T=Ze(e.doc,n.line).text;if(T){if(n.ch==T.length&&(n=new We(n.line,n.ch-1)),n.ch>0)n=new We(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),We(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var W=Ze(e.doc,n.line-1).text;W&&(n=new We(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),We(n.line-1,W.length-1),n,"+transpose"))}}i.push(new Lt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return fr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Oi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=Ze(e.doc,t),r=yr(i);return r!=i&&(t=pt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=Ze(e.doc,t),r=In(i);return r!=i&&(t=pt(r)),Ua(!0,e,i,t,-1)}function hs(e,t){var i=ds(e,t.line),r=Ze(e.doc,i.line),n=He(r,e.doc.direction);if(!n||n[0].level==0){var T=Math.max(i.ch,r.text.search(/\S/)),W=t.line==i.line&&t.ch<=T&&t.ch;return We(i.line,W?0:T,i.sticky)}return i}function ea(e,t,i){if(typeof t=="string"&&(t=Sn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Le}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=Ui(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&Ui(t,e.options.extraKeys,i,e)||Ui(t,e.options.keyMap,i,e)}var Fl=new ie;function Cn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),cs(e,n+" "+t,i,r))return!0}return cs(e,t,i,r)}function cs(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Zt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(te(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Cn(e,"Shift-"+i,t,function(r){return ea(e,r,!0)})||Cn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Cn(e,i,t,function(r){return ea(e,r)}):!1}function Bl(e,t,i){return Cn(e,"'"+i+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),q(t,e))return;K&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);_&&(ja=r?i:null,!r&&i==88&&!wt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;j(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Qe(document,"keyup",i),Qe(document,"mouseover",i))}Oe(document,"keyup",i),Oe(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),q(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Wr(t.display,e)||q(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(_&&i==ja){ja=null,te(e);return}if(_&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Bl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,i){this.time=e,this.pos=t,this.button=i};Wa.prototype.compare=function(e,t,i){return this.time+jl>e&&ht(t,this.pos)==0&&i==this.button};var Tn,wn;function Wl(e,t){var i=+new Date;return wn&&wn.compare(i,e,t)?(Tn=wn=null,"triple"):Tn&&Tn.compare(i,e,t)?(wn=new Wa(i,e,t),Tn=null,"double"):(Tn=new Wa(i,e,t),wn=null,"single")}function vs(e){var t=this,i=t.display;if(q(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Wr(i,e)){N||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=hi(t,e),n=Ce(e),T=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,T,e))return;n==1?r?Gl(t,r,T,e):be(e)==i.scroller&&te(e):n==2?(r&&Yn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Cn(e,ls(T,n),n,function(W){if(typeof W=="string"&&(W=Sn[W]),!W)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=W(e,i)!=Le}finally{e.state.suppressEdits=!1}return Y})}function zl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var T=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){K?setTimeout(M(vo,e),0):e.curOp.focus=I();var n=zl(e,i,r),T=e.doc.sel,W;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(W=T.contains(t))>-1&&(ht((W=T.ranges[W]).from(),t)<0||t.xRel>0)&&(ht(W.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,T=!1,W=Gt(e,function(re){N&&(n.scroller.draggable=!1),e.state.draggingText=!1,Qe(n.wrapper.ownerDocument,"mouseup",W),Qe(n.wrapper.ownerDocument,"mousemove",Y),Qe(n.scroller,"dragstart",Q),Qe(n.scroller,"drop",W),T||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),N&&!P||K&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(re){T=T||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return T=!0};N&&(n.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Oe(n.wrapper.ownerDocument,"mouseup",W),Oe(n.wrapper.ownerDocument,"mousemove",Y),Oe(n.scroller,"dragstart",Q),Oe(n.scroller,"drop",W),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Lt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Lt(We(t.line,0),ft(e.doc,We(t.line+1,0)));var r=i(e,t);return new Lt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;te(t);var W,Y,Q=T.sel,re=Q.ranges;if(r.addNew&&!r.extend?(Y=T.sel.contains(i),Y>-1?W=re[Y]:W=new Lt(i,i)):(W=T.sel.primary(),Y=T.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Lt(i,i)),i=hi(e,t,!0,!0),Y=-1;else{var pe=ys(e,i,r.unit);r.extend?W=Ia(W,pe.anchor,pe.head,r.extend):W=pe}r.addNew?Y==-1?(Y=re.length,er(T,kr(e,re.concat([W]),Y),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Y].empty()&&r.unit=="char"&&!r.extend?(er(T,kr(e,re.slice(0,Y).concat(re.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=T.sel):Na(T,Y,W,_e):(Y=0,er(T,new Er([W],0),_e),Q=T.sel);var ye=i;function Re(Je){if(ht(ye,Je)==0)return;if(ye=Je,r.unit=="rectangle"){for(var rt=[],dt=e.options.tabSize,lt=$(Ze(T,i.line).text,i.ch,dt),gt=$(Ze(T,Je.line).text,Je.ch,dt),Rt=Math.min(lt,gt),Vt=Math.max(lt,gt),Nt=Math.min(i.line,Je.line),pr=Math.min(e.lastLine(),Math.max(i.line,Je.line));Nt<=pr;Nt++){var ur=Ze(T,Nt).text,jt=xe(ur,Rt,dt);Rt==Vt?rt.push(new Lt(We(Nt,jt),We(Nt,jt))):ur.length>jt&&rt.push(new Lt(We(Nt,jt),We(Nt,xe(ur,Vt,dt))))}rt.length||rt.push(new Lt(i,i)),er(T,kr(e,Q.ranges.slice(0,Y).concat(rt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var dr=W,Qt=ys(e,Je,r.unit),zt=dr.anchor,Wt;ht(Qt.anchor,zt)>0?(Wt=Qt.head,zt=ii(dr.from(),Qt.anchor)):(Wt=Qt.anchor,zt=Ei(dr.to(),Qt.head));var Ft=Q.ranges.slice(0);Ft[Y]=Xl(e,new Lt(ft(T,zt),Wt)),er(T,kr(e,Ft,Y),_e)}}var we=n.wrapper.getBoundingClientRect(),Ne=0;function Ue(Je){var rt=++Ne,dt=hi(e,Je,!0,r.unit=="rectangle");if(!dt)return;if(ht(dt,ye)!=0){e.curOp.focus=I(),Re(dt);var lt=Hn(n,T);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(Gt(e,function(){Ne==rt&&Ue(Je)}),150)}else{var gt=Je.clientY<we.top?-20:Je.clientY>we.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Ne!=rt)return;n.scroller.scrollTop+=gt,Ue(Je)}),50)}}function Ke(Je){e.state.selectingText=!1,Ne=Infinity,Je&&(te(Je),n.input.focus()),Qe(n.wrapper.ownerDocument,"mousemove",$e),Qe(n.wrapper.ownerDocument,"mouseup",qe),T.history.lastSelOrigin=null}var $e=Gt(e,function(Je){Je.buttons===0||!Ce(Je)?Ke(Je):Ue(Je)}),qe=Gt(e,Ke);e.state.selectingText=qe,Oe(n.wrapper.ownerDocument,"mousemove",$e),Oe(n.wrapper.ownerDocument,"mouseup",qe)}function Xl(e,t){var i=t.anchor,r=t.head,n=Ze(e.doc,i.line);if(ht(i,r)==0&&i.sticky==r.sticky)return t;var T=He(n);if(!T)return t;var W=Ie(T,i.ch,i.sticky),Y=T[W];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Q=W+(Y.from==i.ch==(Y.level!=1)?0:1);if(Q==0||Q==T.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=Ie(T,r.ch,r.sticky),ye=pe-W||(r.ch-i.ch)*(Y.level==1?-1:1);pe==Q-1||pe==Q?re=ye<0:re=ye>0}var Re=T[Q+(re?-1:0)],we=re==(Re.level==1),Ne=we?Re.from:Re.to,Ue=we?"after":"before";return i.ch==Ne&&i.sticky==Ue?t:new Lt(new We(i.line,Ne,Ue),r)}function bs(e,t,i,r){var n,T;if(t.touches)n=t.touches[0].clientX,T=t.touches[0].clientY;else try{n=t.clientX,T=t.clientY}catch(Re){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var W=e.display,Y=W.lineDiv.getBoundingClientRect();if(T>Y.bottom||!ae(e,i))return he(t);T-=Y.top-W.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=W.gutters.childNodes[Q];if(re&&re.getBoundingClientRect().right>=n){var pe=_t(e.doc,T),ye=e.display.gutterSpecs[Q];return le(e,i,e,pe,ye.className,t),he(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Wr(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Wi={toString:function(){return"CodeMirror.Init"}},Ss={},ta={};function $l(e){var t=e.optionHandlers;function i(r,n,T,W){e.defaults[r]=n,T&&(t[r]=W?function(Y,Q,re){re!=Wi&&T(Y,Q,re)}:T)}e.defineOption=i,e.Init=Wi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){fn(r),an(r),sr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var T=[],W=r.doc.first;r.doc.iter(function(Q){for(var re=0;;){var pe=Q.text.indexOf(n,re);if(pe==-1)break;re=pe+n.length,T.push(We(W,pe))}W++});for(var Y=T.length-1;Y>=0;Y--)Fi(r.doc,n,T[Y],We(T[Y].line,T[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,T){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),T!=Wi&&r.refresh()}),i("specialCharPlaceholder",kt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){xs(r),cn(r)},!0),i("keyMap","default",function(r,n,T){var W=qn(n),Y=T!=Wi&&qn(T);Y&&Y.detach&&Y.detach(r,W),W.attach&&W.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Zl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=ka(n,r.options.lineNumbers),cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pi(r)},!0),i("scrollbarStyle","native",function(r){To(r),Pi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=ka(r.options.gutters,n),cn(r)},!0),i("firstLineNumber",1,cn,!0),i("lineNumberFormatter",function(r){return r},cn,!0),i("showCursorWhenSelecting",!1,on,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Ri(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Jl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,on,!0),i("singleCursorHeightPerLine",!0,on,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,fn,!0),i("addModeClass",!1,fn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,fn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Jl(e,t,i){var r=i&&i!=Wi;if(!t!=!r){var n=e.display.dragFunctions,T=t?Oe:Qe;T(e.display.scroller,"dragstart",n.start),T(e.display.scroller,"dragenter",n.enter),T(e.display.scroller,"dragover",n.over),T(e.display.scroller,"dragleave",n.leave),T(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),xa(e),sr(e),an(e),setTimeout(function(){return Pi(e)},100)}function Mt(e,t){var i=this;if(!(this instanceof Mt))return new Mt(e,t);this.options=t=t?F(t):{},F(Ss,t,!1);var r=t.value;typeof r=="string"?r=new lr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Mt.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,n,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(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 ie,keySeq:null,specialChars:null},t.autofocus&&!a&&T.input.focus(),K&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),Dl(),mi(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):Ri(this);for(var W in ta)ta.hasOwnProperty(W)&&ta[W](this,t[W],Wi);Ao(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);gi(this),N&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Mt.defaults=Ss,Mt.optionHandlers=ta;function Ql(e){var t=e.display;Oe(t.scroller,"mousedown",Gt(e,vs)),K&&H<11?Oe(t.scroller,"dblclick",Gt(e,function(Q){if(q(e,Q))return;var re=hi(e,Q);if(!re||Ha(e,Q)||Wr(e.display,Q))return;te(Q);var pe=e.findWordAt(re);Yn(e.doc,pe.anchor,pe.head)})):Oe(t.scroller,"dblclick",function(Q){return q(e,Q)||te(Q)}),Oe(t.scroller,"contextmenu",function(Q){return Es(e,Q)}),Oe(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Es(e,Q)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(Q){if(Q.touches.length!=1)return!1;var re=Q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function W(Q,re){if(re.left==null)return!0;var pe=re.left-Q.left,ye=re.top-Q.top;return pe*pe+ye*ye>20*20}Oe(t.scroller,"touchstart",function(Q){if(!q(e,Q)&&!T(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!Wr(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ye;!re.prev||W(re,re.prev)?ye=new Lt(pe,pe):!re.prev.prev||W(re,re.prev.prev)?ye=e.findWordAt(pe):ye=new Lt(We(pe.line,0),ft(e.doc,We(pe.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),te(Q)}n()}),Oe(t.scroller,"touchcancel",n),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),le(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(Q){return ko(e,Q)}),Oe(t.scroller,"DOMMouseScroll",function(Q){return ko(e,Q)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){q(e,Q)||fe(Q)},over:function(Q){q(e,Q)||(Ll(e,Q),fe(Q))},start:function(Q){return Al(e,Q)},drop:Gt(e,_l),leave:function(Q){q(e,Q)||ns(e)}};var Y=t.input.getField();Oe(Y,"keyup",function(Q){return ms.call(e,Q)}),Oe(Y,"keydown",Gt(e,ps)),Oe(Y,"keypress",Gt(e,gs)),Oe(Y,"focus",function(Q){return Ca(e,Q)}),Oe(Y,"blur",function(Q){return Ri(e,Q)})}var za=[];Mt.defineInitHook=function(e){return za.push(e)};function _n(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=Tr(e,t).state:i="prev");var W=e.options.tabSize,Y=Ze(n,t),Q=$(Y.text,null,W);Y.stateAfter&&(Y.stateAfter=null);var re=Y.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(Y.text))pe=0,i="not";else if(i=="smart"&&(pe=n.mode.indent(T,Y.text.slice(re.length),Y.text),pe==Le||pe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?pe=$(Ze(n,t-1).text,null,W):pe=0:i=="add"?pe=Q+e.options.indentUnit:i=="subtract"?pe=Q-e.options.indentUnit:typeof i=="number"&&(pe=Q+i),pe=Math.max(0,pe);var ye="",Re=0;if(e.options.indentWithTabs)for(var we=Math.floor(pe/W);we;--we)Re+=W,ye+=" ";if(Re<pe&&(ye+=z(pe-Re)),ye!=re)return Fi(n,ye,We(t,0),We(t,re.length),"+input"),Y.stateAfter=null,!0;for(var Ne=0;Ne<n.sel.ranges.length;Ne++){var Ue=n.sel.ranges[Ne];if(Ue.head.line==t&&Ue.head.ch<re.length){var Ke=We(t,re.length);Na(n,Ne,new Lt(Ke,Ke));break}}}var Rr=null;function ra(e){Rr=e}function Ga(e,t,i,r,n){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var W=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>W,Q=st(t),re=null;if(Y&&r.ranges.length>1)if(Rr&&Rr.text.join(`
`)==t){if(r.ranges.length%Rr.text.length==0){re=[];for(var pe=0;pe<Rr.text.length;pe++)re.push(T.splitLines(Rr.text[pe]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=c(Q,function($e){return[$e]}));for(var ye=e.curOp.updateInput,Re=r.ranges.length-1;Re>=0;Re--){var we=r.ranges[Re],Ne=we.from(),Ue=we.to();we.empty()&&(i&&i>0?Ne=We(Ne.line,Ne.ch-i):e.state.overwrite&&!Y?Ue=We(Ue.line,Math.min(Ze(T,Ue.line).text.length,Ue.ch+s(Q).length)):Y&&Rr&&Rr.lineWise&&Rr.text.join(`
`)==Q.join(`
`)&&(Ne=Ue=We(Ne.line,0)));var Ke={from:Ne,to:Ue,text:re?re[Re%re.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>W?"cut":"+input")};Ni(e.doc,Ke),Zt(e,"inputRead",e,Ke)}t&&!Y&&Ts(e,t),Oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&fr(t,function(){return Ga(t,i,0,null,"paste")}),!0}function Ts(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var T=e.getModeAt(n.head),W=!1;if(T.electricChars){for(var Y=0;Y<T.electricChars.length;Y++)if(t.indexOf(T.electricChars.charAt(Y))>-1){W=_n(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(Ze(e.doc,n.head.line).text.slice(0,n.head.ch))&&(W=_n(e,n.head.line,"smart")));W&&Zt(e,"electricInput",e,n.head.line)}}function ws(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,T={anchor:We(n,0),head:We(n+1,0)};i.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:i}}function _s(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){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 N?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),_s(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var T=this.options,W=T[r];if(T[r]==n&&r!="mode")return;T[r]=n,t.hasOwnProperty(r)&&Gt(this,t[r])(this,n,W),le(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](qn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,T=0;T<n.length;++T)if(n[T]==r||n[T].name==r)return n.splice(T,1),!0},addOverlay:ir(function(r,n){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");k(this.state.overlays,{mode:T,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(W){return W.priority}),this.state.modeGen++,sr(this)}),removeOverlay:ir(function(r){for(var n=this.state.overlays,T=0;T<n.length;++T){var W=n[T].modeSpec;if(W==r||typeof r=="string"&&W.name==r){n.splice(T,1),this.state.modeGen++,sr(this);return}}}),indentLine:ir(function(r,n,T){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),vr(this.doc,r)&&_n(this,r,n,T)}),indentSelection:ir(function(r){for(var n=this.doc.sel.ranges,T=-1,W=0;W<n.length;W++){var Y=n[W];if(Y.empty())Y.head.line>T&&(_n(this,Y.head.line,r,!0),T=Y.head.line,W==this.doc.sel.primIndex&&Oi(this));else{var Q=Y.from(),re=Y.to(),pe=Math.max(T,Q.line);T=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ye=pe;ye<T;++ye)_n(this,ye,r);var Re=this.doc.sel.ranges;Q.ch==0&&n.length==Re.length&&Re[W].from().ch>0&&Na(this.doc,W,new Lt(Q,Re[W].to()),Ee)}}}),getTokenAt:function(r,n){return Ln(this,r,n)},getLineTokens:function(r,n){return Ln(this,We(r),n,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var n=ni(this,Ze(this.doc,r.line)),T=0,W=(n.length-1)/2,Y=r.ch,Q;if(Y==0)Q=n[2];else for(;;){var re=T+W>>1;if((re?n[re*2-1]:0)>=Y)W=re;else if(n[re*2+1]<Y)T=re+1;else{Q=n[re*2+2];break}}var pe=Q?Q.indexOf("overlay "):-1;return pe<0?Q:pe==0?null:Q.slice(0,pe-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var T=[];if(!i.hasOwnProperty(n))return T;var W=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")W[Y[n]]&&T.push(W[Y[n]]);else if(Y[n])for(var Q=0;Q<Y[n].length;Q++){var re=W[Y[n][Q]];re&&T.push(re)}else Y.helperType&&W[Y.helperType]?T.push(W[Y.helperType]):W[Y.name]&&T.push(W[Y.name]);for(var pe=0;pe<W._global.length;pe++){var ye=W._global[pe];ye.pred(Y,this)&&de(T,ye.val)==-1&&T.push(ye.val)}return T},getStateAfter:function(r,n){var T=this.doc;return r=xi(T,r==null?T.first+T.size-1:r),Tr(this,r+1,n).state},cursorCoords:function(r,n){var T,W=this.doc.sel.primary();return r==null?T=W.head:typeof r=="object"?T=ft(this.doc,r):T=r?W.from():W.to(),Dr(this,T,n||"page")},charCoords:function(r,n){return ma(this,ft(this.doc,r),n||"page")},coordsChar:function(r,n){return r=lo(this,r,n||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,n){return r=lo(this,{top:r,left:0},n||"page").top,_t(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,T){var W=!1,Y;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,W=!0),Y=Ze(this.doc,r)}else Y=r;return Bn(this,Y,{top:0,left:0},n||"page",T||W).top+(W?this.doc.height-Lr(Y):0)},defaultTextHeight:function(){return Di(this.display)},defaultCharWidth:function(){return ki(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,T,W,Y){var Q=this.display;r=Dr(this,ft(this.doc,r));var re=r.bottom,pe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),W=="over")re=r.top;else if(W=="above"||W=="near"){var ye=Math.max(Q.wrapper.clientHeight,this.doc.height),Re=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(W=="above"||r.bottom+n.offsetHeight>ye)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ye&&(re=r.bottom),pe+n.offsetWidth>Re&&(pe=Re-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",Y=="right"?(pe=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?pe=0:Y=="middle"&&(pe=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=pe+"px"),T&&Js(this,{left:pe,top:re,right:pe+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:ir(ps),triggerOnKeyPress:ir(gs),triggerOnKeyUp:ms,triggerOnMouseDown:ir(vs),execCommand:function(r){if(Sn.hasOwnProperty(r))return Sn[r].call(null,this)},triggerElectric:ir(function(r){Ts(this,r)}),findPosH:function(r,n,T,W){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=ft(this.doc,r),re=0;re<n&&!(Q=Ka(this.doc,Q,Y,T,W),Q.hitSide);++re);return Q},moveH:ir(function(r,n){var T=this;this.extendSelectionsBy(function(W){return T.display.shift||T.doc.extend||W.empty()?Ka(T.doc,W.head,r,n,T.options.rtlMoveVisually):r<0?W.from():W.to()},Se)}),deleteH:ir(function(r,n){var T=this.doc.sel,W=this.doc;T.somethingSelected()?W.replaceSelection("",null,"+delete"):ji(this,function(Y){var Q=Ka(W,Y.head,r,n,!1);return r<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(r,n,T,W){var Y=1,Q=W;n<0&&(Y=-1,n=-n);for(var re=ft(this.doc,r),pe=0;pe<n;++pe){var ye=Dr(this,re,"div");if(Q==null?Q=ye.left:ye.left=Q,re=Ls(this,ye,Y,T),re.hitSide)break}return re},moveV:ir(function(r,n){var T=this,W=this.doc,Y=[],Q=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(pe){if(Q)return r<0?pe.from():pe.to();var ye=Dr(T,pe.head,"div");pe.goalColumn!=null&&(ye.left=pe.goalColumn),Y.push(ye.left);var Re=Ls(T,ye,r,n);return n=="page"&&pe==W.sel.primary()&&wa(T,ma(T,Re,"div").top-ye.top),Re},Se),Y.length)for(var re=0;re<W.sel.ranges.length;re++)W.sel.ranges[re].goalColumn=Y[re]}),findWordAt:function(r){var n=this.doc,T=Ze(n,r.line).text,W=r.ch,Y=r.ch;if(T){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==T.length)&&W?--W:++Y;for(var re=T.charAt(W),pe=Te(re,Q)?function(ye){return Te(ye,Q)}:/\s/.test(re)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!Te(ye)};W>0&&pe(T.charAt(W-1));)--W;for(;Y<T.length&&pe(T.charAt(Y));)++Y}return new Lt(We(r.line,W),We(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ir(function(r,n){sn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Pr(this)-this.display.barHeight,width:r.scrollWidth-Pr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:ui(this)}},scrollIntoView:ir(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:We(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Zs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:ir(function(r,n){var T=this,W=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=W(r)),n!=null&&(this.display.wrapper.style.height=W(n)),this.options.lineWrapping&&ao(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var re=0;re<Q.widgets.length;re++)if(Q.widgets[re].noHScroll){Xr(T,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,le(this,"refresh",this)}),operation:function(r){return fr(this,r)},startOperation:function(){return mi(this)},endOperation:function(){return gi(this)},refresh:ir(function(){var r=this.display.cachedTextHeight;sr(this),this.curOp.forceUpdate=!0,an(this),sn(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Di(this.display))>.5||this.options.lineWrapping)&&xa(this),le(this,"refresh",this)}),swapDoc:ir(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),an(this),this.display.input.reset(),sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Zt(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,n,T){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=T},e.registerGlobalHelper=function(r,n,T,W){e.registerHelper(r,n,W),i[r]._global.push({pred:T,val:W})}}function Ka(e,t,i,r,n){var T=t,W=i,Y=Ze(e,t.line),Q=n&&e.direction=="rtl"?-i:i;function re(){var qe=t.line+Q;return qe<e.first||qe>=e.first+e.size?!1:(t=new We(qe,t.ch,t.sticky),Y=Ze(e,qe))}function pe(qe){var Je;if(r=="codepoint"){var rt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(rt)?Je=null:Je=new We(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(rt>=55296&&rt<56320?2:1))),-i)}else n?Je=Ml(e.cm,Y,t,i):Je=Ba(Y,t,i);if(Je==null)if(!qe&&re())t=Ua(n,e.cm,Y,t.line,Q);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ye=null,Re=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(i<0&&!pe(!Ne));Ne=!1){var Ue=Y.text.charAt(t.ch)||`
`,Ke=Te(Ue,we)?"w":Re&&Ue==`
`?"n":!Re||/\s/.test(Ue)?null:"p";if(Re&&!Ne&&!Ke&&(Ke="s"),ye&&ye!=Ke){i<0&&(i=1,pe(),t.sticky="after");break}if(Ke&&(ye=Ke),i>0&&!pe(!Ne))break}var $e=Jn(e,t,T,W,!0);return ri(T,$e)&&($e.hitSide=!0),$e}function Ls(e,t,i,r){var n=e.doc,T=t.left,W;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*Di(e.display),3);W=(i>0?t.bottom:t.top)+i*Q}else r=="line"&&(W=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,T,W),!re.outside);){if(i<0?W<=0:W>=n.height){re.hitSide=!0;break}W+=i*5}return re}var Dt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ie,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Dt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;_s(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Oe(n,"paste",function(Y){if(!T(Y)||q(r,Y)||Cs(Y,r))return;H<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),Oe(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Oe(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Oe(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(n,"touchstart",function(){return i.forceCompositionEnd()}),Oe(n,"input",function(){t.composing||t.readFromDOMSoon()});function W(Y){if(!T(Y)||q(r,Y))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);ra({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var re=Rr.text.join(`
`);if(Y.clipboardData.setData("Text",re),Y.clipboardData.getData("Text")==re){Y.preventDefault();return}}var pe=As(),ye=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ye.value=Rr.text.join(`
`);var Re=document.activeElement;V(ye),setTimeout(function(){r.display.lineSpace.removeChild(pe),Re.focus(),Re==n&&i.showPrimarySelection()},50)}Oe(n,"copy",W),Oe(n,"cut",W)},Dt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Dt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Dt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Dt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Dt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var T=ia(t,e.anchorNode,e.anchorOffset),W=ia(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&W&&!W.bad&&ht(ii(T,W),r)==0&&ht(Ei(T,W),n)==0)return;var Y=t.display.view,Q=r.line>=t.display.viewFrom&&Ds(t,r)||{node:Y[0].measure.map[2],offset:0},re=n.line<t.display.viewTo&&Ds(t,n);if(!re){var pe=Y[Y.length-1].measure,ye=pe.maps?pe.maps[pe.maps.length-1]:pe.map;re={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!Q||!re){e.removeAllRanges();return}var Re=e.rangeCount&&e.getRangeAt(0),we;try{we=g(Q.node,Q.offset,re.offset,re.node)}catch(Ne){}we&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),Re&&e.anchorNode==null?e.addRange(Re):O&&this.startGracePeriod()),this.rememberSelection()},Dt.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)},Dt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Dt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Dt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},Dt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Dt.prototype.blur=function(){this.div.blur()},Dt.prototype.getField=function(){return this.div},Dt.prototype.supportsTouch=function(){return!0},Dt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():fr(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)},Dt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Dt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&b&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=ia(t,e.anchorNode,e.anchorOffset),r=ia(t,e.focusNode,e.focusOffset);i&&r&&fr(t,function(){er(t.doc,$r(i,r),Ee),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Dt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=We(r.line-1,Ze(e.doc,r.line-1).length)),n.ch==Ze(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=We(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var T,W,Y;r.line==t.viewFrom||(T=ci(e,r.line))==0?(W=pt(t.view[0].line),Y=t.view[0].node):(W=pt(t.view[T].line),Y=t.view[T-1].node.nextSibling);var Q=ci(e,n.line),re,pe;if(Q==t.view.length-1?(re=t.viewTo-1,pe=t.lineDiv.lastChild):(re=pt(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!Y)return!1;for(var ye=e.doc.splitLines(tu(e,Y,pe,W,re)),Re=Ct(e.doc,We(W,0),We(re,Ze(e.doc,re).text.length));ye.length>1&&Re.length>1;)if(s(ye)==s(Re))ye.pop(),Re.pop(),re--;else if(ye[0]==Re[0])ye.shift(),Re.shift(),W++;else break;for(var we=0,Ne=0,Ue=ye[0],Ke=Re[0],$e=Math.min(Ue.length,Ke.length);we<$e&&Ue.charCodeAt(we)==Ke.charCodeAt(we);)++we;for(var qe=s(ye),Je=s(Re),rt=Math.min(qe.length-(ye.length==1?we:0),Je.length-(Re.length==1?we:0));Ne<rt&&qe.charCodeAt(qe.length-Ne-1)==Je.charCodeAt(Je.length-Ne-1);)++Ne;if(ye.length==1&&Re.length==1&&W==r.line)for(;we&&we>r.ch&&qe.charCodeAt(qe.length-Ne-1)==Je.charCodeAt(Je.length-Ne-1);)we--,Ne++;ye[ye.length-1]=qe.slice(0,qe.length-Ne).replace(/^\u200b+/,""),ye[0]=ye[0].slice(we).replace(/\u200b+$/,"");var dt=We(W,we),lt=We(re,Re.length?s(Re).length-Ne:0);if(ye.length>1||ye[0]||ht(dt,lt))return Fi(e.doc,ye,dt,lt,"+input"),!0},Dt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Dt.prototype.reset=function(){this.forceCompositionEnd()},Dt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Dt.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)},Dt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&fr(this.cm,function(){return sr(e.cm)})},Dt.prototype.setUneditable=function(e){e.contentEditable="false"},Dt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Dt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Dt.prototype.onContextMenu=function(){},Dt.prototype.resetPosition=function(){},Dt.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=Ze(e.doc,t.line),n=eo(i,r,t.line),T=He(r,e.doc.direction),W="left";if(T){var Y=Ie(T,t.ch);W=Y%2?"right":"left"}var Q=io(n.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var T="",W=!1,Y=e.doc.lineSeparator(),Q=!1;function re(we){return function(Ne){return Ne.id==we}}function pe(){W&&(T+=Y,Q&&(T+=Y),W=Q=!1)}function ye(we){we&&(pe(),T+=we)}function Re(we){if(we.nodeType==1){var Ne=we.getAttribute("cm-text");if(Ne){ye(Ne);return}var Ue=we.getAttribute("cm-marker"),Ke;if(Ue){var $e=e.findMarks(We(r,0),We(n+1,0),re(+Ue));$e.length&&(Ke=$e[0].find(0))&&ye(Ct(e.doc,Ke.from,Ke.to).join(Y));return}if(we.getAttribute("contenteditable")=="false")return;var qe=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;qe&&pe();for(var Je=0;Je<we.childNodes.length;Je++)Re(we.childNodes[Je]);/^(pre|p)$/i.test(we.nodeName)&&(Q=!0),qe&&(W=!0)}else we.nodeType==3&&ye(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==i);)t=t.nextSibling,Q=!1;return T}function ia(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Hi(e.clipPos(We(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var T=e.display.view[n];if(T.node==r)return ru(T,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!x(r,t))return Hi(We(pt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var T=e.rest?s(e.rest):e.line;return Hi(We(pt(T),T.text.length),n)}var W=t.nodeType==3?t:null,Y=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,i&&(i=W.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Q=e.measure,re=Q.maps;function pe(Ke,$e,qe){for(var Je=-1;Je<(re?re.length:0);Je++)for(var rt=Je<0?Q.map:re[Je],dt=0;dt<rt.length;dt+=3){var lt=rt[dt+2];if(lt==Ke||lt==$e){var gt=pt(Je<0?e.line:e.rest[Je]),Rt=rt[dt]+qe;return(qe<0||lt!=Ke)&&(Rt=rt[dt+(qe?1:0)]),We(gt,Rt)}}}var ye=pe(W,Y,i);if(ye)return Hi(ye,n);for(var Re=Y.nextSibling,we=W?W.nodeValue.length-i:0;Re;Re=Re.nextSibling){if(ye=pe(Re,Re.firstChild,0),ye)return Hi(We(ye.line,ye.ch-we),n);we+=Re.textContent.length}for(var Ne=Y.previousSibling,Ue=i;Ne;Ne=Ne.previousSibling){if(ye=pe(Ne,Ne.firstChild,-1),ye)return Hi(We(ye.line,ye.ch+Ue),n);Ue+=Ne.textContent.length}}var Bt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ie,this.hasSelection=!1,this.composing=null};Bt.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),C&&(n.style.width="0px"),Oe(n,"input",function(){K&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Oe(n,"paste",function(W){if(q(r,W)||Cs(W,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(W){if(q(r,W))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ws(r);ra({lineWise:!0,text:Y.text}),W.type=="cut"?r.setSelections(Y.ranges,null,Ee):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Oe(n,"cut",T),Oe(n,"copy",T),Oe(e.scroller,"paste",function(W){if(Wr(e,W)||q(r,W))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=W.clipboardData,n.dispatchEvent(Y)}),Oe(e.lineSpace,"selectstart",function(W){Wr(e,W)||te(W)}),Oe(n,"compositionstart",function(){var W=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:W,range:r.markText(W,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Bt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Bt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Bt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Dr(e,i.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+W.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+W.left-T.left))}return r},Bt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Bt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),K&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",K&&H>=9&&(this.hasSelection=null))},Bt.prototype.getField=function(){return this.textarea},Bt.prototype.supportsTouch=function(){return!1},Bt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},Bt.prototype.blur=function(){this.textarea.blur()},Bt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Bt.prototype.receivedFocus=function(){this.slowPoll()},Bt.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()})},Bt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Bt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||at(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(K&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=n.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,Y=Math.min(r.length,n.length);W<Y&&r.charCodeAt(W)==n.charCodeAt(W);)++W;return fr(t,function(){Ga(t,n.slice(W),r.length-W,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Bt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Bt.prototype.onKeyPress=function(){K&&H>=9&&(this.hasSelection=null),this.fastPoll()},Bt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=hi(i,e),W=r.scroller.scrollTop;if(!T||_)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(T)==-1&&Gt(i,er)(i.doc,$r(T),Ee);var Q=n.style.cssText,re=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.left-5)+`px;
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ye;N&&(ye=window.scrollY),r.input.focus(),N&&window.scrollTo(null,ye),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Re(){if(n.selectionStart!=null){var Ue=i.somethingSelected(),Ke="\u200B"+(Ue?n.value:"");n.value="\u21DA",n.value=Ke,t.prevInput=Ue?"":"\u200B",n.selectionStart=1,n.selectionEnd=Ke.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=Q,K&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),n.selectionStart!=null){(!K||K&&H<9)&&Re();var Ue=0,Ke=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?Gt(i,Xo)(i):Ue++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(K&&H>=9&&Re(),L){fe(e);var Ne=function(){Qe(window,"mouseup",Ne),setTimeout(we,20)};Oe(window,"mouseup",Ne)}else setTimeout(we,50)},Bt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Bt.prototype.setUneditable=function(){},Bt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?F(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=I();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;n=T.submit;try{var W=T.submit=function(){r(),T.submit=n,T.submit(),T.submit=W}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Mt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=Qe,e.on=Oe,e.wheelEventPixels=hl,e.Doc=lr,e.splitLines=st,e.countColumn=$,e.findColumn=xe,e.isWordChar=ve,e.Pass=Le,e.signal=le,e.Line=li,e.changeEnd=Jr,e.scrollbarModel=Co,e.Pos=We,e.cmpPos=ht,e.modes=Ot,e.mimeModes=xt,e.resolveMode=Yt,e.getMode=gr,e.modeExtensions=cr,e.extendMode=Gr,e.copyState=$t,e.startState=ti,e.innerMode=Nr,e.commands=Sn,e.keyMap=Hr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Ui,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=bn,e.TextMarker=Qr,e.LineWidget=yn,e.e_preventDefault=te,e.e_stopPropagation=ne,e.e_stop=fe,e.addClass=j,e.contains=x,e.rmClass=f,e.keyNames=qr}$l(Mt),ql(Mt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in lr.prototype)lr.prototype.hasOwnProperty(na)&&de(au,na)<0&&(Mt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(lr.prototype[na]));return ue(lr),Mt.inputStyles={textarea:Bt,contenteditable:Dt},Mt.defineMode=function(e){!Mt.defaults.mode&&e!="null"&&(Mt.defaults.mode=e),mr.apply(this,arguments)},Mt.defineMIME=Cr,Mt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Mt.defineMIME("text/plain","null"),Mt.defineExtension=function(e,t){Mt.prototype[e]=t},Mt.defineDocExtension=function(e,t){lr.prototype[e]=t},Mt.fromTextArea=iu,nu(Mt),Mt.version="5.58.2",Mt})},Y1PL:function(nt,ze,oe){"use strict";oe.r(ze),oe.d(ze,"ResizableTextArea",function(){return de});var ce=oe("wx14"),J=oe("1OyB"),O=oe("vuIU"),Z=oe("Ji7U"),U=oe("LK+K"),D=oe("q1tI"),K=oe("VTBJ"),H=oe("rePB"),N=oe("Zm9Q"),R=oe("Kwbf"),b=oe("c+Xe"),_=oe("m+aA"),P=oe("bdgK"),A=new Map;function S(Ee){Ee.forEach(function(_e){var Se,xe=_e.target;(Se=A.get(xe))===null||Se===void 0||Se.forEach(function(me){return me(xe)})})}var C=new P.default(S),h=null,a=null;function l(Ee,_e){A.has(Ee)||(A.set(Ee,new Set),C.observe(Ee)),A.get(Ee).add(_e)}function d(Ee,_e){A.has(Ee)&&(A.get(Ee).delete(_e),A.get(Ee).size||(C.unobserve(Ee),A.delete(Ee)))}var w=function(Ee){Object(Z.a)(Se,Ee);var _e=Object(U.a)(Se);function Se(){return Object(J.a)(this,Se),_e.apply(this,arguments)}return Object(O.a)(Se,[{key:"render",value:function(){return this.props.children}}]),Se}(D.Component),v=D.createContext(null);function m(Ee){var _e=Ee.children,Se=Ee.onBatchResize,xe=D.useRef(0),me=D.useRef([]),z=D.useContext(v),s=D.useCallback(function(c,k,X){xe.current+=1;var B=xe.current;me.current.push({size:c,element:k,data:X}),Promise.resolve().then(function(){B===xe.current&&(Se==null||Se(me.current),me.current=[])}),z==null||z(c,k,X)},[Se,z]);return D.createElement(v.Provider,{value:s},_e)}function L(Ee){var _e=Ee.children,Se=Ee.disabled,xe=D.useRef(null),me=D.useRef(null),z=D.useContext(v),s=D.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),c=D.isValidElement(_e)&&Object(b.c)(_e),k=c?_e.ref:null,X=D.useMemo(function(){return Object(b.a)(k,xe)},[k,xe]),B=D.useRef(Ee);B.current=Ee;var se=D.useCallback(function(ve){var Te=B.current,Pe=Te.onResize,Ae=Te.data,De=ve.getBoundingClientRect(),ke=De.width,Fe=De.height,je=ve.offsetWidth,Be=ve.offsetHeight,Ie=Math.floor(ke),Ye=Math.floor(Fe);if(s.current.width!==Ie||s.current.height!==Ye||s.current.offsetWidth!==je||s.current.offsetHeight!==Be){var He={width:Ie,height:Ye,offsetWidth:je,offsetHeight:Be};s.current=He;var Xe=je===Math.round(ke)?ke:je,Oe=Be===Math.round(Fe)?Fe:Be,tt=Object(K.a)(Object(K.a)({},He),{},{offsetWidth:Xe,offsetHeight:Oe});z==null||z(tt,ve,Ae),Pe&&Promise.resolve().then(function(){Pe(tt,ve)})}},[]);return D.useEffect(function(){var ve=Object(_.a)(xe.current)||Object(_.a)(me.current);return ve&&!Se&&l(ve,se),function(){return d(ve,se)}},[xe.current,Se]),D.createElement(w,{ref:me},c?D.cloneElement(_e,{ref:X}):_e)}var y="rc-observer-key";function f(Ee){var _e=Ee.children,Se=Object(N.a)(_e);return Se.map(function(xe,me){var z=(xe==null?void 0:xe.key)||"".concat(y,"-").concat(me);return D.createElement(L,Object(ce.a)({},Ee,{key:z}),xe)})}f.Collection=m;var p=f,u=oe("bT9E"),o=oe("TSYQ"),E=oe.n(o),g=`
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
`,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],I={},j;function G(Ee){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(_e&&I[Se])return I[Se];var xe=window.getComputedStyle(Ee),me=xe.getPropertyValue("box-sizing")||xe.getPropertyValue("-moz-box-sizing")||xe.getPropertyValue("-webkit-box-sizing"),z=parseFloat(xe.getPropertyValue("padding-bottom"))+parseFloat(xe.getPropertyValue("padding-top")),s=parseFloat(xe.getPropertyValue("border-bottom-width"))+parseFloat(xe.getPropertyValue("border-top-width")),c=x.map(function(X){return"".concat(X,":").concat(xe.getPropertyValue(X))}).join(";"),k={sizingStyle:c,paddingSize:z,borderSize:s,boxSizing:me};return _e&&Se&&(I[Se]=k),k}function V(Ee){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),Ee.getAttribute("wrap")?j.setAttribute("wrap",Ee.getAttribute("wrap")):j.removeAttribute("wrap");var me=G(Ee,_e),z=me.paddingSize,s=me.borderSize,c=me.boxSizing,k=me.sizingStyle;j.setAttribute("style","".concat(k,";").concat(g)),j.value=Ee.value||Ee.placeholder||"";var X=Number.MIN_SAFE_INTEGER,B=Number.MAX_SAFE_INTEGER,se=j.scrollHeight,ve;if(c==="border-box"?se+=s:c==="content-box"&&(se-=z),Se!==null||xe!==null){j.value=" ";var Te=j.scrollHeight-z;Se!==null&&(X=Te*Se,c==="border-box"&&(X=X+z+s),se=Math.max(X,se)),xe!==null&&(B=Te*xe,c==="border-box"&&(B=B+z+s),ve=se>B?"":"hidden",se=Math.min(B,se))}return{height:se,minHeight:X,maxHeight:B,overflowY:ve,resize:"none"}}var M=oe("Gytx"),F=oe.n(M),$;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})($||($={}));var ie=function(Ee){Object(Z.a)(Se,Ee);var _e=Object(U.a)(Se);function Se(xe){var me;return Object(J.a)(this,Se),me=_e.call(this,xe),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(z){me.textArea=z},me.handleResize=function(z){var s=me.state.resizeStatus,c=me.props,k=c.autoSize,X=c.onResize;if(s!==$.NONE)return;typeof X=="function"&&X(z),k&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var z=me.props.autoSize;if(!z||!me.textArea)return;var s=z.minRows,c=z.maxRows,k=V(me.textArea,!1,s,c);me.setState({textareaStyles:k,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var z=me.props,s=z.prefixCls,c=s===void 0?"rc-textarea":s,k=z.autoSize,X=z.onResize,B=z.className,se=z.disabled,ve=me.state,Te=ve.textareaStyles,Pe=ve.resizeStatus,Ae=Object(u.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=E()(c,B,Object(H.a)({},"".concat(c,"-disabled"),se));"value"in Ae&&(Ae.value=Ae.value||"");var ke=Object(K.a)(Object(K.a)(Object(K.a)({},me.props.style),Te),Pe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return D.createElement(p,{onResize:me.handleResize,disabled:!(k||X)},D.createElement("textarea",Object(ce.a)({},Ae,{className:De,style:ke,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(O.a)(Se,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!F()(me.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var me=this.textArea.selectionStart,z=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,z)}}catch(s){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Se}(D.Component),de=ie,ge=function(Ee){Object(Z.a)(Se,Ee);var _e=Object(U.a)(Se);function Se(xe){var me;Object(J.a)(this,Se),me=_e.call(this,xe),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(s){me.resizableTextArea=s},me.handleChange=function(s){var c=me.props.onChange;me.setValue(s.target.value,function(){me.resizableTextArea.resizeTextarea()}),c&&c(s)},me.handleKeyDown=function(s){var c=me.props,k=c.onPressEnter,X=c.onKeyDown;s.keyCode===13&&k&&k(s),X&&X(s)};var z=typeof xe.value=="undefined"||xe.value===null?xe.defaultValue:xe.value;return me.state={value:z},me}return Object(O.a)(Se,[{key:"setValue",value:function(me,z){"value"in this.props||this.setState({value:me},z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return D.createElement(de,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Se}(D.Component),Le=ze.default=ge},Zss7:function(nt,ze,oe){var ce;(function(J){var O=/^\s+/,Z=/\s+$/,U=0,D=J.round,K=J.min,H=J.max,N=J.random;function R(s,c){if(s=s||"",c=c||{},s instanceof R)return s;if(!(this instanceof R))return new R(s,c);var k=b(s);this._originalInput=s,this._r=k.r,this._g=k.g,this._b=k.b,this._a=k.a,this._roundA=D(100*this._a)/100,this._format=c.format||k.format,this._gradientType=c.gradientType,this._r<1&&(this._r=D(this._r)),this._g<1&&(this._g=D(this._g)),this._b<1&&(this._b=D(this._b)),this._ok=k.ok,this._tc_id=U++}R.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 s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),c,k,X,B,se,ve;return c=s.r/255,k=s.g/255,X=s.b/255,c<=.03928?B=c/12.92:B=J.pow((c+.055)/1.055,2.4),k<=.03928?se=k/12.92:se=J.pow((k+.055)/1.055,2.4),X<=.03928?ve=X/12.92:ve=J.pow((X+.055)/1.055,2.4),.2126*B+.7152*se+.0722*ve},setAlpha:function(s){return this._a=V(s),this._roundA=D(100*this._a)/100,this},toHsv:function(){var s=S(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=S(this._r,this._g,this._b),c=D(s.h*360),k=D(s.s*100),X=D(s.v*100);return this._a==1?"hsv("+c+", "+k+"%, "+X+"%)":"hsva("+c+", "+k+"%, "+X+"%, "+this._roundA+")"},toHsl:function(){var s=P(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=P(this._r,this._g,this._b),c=D(s.h*360),k=D(s.s*100),X=D(s.l*100);return this._a==1?"hsl("+c+", "+k+"%, "+X+"%)":"hsla("+c+", "+k+"%, "+X+"%, "+this._roundA+")"},toHex:function(s){return h(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return a(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:D(this._r),g:D(this._g),b:D(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+D(this._r)+", "+D(this._g)+", "+D(this._b)+")":"rgba("+D(this._r)+", "+D(this._g)+", "+D(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:D(M(this._r,255)*100)+"%",g:D(M(this._g,255)*100)+"%",b:D(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%)":"rgba("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:j[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var c="#"+l(this._r,this._g,this._b,this._a),k=c,X=this._gradientType?"GradientType = 1, ":"";if(s){var B=R(s);k="#"+l(B._r,B._g,B._b,B._a)}return"progid:DXImageTransform.Microsoft.gradient("+X+"startColorstr="+c+",endColorstr="+k+")"},toString:function(s){var c=!!s;s=s||this._format;var k=!1,X=this._a<1&&this._a>=0,B=!c&&X&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return B?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(k=this.toRgbString()),s==="prgb"&&(k=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(k=this.toHexString()),s==="hex3"&&(k=this.toHexString(!0)),s==="hex4"&&(k=this.toHex8String(!0)),s==="hex8"&&(k=this.toHex8String()),s==="name"&&(k=this.toName()),s==="hsl"&&(k=this.toHslString()),s==="hsv"&&(k=this.toHsvString()),k||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(s,c){var k=s.apply(null,[this].concat([].slice.call(c)));return this._r=k._r,this._g=k._g,this._b=k._b,this.setAlpha(k._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function(s,c){return s.apply(null,[this].concat([].slice.call(c)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},R.fromRatio=function(s,c){if(typeof s=="object"){var k={};for(var X in s)s.hasOwnProperty(X)&&(X==="a"?k[X]=s[X]:k[X]=Le(s[X]));s=k}return R(s,c)};function b(s){var c={r:0,g:0,b:0},k=1,X=null,B=null,se=null,ve=!1,Te=!1;return typeof s=="string"&&(s=me(s)),typeof s=="object"&&(xe(s.r)&&xe(s.g)&&xe(s.b)?(c=_(s.r,s.g,s.b),ve=!0,Te=String(s.r).substr(-1)==="%"?"prgb":"rgb"):xe(s.h)&&xe(s.s)&&xe(s.v)?(X=Le(s.s),B=Le(s.v),c=C(s.h,X,B),ve=!0,Te="hsv"):xe(s.h)&&xe(s.s)&&xe(s.l)&&(X=Le(s.s),se=Le(s.l),c=A(s.h,X,se),ve=!0,Te="hsl"),s.hasOwnProperty("a")&&(k=s.a)),k=V(k),{ok:ve,format:s.format||Te,r:K(255,H(c.r,0)),g:K(255,H(c.g,0)),b:K(255,H(c.b,0)),a:k}}function _(s,c,k){return{r:M(s,255)*255,g:M(c,255)*255,b:M(k,255)*255}}function P(s,c,k){s=M(s,255),c=M(c,255),k=M(k,255);var X=H(s,c,k),B=K(s,c,k),se,ve,Te=(X+B)/2;if(X==B)se=ve=0;else{var Pe=X-B;ve=Te>.5?Pe/(2-X-B):Pe/(X+B);switch(X){case s:se=(c-k)/Pe+(c<k?6:0);break;case c:se=(k-s)/Pe+2;break;case k:se=(s-c)/Pe+4;break}se/=6}return{h:se,s:ve,l:Te}}function A(s,c,k){var X,B,se;s=M(s,360),c=M(c,100),k=M(k,100);function ve(Ae,De,ke){return ke<0&&(ke+=1),ke>1&&(ke-=1),ke<1/6?Ae+(De-Ae)*6*ke:ke<1/2?De:ke<2/3?Ae+(De-Ae)*(2/3-ke)*6:Ae}if(c===0)X=B=se=k;else{var Te=k<.5?k*(1+c):k+c-k*c,Pe=2*k-Te;X=ve(Pe,Te,s+1/3),B=ve(Pe,Te,s),se=ve(Pe,Te,s-1/3)}return{r:X*255,g:B*255,b:se*255}}function S(s,c,k){s=M(s,255),c=M(c,255),k=M(k,255);var X=H(s,c,k),B=K(s,c,k),se,ve,Te=X,Pe=X-B;if(ve=X===0?0:Pe/X,X==B)se=0;else{switch(X){case s:se=(c-k)/Pe+(c<k?6:0);break;case c:se=(k-s)/Pe+2;break;case k:se=(s-c)/Pe+4;break}se/=6}return{h:se,s:ve,v:Te}}function C(s,c,k){s=M(s,360)*6,c=M(c,100),k=M(k,100);var X=J.floor(s),B=s-X,se=k*(1-c),ve=k*(1-B*c),Te=k*(1-(1-B)*c),Pe=X%6,Ae=[k,ve,se,se,Te,k][Pe],De=[Te,k,k,ve,se,se][Pe],ke=[se,se,Te,k,k,ve][Pe];return{r:Ae*255,g:De*255,b:ke*255}}function h(s,c,k,X){var B=[ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(k).toString(16))];return X&&B[0].charAt(0)==B[0].charAt(1)&&B[1].charAt(0)==B[1].charAt(1)&&B[2].charAt(0)==B[2].charAt(1)?B[0].charAt(0)+B[1].charAt(0)+B[2].charAt(0):B.join("")}function a(s,c,k,X,B){var se=[ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(k).toString(16)),ge(Ee(X))];return B&&se[0].charAt(0)==se[0].charAt(1)&&se[1].charAt(0)==se[1].charAt(1)&&se[2].charAt(0)==se[2].charAt(1)&&se[3].charAt(0)==se[3].charAt(1)?se[0].charAt(0)+se[1].charAt(0)+se[2].charAt(0)+se[3].charAt(0):se.join("")}function l(s,c,k,X){var B=[ge(Ee(X)),ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(k).toString(16))];return B.join("")}R.equals=function(s,c){return!s||!c?!1:R(s).toRgbString()==R(c).toRgbString()},R.random=function(){return R.fromRatio({r:N(),g:N(),b:N()})};function d(s,c){c=c===0?0:c||10;var k=R(s).toHsl();return k.s-=c/100,k.s=F(k.s),R(k)}function w(s,c){c=c===0?0:c||10;var k=R(s).toHsl();return k.s+=c/100,k.s=F(k.s),R(k)}function v(s){return R(s).desaturate(100)}function m(s,c){c=c===0?0:c||10;var k=R(s).toHsl();return k.l+=c/100,k.l=F(k.l),R(k)}function L(s,c){c=c===0?0:c||10;var k=R(s).toRgb();return k.r=H(0,K(255,k.r-D(255*-(c/100)))),k.g=H(0,K(255,k.g-D(255*-(c/100)))),k.b=H(0,K(255,k.b-D(255*-(c/100)))),R(k)}function y(s,c){c=c===0?0:c||10;var k=R(s).toHsl();return k.l-=c/100,k.l=F(k.l),R(k)}function f(s,c){var k=R(s).toHsl(),X=(k.h+c)%360;return k.h=X<0?360+X:X,R(k)}function p(s){var c=R(s).toHsl();return c.h=(c.h+180)%360,R(c)}function u(s){var c=R(s).toHsl(),k=c.h;return[R(s),R({h:(k+120)%360,s:c.s,l:c.l}),R({h:(k+240)%360,s:c.s,l:c.l})]}function o(s){var c=R(s).toHsl(),k=c.h;return[R(s),R({h:(k+90)%360,s:c.s,l:c.l}),R({h:(k+180)%360,s:c.s,l:c.l}),R({h:(k+270)%360,s:c.s,l:c.l})]}function E(s){var c=R(s).toHsl(),k=c.h;return[R(s),R({h:(k+72)%360,s:c.s,l:c.l}),R({h:(k+216)%360,s:c.s,l:c.l})]}function g(s,c,k){c=c||6,k=k||30;var X=R(s).toHsl(),B=360/k,se=[R(s)];for(X.h=(X.h-(B*c>>1)+720)%360;--c;)X.h=(X.h+B)%360,se.push(R(X));return se}function x(s,c){c=c||6;for(var k=R(s).toHsv(),X=k.h,B=k.s,se=k.v,ve=[],Te=1/c;c--;)ve.push(R({h:X,s:B,v:se})),se=(se+Te)%1;return ve}R.mix=function(s,c,k){k=k===0?0:k||50;var X=R(s).toRgb(),B=R(c).toRgb(),se=k/100,ve={r:(B.r-X.r)*se+X.r,g:(B.g-X.g)*se+X.g,b:(B.b-X.b)*se+X.b,a:(B.a-X.a)*se+X.a};return R(ve)},R.readability=function(s,c){var k=R(s),X=R(c);return(J.max(k.getLuminance(),X.getLuminance())+.05)/(J.min(k.getLuminance(),X.getLuminance())+.05)},R.isReadable=function(s,c,k){var X=R.readability(s,c),B,se;se=!1,B=z(k);switch(B.level+B.size){case"AAsmall":case"AAAlarge":se=X>=4.5;break;case"AAlarge":se=X>=3;break;case"AAAsmall":se=X>=7;break}return se},R.mostReadable=function(s,c,k){var X=null,B=0,se,ve,Te,Pe;k=k||{},ve=k.includeFallbackColors,Te=k.level,Pe=k.size;for(var Ae=0;Ae<c.length;Ae++)se=R.readability(s,c[Ae]),se>B&&(B=se,X=R(c[Ae]));return R.isReadable(s,X,{level:Te,size:Pe})||!ve?X:(k.includeFallbackColors=!1,R.mostReadable(s,["#fff","#000"],k))};var I=R.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"},j=R.hexNames=G(I);function G(s){var c={};for(var k in s)s.hasOwnProperty(k)&&(c[s[k]]=k);return c}function V(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function M(s,c){ie(s)&&(s="100%");var k=de(s);return s=K(c,H(0,parseFloat(s))),k&&(s=parseInt(s*c,10)/100),J.abs(s-c)<1e-6?1:s%c/parseFloat(c)}function F(s){return K(1,H(0,s))}function $(s){return parseInt(s,16)}function ie(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function de(s){return typeof s=="string"&&s.indexOf("%")!=-1}function ge(s){return s.length==1?"0"+s:""+s}function Le(s){return s<=1&&(s=s*100+"%"),s}function Ee(s){return J.round(parseFloat(s)*255).toString(16)}function _e(s){return $(s)/255}var Se=function(){var s="[-\\+]?\\d+%?",c="[-\\+]?\\d*\\.\\d+%?",k="(?:"+c+")|(?:"+s+")",X="[\\s|\\(]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",B="[\\s|\\(]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?";return{CSS_UNIT:new RegExp(k),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+B),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 xe(s){return!!Se.CSS_UNIT.exec(s)}function me(s){s=s.replace(O,"").replace(Z,"").toLowerCase();var c=!1;if(I[s])s=I[s],c=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var k;return(k=Se.rgb.exec(s))?{r:k[1],g:k[2],b:k[3]}:(k=Se.rgba.exec(s))?{r:k[1],g:k[2],b:k[3],a:k[4]}:(k=Se.hsl.exec(s))?{h:k[1],s:k[2],l:k[3]}:(k=Se.hsla.exec(s))?{h:k[1],s:k[2],l:k[3],a:k[4]}:(k=Se.hsv.exec(s))?{h:k[1],s:k[2],v:k[3]}:(k=Se.hsva.exec(s))?{h:k[1],s:k[2],v:k[3],a:k[4]}:(k=Se.hex8.exec(s))?{r:$(k[1]),g:$(k[2]),b:$(k[3]),a:_e(k[4]),format:c?"name":"hex8"}:(k=Se.hex6.exec(s))?{r:$(k[1]),g:$(k[2]),b:$(k[3]),format:c?"name":"hex"}:(k=Se.hex4.exec(s))?{r:$(k[1]+""+k[1]),g:$(k[2]+""+k[2]),b:$(k[3]+""+k[3]),a:_e(k[4]+""+k[4]),format:c?"name":"hex8"}:(k=Se.hex3.exec(s))?{r:$(k[1]+""+k[1]),g:$(k[2]+""+k[2]),b:$(k[3]+""+k[3]),format:c?"name":"hex"}:!1}function z(s){var c,k;return s=s||{level:"AA",size:"small"},c=(s.level||"AA").toUpperCase(),k=(s.size||"small").toLowerCase(),c!=="AA"&&c!=="AAA"&&(c="AA"),k!=="small"&&k!=="large"&&(k="small"),{level:c,size:k}}nt.exports?nt.exports=R:!(ce=function(){return R}.call(ze,oe,ze,nt),ce!==void 0&&(nt.exports=ce))})(Math)},bT9E:function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return J});var ce=oe("VTBJ");function J(O,Z){var U=Object(ce.a)({},O);return Array.isArray(Z)&&Z.forEach(function(D){delete U[D]}),U}},c5Ni:function(nt,ze,oe){},dejd:function(nt,ze,oe){},dmUQ:function(nt,ze,oe){"use strict";var ce=oe("Ff2n"),J=oe("rePB"),O=oe("1OyB"),Z=oe("vuIU"),U=oe("Ji7U"),D=oe("md7G"),K=oe("foSv"),H=oe("q1tI"),N=oe.n(H),R=oe("TSYQ"),b=oe.n(R),_=oe("4IlW");function P(u,o){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(u);o&&(g=g.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),E.push.apply(E,g)}return E}function A(u){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?P(Object(E),!0).forEach(function(g){Object(J.a)(u,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):P(Object(E)).forEach(function(g){Object.defineProperty(u,g,Object.getOwnPropertyDescriptor(E,g))})}return u}function S(u){var o=C();return function(){var g=Object(K.a)(u),x;if(o){var I=Object(K.a)(this).constructor;x=Reflect.construct(g,arguments,I)}else x=g.apply(this,arguments);return Object(D.a)(this,x)}}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(u){return!1}}function h(){}function a(u){u.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},d=200,w=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},L=function(o,E){return E===o||typeof E=="number"&&typeof o=="number"&&isNaN(E)&&isNaN(o)},y=function(u){Object(U.a)(E,u);var o=S(E);function E(g){var x;Object(O.a)(this,E),x=o.call(this,g),x.onKeyDown=function(G){var V=x.props,M=V.onKeyDown,F=V.onPressEnter;if(G.keyCode===_.a.UP){var $=x.getRatio(G);x.up(G,$,null),x.stop()}else if(G.keyCode===_.a.DOWN){var ie=x.getRatio(G);x.down(G,ie,null),x.stop()}else G.keyCode===_.a.ENTER&&F&&F(G);if(x.recordCursorPosition(),x.lastKeyCode=G.keyCode,M){for(var de=arguments.length,ge=new Array(de>1?de-1:0),Le=1;Le<de;Le++)ge[Le-1]=arguments[Le];M.apply(void 0,[G].concat(ge))}},x.onKeyUp=function(G){var V=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),V){for(var M=arguments.length,F=new Array(M>1?M-1:0),$=1;$<M;$++)F[$-1]=arguments[$];V.apply(void 0,[G].concat(F))}},x.onChange=function(G){var V=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(G)),x.setState({inputValue:x.rawInput}),V(x.toNumber(x.rawInput))},x.onMouseUp=function(){var G=x.props.onMouseUp;x.recordCursorPosition(),G&&G.apply(void 0,arguments)},x.onFocus=function(){var G;x.setState({focused:!0}),(G=x.props).onFocus.apply(G,arguments)},x.onBlur=function(){var G=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var V=x.getCurrentValidValue(x.state.inputValue),M=x.setValue(V,h);if(G){var F=x.input.value,$=x.getInputDisplayValue({focus:!1,value:M});x.input.value=$&&Number($),G.apply(void 0,arguments),x.input.value=F}},x.getRatio=function(G){var V=1;return G.metaKey||G.ctrlKey?V=.1:G.shiftKey&&(V=10),V},x.getFullNum=function(G){return isNaN(G)?G:/e/i.test(String(G))?Number(G).toFixed(18).replace(/\.?0+$/,""):G},x.getPrecision=function(G){if(m(x.props.precision))return x.props.precision;var V=String(G);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},x.getInputDisplayValue=function(G){var V=G||x.state,M=V.focused,F=V.inputValue,$=V.value,ie;M?ie=F:ie=x.toPrecisionAsStep($),ie==null&&(ie="");var de=x.formatWrapper(ie);return m(x.props.decimalSeparator)&&(de=de.toString().replace(".",x.props.decimalSeparator)),de},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(G){}},x.restoreByAfter=function(G){if(G===void 0)return!1;var V=x.input.value,M=V.lastIndexOf(G);if(M===-1)return!1;var F=x.cursorBefore.length;return x.lastKeyCode===_.a.DELETE&&x.cursorBefore.charAt(F-1)===G[0]?(x.fixCaret(F,F),!0):M+G.length===V.length?(x.fixCaret(M,M),!0):!1},x.partRestoreByAfter=function(G){return G===void 0?!1:Array.prototype.some.call(G,function(V,M){var F=G.substring(M);return x.restoreByAfter(F)})},x.isNotCompleteNumber=function(G){return isNaN(G)||G===""||G===null||G&&G.toString().indexOf(".")===G.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(G,V,M){x.pressingUpOrDown=!0,x.step("down",G,V,M)},x.up=function(G,V,M){x.pressingUpOrDown=!0,x.step("up",G,V,M)},x.saveInput=function(G){x.input=G};var I=g.value;I===void 0&&(I=g.defaultValue),x.state={focused:g.autoFocus};var j=x.getValidValue(x.toNumber(I));return x.state=A(A({},x.state),{},{inputValue:x.toPrecisionAsStep(j),value:j}),x}return Object(Z.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var I=this.props,j=I.value,G=I.onChange,V=I.max,M=I.min,F=this.state.focused;if(x){if(!L(x.value,j)||!L(x.max,V)||!L(x.min,M)){var $=F?j:this.getValidValue(j),ie;this.pressingUpOrDown?ie=$:this.inputting?ie=this.rawInput:ie=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ie})}var de="value"in this.props?j:this.state.value;"max"in this.props&&x.max!==V&&typeof de=="number"&&de>V&&G&&G(V),"min"in this.props&&x.min!==M&&typeof de=="number"&&de<M&&G&&G(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ge=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===_.a.BACKSPACE?ge=this.cursorStart-1:this.lastKeyCode===_.a.DELETE&&(ge=this.cursorStart):ge=this.input.value.length,this.fixCaret(ge,ge)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case _.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case _.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Le){}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(x){var I=x;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(x){var I=x.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(x){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,G=parseFloat(x);return isNaN(G)?x:(G<I&&(G=I),G>j&&(G=j),G)}},{key:"setValue",value:function(x,I){var j=this.props.precision,G=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),V=this.state.value,M=V===void 0?null:V,F=this.state.inputValue,$=F===void 0?null:F,ie=typeof G=="number"?G.toFixed(j):"".concat(G),de=G!==M||ie!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},I)):this.setState({value:G,inputValue:this.toPrecisionAsStep(x)},I),de&&this.props.onChange(G),G}},{key:"getMaxPrecision",value:function(x){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,G=j.precision,V=j.step;if(m(G))return G;var M=this.getPrecision(I),F=this.getPrecision(V),$=this.getPrecision(x);return x?Math.max($,M+F):M+F}},{key:"getPrecisionFactor",value:function(x){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(x,I);return Math.pow(10,j)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var I=Math.abs(this.getMaxPrecision(x));return isNaN(I)?x.toString():Number(x).toFixed(I)}},{key:"toNumber",value:function(x){var I=this.props.precision,j=this.state.focused,G=x&&x.length>16&&j;return this.isNotCompleteNumber(x)||G?x:m(I)?Math.round(x*Math.pow(10,I))/Math.pow(10,I):Number(x)}},{key:"upStep",value:function(x,I){var j=this.props.step,G=this.getPrecisionFactor(x,I),V=Math.abs(this.getMaxPrecision(x,I)),M=((G*x+G*j*I)/G).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(x,I){var j=this.props.step,G=this.getPrecisionFactor(x,I),V=Math.abs(this.getMaxPrecision(x,I)),M=((G*x-G*j*I)/G).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(x,I){var j=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var M=this.props;if(M.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var $=this["".concat(x,"Step")](F,G),ie=$>M.max||$<M.min;if($>M.max?$=M.max:$<M.min&&($=M.min),this.setValue($,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),ie)return;this.autoStepTimer=setTimeout(function(){j[x](I,G,!0)},V?d:w)}},{key:"fixCaret",value:function(x,I){if(x===void 0||I===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,G=this.input.selectionEnd;(x!==j||I!==G)&&this.input.setSelectionRange(x,I)}catch(V){}}},{key:"render",value:function(){var x,I=this.props,j=I.prefixCls,G=I.disabled,V=I.readOnly,M=I.useTouch,F=I.autoComplete,$=I.upHandler,ie=I.downHandler,de=I.className,ge=I.max,Le=I.min,Ee=I.style,_e=I.title,Se=I.onMouseEnter,xe=I.onMouseLeave,me=I.onMouseOver,z=I.onMouseOut,s=I.required,c=I.onClick,k=I.tabIndex,X=I.type,B=I.placeholder,se=I.id,ve=I.inputMode,Te=I.pattern,Pe=I.step,Ae=I.maxLength,De=I.autoFocus,ke=I.name,Fe=I.onPaste,je=I.onInput,Be=Object(ce.a)(I,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ie=this.state,Ye=Ie.value,He=Ie.focused,Xe=b()(j,(x={},Object(J.a)(x,de,!!de),Object(J.a)(x,"".concat(j,"-disabled"),G),Object(J.a)(x,"".concat(j,"-focused"),He),x)),Oe={};Object.keys(Be).forEach(function(fe){(fe.substr(0,5)==="data-"||fe.substr(0,5)==="aria-"||fe==="role")&&(Oe[fe]=Be[fe])});var tt=!V&&!G,Qe=this.getInputDisplayValue(null),le=(Ye||Ye===0)&&(isNaN(Ye)||Number(Ye)>=ge),q=(Ye||Ye===0)&&(isNaN(Ye)||Number(Ye)<=Le),ee=le||G||V,ae=q||G||V,ue=b()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(J.a)({},"".concat(j,"-handler-up-disabled"),ee)),te=b()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(J.a)({},"".concat(j,"-handler-down-disabled"),ae)),ne=M?{onTouchStart:ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=M?{onTouchStart:ae?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return N.a.createElement("div",{className:Xe,style:Ee,title:_e,onMouseEnter:Se,onMouseLeave:xe,onMouseOver:me,onMouseOut:z,onFocus:function(){return null},onBlur:function(){return null}},N.a.createElement("div",{className:"".concat(j,"-handler-wrap")},N.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:ue}),$||N.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:a})),N.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:te}),ie||N.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:a}))),N.a.createElement("div",{className:"".concat(j,"-input-wrap")},N.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Le,"aria-valuemax":ge,"aria-valuenow":Ye,required:s,type:X,placeholder:B,onPaste:Fe,onClick:c,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:k,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:tt?this.onKeyDown:h,onKeyUp:tt?this.onKeyUp:h,autoFocus:De,maxLength:Ae,readOnly:V,disabled:G,max:ge,min:Le,step:Pe,name:ke,title:_e,id:se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Qe),pattern:Te,inputMode:ve,onInput:je},Oe))))}}]),E}(N.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var f=y,p=ze.a=f},gHQ5:function(nt,ze,oe){"use strict";oe.r(ze);var ce=oe("+L6B"),J=oe("2/Rp"),O=oe("5NDa"),Z=oe("5rEg"),U=oe("k1fw"),D=oe("9og8"),K=oe("y8nQ"),H=oe("Vl3Y"),N=oe("tJVT"),R=oe("CiB2"),b=oe("WmNS"),_=oe.n(b),P=oe("q1tI"),A=oe.n(P),S=oe("3vs6"),C=oe("l3Yi"),h=oe.n(C),a=oe("Ot1p"),l=oe("500L"),d=oe("ErOA"),w=oe("Ty5D"),v=oe("9kvl"),m=function(y){var f;Object(R.a)(y);var p=Object(P.useState)({}),u=Object(N.a)(p,2),o=u[0],E=u[1],g=H.a.useForm(),x=Object(N.a)(g,1),I=x[0],j=Object(P.useState)(!0),G=Object(N.a)(j,2),V=G[0],M=G[1],F=Object(P.useState)(!1),$=Object(N.a)(F,2),ie=$[0],de=$[1],ge=Object(P.useState)(!1),Le=Object(N.a)(ge,2),Ee=Le[0],_e=Le[1],Se=Object(w.i)(),xe=Se==null?void 0:Se.virtual_spacesId;Object(P.useEffect)(function(){Se!=null&&Se.id?me():_e(!0)},[]);var me=function(){var s=Object(D.a)(_.a.mark(function c(){var k,X;return _.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return se.next=2,Object(d.a)("/api/virtual_classrooms/".concat(xe,"/syllabuses/").concat(Se==null?void 0:Se.id,"/edit.json"),{method:"get"});case 2:k=se.sent,k&&(X={title:k.title,description:k.description,attachment_ids:Object(l.a)(k.attachments)},console.log(X,"formData"),I.setFieldsValue(Object(U.a)({},X)),E(Object(U.a)({},X)),_e(!0));case 4:case"end":return se.stop()}},c)}));return function(){return s.apply(this,arguments)}}(),z=function(){var s=Object(D.a)(_.a.mark(function c(k){var X,B,se,ve,Te;return _.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(B=Object(U.a)({},o),B.attachment_ids&&(B.attachment_ids=B==null||((se=B.attachment_ids)===null||se===void 0)?void 0:se.map(function(De){return De.response.id})),de(!0),!(Se!=null&&Se.id)){Ae.next=9;break}return Ae.next=6,Object(d.a)("/api/virtual_classrooms/".concat(xe,"/syllabuses/").concat(Se==null?void 0:Se.id,".json"),{method:"put",body:Object(U.a)({},B)});case 6:ve=Ae.sent,Ae.next=12;break;case 9:return Ae.next=11,Object(d.a)("/api/virtual_classrooms/".concat(xe,"/syllabuses.json"),{method:"post",body:Object(U.a)({},B)});case 11:ve=Ae.sent;case 12:(X=ve)!==null&&X!==void 0&&X.virtual_classroom_id&&v.d.push("/vspaces/".concat(xe,"/syllabuses/").concat((Te=ve)===null||Te===void 0?void 0:Te.id,"/detail")),de(!1);case 14:case"end":return Ae.stop()}},c)}));return function(k){return s.apply(this,arguments)}}();return A.a.createElement("div",{className:h.a.wrap},A.a.createElement(S.a,null),A.a.createElement("div",{className:h.a.form},A.a.createElement("div",{className:h.a.title},A.a.createElement("span",{onClick:function(){return v.d.push("/vspaces/".concat(xe,"/syllabuses"))}},A.a.createElement("i",{className:"iconfont icon-zuoshangjiaofanhui"}),"\u8FD4\u56DE"),A.a.createElement("span",null,"\u65B0\u5EFA\u6559\u5B66\u5927\u7EB2")),A.a.createElement(H.a,{colon:!1,form:I,scrollToFirstError:!0,onValuesChange:function(){E(Object(U.a)({},I.getFieldsValue()))},onFinish:z},A.a.createElement(H.a.Item,{name:"title",label:"\u5927\u7EB2\u6807\u9898",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"}]},A.a.createElement(Z.a,{maxLength:60,suffix:"".concat(((f=o.title)===null||f===void 0?void 0:f.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"})),A.a.createElement("div",{style:{margin:"20px 0 12px 10px"}},"\u5927\u7EB2\u5185\u5BB9"),A.a.createElement(H.a.Item,{className:"ml10",name:"description",rules:[{max:5e4,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u523650000\u4E2A\u5B57\u7B26"}]},A.a.createElement(a.a,{watch:!0,defaultValue:o.description})),A.a.createElement(H.a.Item,{className:"ml10",name:"attachment_ids",label:"\u9644\u4EF6"},Ee&&A.a.createElement(l.b,{className:h.a.file,title:A.a.createElement("span",null,A.a.createElement("i",{className:"iconfont icon-shangchuan1 font14 mr5"}),"\u4E0A\u4F20\u9644\u4EF6")})),A.a.createElement("div",{style:{textAlign:"right"}},A.a.createElement(H.a.Item,null,A.a.createElement(J.a,{onClick:function(){return v.d.push("/vspaces/".concat(xe,"/syllabuses"))},className:"mr10"},"\u53D6\u6D88"),A.a.createElement(J.a,{type:"primary",htmlType:"submit",loading:ie},"\u786E\u8BA4"))))))};ze.default=m},h78n:function(nt,ze,oe){"use strict";oe.d(ze,"a",function(){return x});var ce=oe("q1tI"),J=oe.n(ce),O=oe("TSYQ"),Z=oe.n(O),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},D=function(G){var V=G.map(function(){return Object(ce.useRef)()}),M=Object(ce.useRef)();return Object(ce.useEffect)(function(){var F=Date.now(),$=!1;Object.keys(V).forEach(function(ie){var de=V[ie].current;if(!de)return;$=!0;var ge=de.style;ge.transitionDuration=".3s, .3s, .3s, .06s",M.current&&F-M.current<100&&(ge.transitionDuration="0s, 0s")}),$&&(M.current=Date.now())}),[V]};function K(){return K=Object.assign||function(j){for(var G=1;G<arguments.length;G++){var V=arguments[G];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},K.apply(this,arguments)}function H(j,G){return P(j)||_(j,G)||R(j,G)||N()}function N(){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 R(j,G){if(!j)return;if(typeof j=="string")return b(j,G);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return b(j,G)}function b(j,G){(G==null||G>j.length)&&(G=j.length);for(var V=0,M=new Array(G);V<G;V++)M[V]=j[V];return M}function _(j,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,F=!1,$=void 0;try{for(var ie=j[Symbol.iterator](),de;!(M=(de=ie.next()).done)&&!(V.push(de.value),G&&V.length===G);M=!0);}catch(ge){F=!0,$=ge}finally{try{!M&&ie.return!=null&&ie.return()}finally{if(F)throw $}}return V}function P(j){if(Array.isArray(j))return j}function A(j,G){if(j==null)return{};var V=S(j,G),M,F;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(F=0;F<$.length;F++){if(M=$[F],G.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function S(j,G){if(j==null)return{};var V={},M=Object.keys(j),F,$;for($=0;$<M.length;$++){if(F=M[$],G.indexOf(F)>=0)continue;V[F]=j[F]}return V}var C=function(G){var V=G.className,M=G.percent,F=G.prefixCls,$=G.strokeColor,ie=G.strokeLinecap,de=G.strokeWidth,ge=G.style,Le=G.trailColor,Ee=G.trailWidth,_e=G.transition,Se=A(G,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Se.gapPosition;var xe=Array.isArray(M)?M:[M],me=Array.isArray($)?$:[$],z=D(xe),s=H(z,1),c=s[0],k=de/2,X=100-de/2,B="M ".concat(ie==="round"?k:0,",").concat(k,`
L `).concat(ie==="round"?X:100,",").concat(k),se="0 0 100 ".concat(de),ve=0;return J.a.createElement("svg",K({className:Z()("".concat(F,"-line"),V),viewBox:se,preserveAspectRatio:"none",style:ge},Se),J.a.createElement("path",{className:"".concat(F,"-line-trail"),d:B,strokeLinecap:ie,stroke:Le,strokeWidth:Ee||de,fillOpacity:"0"}),xe.map(function(Te,Pe){var Ae={strokeDasharray:"".concat(Te,"px, 100px"),strokeDashoffset:"-".concat(ve,"px"),transition:_e||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=me[Pe]||me[me.length-1];return ve+=Te,J.a.createElement("path",{key:Pe,className:"".concat(F,"-line-path"),d:B,strokeLinecap:ie,stroke:De,strokeWidth:de,fillOpacity:"0",ref:c[Pe],style:Ae})}))};C.defaultProps=U;var h=C;function a(){return a=Object.assign||function(j){for(var G=1;G<arguments.length;G++){var V=arguments[G];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},a.apply(this,arguments)}function l(j,G){return L(j)||m(j,G)||w(j,G)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(j,G){if(!j)return;if(typeof j=="string")return v(j,G);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(j,G)}function v(j,G){(G==null||G>j.length)&&(G=j.length);for(var V=0,M=new Array(G);V<G;V++)M[V]=j[V];return M}function m(j,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,F=!1,$=void 0;try{for(var ie=j[Symbol.iterator](),de;!(M=(de=ie.next()).done)&&!(V.push(de.value),G&&V.length===G);M=!0);}catch(ge){F=!0,$=ge}finally{try{!M&&ie.return!=null&&ie.return()}finally{if(F)throw $}}return V}function L(j){if(Array.isArray(j))return j}function y(j,G){if(j==null)return{};var V=f(j,G),M,F;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(j);for(F=0;F<$.length;F++){if(M=$[F],G.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function f(j,G){if(j==null)return{};var V={},M=Object.keys(j),F,$;for($=0;$<M.length;$++){if(F=M[$],G.indexOf(F)>=0)continue;V[F]=j[F]}return V}var p=0;function u(j){return+j.replace("%","")}function o(j){return Array.isArray(j)?j:[j]}function E(j,G,V,M){var F=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ie=50-M/2,de=0,ge=-ie,Le=0,Ee=-2*ie;switch($){case"left":de=-ie,ge=0,Le=2*ie,Ee=0;break;case"right":de=ie,ge=0,Le=-2*ie,Ee=0;break;case"bottom":ge=ie,Ee=2*ie;break;default:}var _e="M 50,50 m ".concat(de,",").concat(ge,`
a `).concat(ie,",").concat(ie," 0 1 1 ").concat(Le,",").concat(-Ee,`
a `).concat(ie,",").concat(ie," 0 1 1 ").concat(-Le,",").concat(Ee),Se=Math.PI*2*ie,xe={stroke:V,strokeDasharray:"".concat(G/100*(Se-F),"px ").concat(Se,"px"),strokeDashoffset:"-".concat(F/2+j/100*(Se-F),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:_e,pathStyle:xe}}var g=function(G){var V=G.prefixCls,M=G.strokeWidth,F=G.trailWidth,$=G.gapDegree,ie=G.gapPosition,de=G.trailColor,ge=G.strokeLinecap,Le=G.style,Ee=G.className,_e=G.strokeColor,Se=G.percent,xe=y(G,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(ce.useMemo)(function(){return p+=1,p},[]),z=E(0,100,de,M,$,ie),s=z.pathString,c=z.pathStyle,k=o(Se),X=o(_e),B=X.find(function(Ae){return Object.prototype.toString.call(Ae)==="[object Object]"}),se=D(k),ve=l(se,1),Te=ve[0],Pe=function(){var De=0;return k.map(function(ke,Fe){var je=X[Fe]||X[X.length-1],Be=Object.prototype.toString.call(je)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",Ie=E(De,ke,je,M,$,ie);return De+=ke,J.a.createElement("path",{key:Fe,className:"".concat(V,"-circle-path"),d:Ie.pathString,stroke:Be,strokeLinecap:ge,strokeWidth:M,opacity:ke===0?0:1,fillOpacity:"0",style:Ie.pathStyle,ref:Te[Fe]})})};return J.a.createElement("svg",a({className:Z()("".concat(V,"-circle"),Ee),viewBox:"0 0 100 100",style:Le},xe),B&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(B).sort(function(Ae,De){return u(Ae)-u(De)}).map(function(Ae,De){return J.a.createElement("stop",{key:De,offset:Ae,stopColor:B[Ae]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:s,stroke:de,strokeLinecap:ge,strokeWidth:F||M,fillOpacity:"0",style:c}),Pe().reverse())};g.defaultProps=U;var x=g,I={Line:h,Circle:x}},kSUc:function(nt,ze,oe){},l3Yi:function(nt,ze,oe){nt.exports={flex_box_center:"flex_box_center___354pw",flex_space_between:"flex_space_between___10PE2",flex_box_vertical_center:"flex_box_vertical_center___YT9_A",flex_box_center_end:"flex_box_center_end___1qNoU",flex_box_column:"flex_box_column___2E4_8",wrap:"wrap___1umYZ",form:"form___2x_Sk",title:"title___idVlc",file:"file___1g_02"}},lZu9:function(nt,ze,oe){(function(ce){ce(oe("VrN/"),oe("1eCo"),oe("8EBN"))})(function(ce){"use strict";ce.defineMode("markdown",function(J,O){var Z=ce.getMode(J,"text/html"),U=Z.name=="null";function D(M){if(ce.findModeByName){var F=ce.findModeByName(M);F&&(M=F.mime||F.mimes[0])}var $=ce.getMode(J,M);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var K={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var H in K)K.hasOwnProperty(H)&&O.tokenTypeOverrides[H]&&(K[H]=O.tokenTypeOverrides[H]);var N=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,_=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function l(M,F,$){return F.f=F.inline=$,$(M,F)}function d(M,F,$){return F.f=F.block=$,$(M,F)}function w(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==L){var F=U;if(!F){var $=ce.innerMode(Z,M.htmlState);F=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}F&&(M.f=u,M.block=m,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function m(M,F){var $=M.column()===F.indentation,ie=w(F.prevLine.stream),de=F.indentedCode,ge=F.prevLine.hr,Le=F.list!==!1,Ee=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var _e=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Le)){for(F.list=null;_e<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=_e-F.listStack[F.listStack.length-1])}var Se=!ie&&!ge&&!F.prevLine.header&&(!Le||!de)&&!F.prevLine.fencedCodeEnd,xe=(F.list===!1||ge||ie)&&F.indentation<=Ee&&M.match(N),me=null;if(F.indentationDiff>=4&&(de||F.prevLine.fencedCodeEnd||F.prevLine.header||ie))return M.skipToEnd(),F.indentedCode=!0,K.code;if(M.eatSpace())return null;if($&&F.indentation<=Ee&&(me=M.match(_))&&me[1].length<=6)return F.quote=0,F.header=me[1].length,F.thisLine.header=!0,O.highlightFormatting&&(F.formatting="header"),F.f=F.inline,f(F);if(F.indentation<=Ee&&M.eat(">"))return F.quote=$?1:F.quote+1,O.highlightFormatting&&(F.formatting="quote"),M.eatSpace(),f(F);if(!xe&&!F.setext&&$&&F.indentation<=Ee&&(me=M.match(R))){var z=me[1]?"ol":"ul";return F.indentation=_e+M.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,O.taskLists&&M.match(b,!1)&&(F.taskList=!0),F.f=F.inline,O.highlightFormatting&&(F.formatting=["list","list-"+z]),f(F)}else{if($&&F.indentation<=Ee&&(me=M.match(S,!0)))return F.quote=0,F.fencedEndRE=new RegExp(me[1]+"+ *$"),F.localMode=O.fencedCodeBlockHighlighting&&D(me[2]||O.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=ce.startState(F.localMode)),F.f=F.block=y,O.highlightFormatting&&(F.formatting="code-block"),F.code=-1,f(F);if(F.setext||(!Se||!Le)&&!F.quote&&F.list===!1&&!F.code&&!xe&&!C.test(M.string)&&(me=M.lookAhead(1))&&(me=me.match(P)))return F.setext?(F.header=F.setext,F.setext=0,M.skipToEnd(),O.highlightFormatting&&(F.formatting="header")):(F.header=me[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,f(F);if(xe)return M.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,K.hr;if(M.peek()==="[")return l(M,F,I)}return l(M,F,F.inline)}function L(M,F){var $=Z.token(M,F.htmlState);if(!U){var ie=ce.innerMode(Z,F.htmlState);(ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText||F.md_inside&&M.current().indexOf(">")>-1)&&(F.f=u,F.block=m,F.htmlState=null)}return $}function y(M,F){var $=F.listStack[F.listStack.length-1]||0,ie=F.indentation<$,de=$+3;if(F.fencedEndRE&&F.indentation<=de&&(ie||M.match(F.fencedEndRE))){O.highlightFormatting&&(F.formatting="code-block");var ge;return ie||(ge=f(F)),F.localMode=F.localState=null,F.block=m,F.f=u,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,ie?d(M,F,F.block):ge}else return F.localMode?F.localMode.token(M,F.localState):(M.skipToEnd(),K.code)}function f(M){var F=[];if(M.formatting){F.push(K.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var $=0;$<M.formatting.length;$++)F.push(K.formatting+"-"+M.formatting[$]),M.formatting[$]==="header"&&F.push(K.formatting+"-"+M.formatting[$]+"-"+M.header),M.formatting[$]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?F.push(K.formatting+"-"+M.formatting[$]+"-"+M.quote):F.push("error"))}if(M.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(M.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(M.linkHref?F.push(K.linkHref,"url"):(M.strong&&F.push(K.strong),M.em&&F.push(K.em),M.strikethrough&&F.push(K.strikethrough),M.emoji&&F.push(K.emoji),M.linkText&&F.push(K.linkText),M.code&&F.push(K.code),M.image&&F.push(K.image),M.imageAltText&&F.push(K.imageAltText,"link"),M.imageMarker&&F.push(K.imageMarker)),M.header&&F.push(K.header,K.header+"-"+M.header),M.quote&&(F.push(K.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?F.push(K.quote+"-"+M.quote):F.push(K.quote+"-"+O.maxBlockquoteDepth)),M.list!==!1){var ie=(M.listStack.length-1)%3;ie?ie===1?F.push(K.list2):F.push(K.list3):F.push(K.list1)}return M.trailingSpaceNewLine?F.push("trailing-space-new-line"):M.trailingSpace&&F.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function p(M,F){return M.match(A,!0)?f(F):void 0}function u(M,F){var $=F.text(M,F);if(typeof $!="undefined")return $;if(F.list)return F.list=null,f(F);if(F.taskList){var ie=M.match(b,!0)[1]===" ";return ie?F.taskOpen=!0:F.taskClosed=!0,O.highlightFormatting&&(F.formatting="task"),F.taskList=!1,f(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&M.match(/^#+$/,!0))return O.highlightFormatting&&(F.formatting="header"),f(F);var de=M.next();if(F.linkTitle){F.linkTitle=!1;var ge=de;de==="("&&(ge=")"),ge=(ge+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Le="^\\s*(?:[^"+ge+"\\\\]+|\\\\\\\\|\\\\.)"+ge;if(M.match(new RegExp(Le),!0))return K.linkHref}if(de==="`"){var Ee=F.formatting;O.highlightFormatting&&(F.formatting="code"),M.eatWhile("`");var _e=M.current().length;if(F.code==0&&(!F.quote||_e==1))return F.code=_e,f(F);if(_e==F.code){var Se=f(F);return F.code=0,Se}else return F.formatting=Ee,f(F)}else if(F.code)return f(F);if(de==="\\"&&(M.next(),O.highlightFormatting)){var xe=f(F),me=K.formatting+"-escape";return xe?xe+" "+me:me}if(de==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,O.highlightFormatting&&(F.formatting="image"),f(F);if(de==="["&&F.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,O.highlightFormatting&&(F.formatting="image"),f(F);if(de==="]"&&F.imageAltText){O.highlightFormatting&&(F.formatting="image");var xe=f(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=E,xe}if(de==="["&&!F.image)return F.linkText&&M.match(/^.*?\]/)||(F.linkText=!0,O.highlightFormatting&&(F.formatting="link")),f(F);if(de==="]"&&F.linkText){O.highlightFormatting&&(F.formatting="link");var xe=f(F);return F.linkText=!1,F.inline=F.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?E:u,xe}if(de==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,O.highlightFormatting&&(F.formatting="link");var xe=f(F);return xe?xe+=" ":xe="",xe+K.linkInline}if(de==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,O.highlightFormatting&&(F.formatting="link");var xe=f(F);return xe?xe+=" ":xe="",xe+K.linkEmail}if(O.xml&&de==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var z=M.string.indexOf(">",M.pos);if(z!=-1){var s=M.string.substring(M.start,z);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(s)&&(F.md_inside=!0)}return M.backUp(1),F.htmlState=ce.startState(Z),d(M,F,L)}if(O.xml&&de==="<"&&M.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(de==="*"||de==="_"){for(var c=1,k=M.pos==1?" ":M.string.charAt(M.pos-2);c<3&&M.eat(de);)c++;var X=M.peek()||" ",B=!/\s/.test(X)&&(!h.test(X)||/\s/.test(k)||h.test(k)),se=!/\s/.test(k)&&(!h.test(k)||/\s/.test(X)||h.test(X)),ve=null,Te=null;if(c%2&&(!F.em&&B&&(de==="*"||!se||h.test(k))?ve=!0:F.em==de&&se&&(de==="*"||!B||h.test(X))&&(ve=!1)),c>1&&(!F.strong&&B&&(de==="*"||!se||h.test(k))?Te=!0:F.strong==de&&se&&(de==="*"||!B||h.test(X))&&(Te=!1)),Te!=null||ve!=null){O.highlightFormatting&&(F.formatting=ve==null?"strong":Te==null?"em":"strong em"),ve===!0&&(F.em=de),Te===!0&&(F.strong=de);var Se=f(F);return ve===!1&&(F.em=!1),Te===!1&&(F.strong=!1),Se}}else if(de===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return f(F);M.backUp(1)}if(O.strikethrough){if(de==="~"&&M.eatWhile(de)){if(F.strikethrough){O.highlightFormatting&&(F.formatting="strikethrough");var Se=f(F);return F.strikethrough=!1,Se}else if(M.match(/^[^\s]/,!1))return F.strikethrough=!0,O.highlightFormatting&&(F.formatting="strikethrough"),f(F)}else if(de===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return f(F);M.backUp(2)}}if(O.emoji&&de===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,O.highlightFormatting&&(F.formatting="emoji");var Pe=f(F);return F.emoji=!1,Pe}return de===" "&&(M.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),f(F)}function o(M,F){var $=M.next();if($===">"){F.f=F.inline=u,O.highlightFormatting&&(F.formatting="link");var ie=f(F);return ie?ie+=" ":ie="",ie+K.linkInline}return M.match(/^[^>]+/,!0),K.linkInline}function E(M,F){if(M.eatSpace())return null;var $=M.next();return $==="("||$==="["?(F.f=F.inline=x($==="("?")":"]"),O.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,f(F)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(M){return function(F,$){var ie=F.next();if(ie===M){$.f=$.inline=u,O.highlightFormatting&&($.formatting="link-string");var de=f($);return $.linkHref=!1,de}return F.match(g[M]),$.linkHref=!0,f($)}}function I(M,F){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=j,M.next(),O.highlightFormatting&&(F.formatting="link"),F.linkText=!0,f(F)):l(M,F,u)}function j(M,F){if(M.match(/^\]:/,!0)){F.f=F.inline=G,O.highlightFormatting&&(F.formatting="link");var $=f(F);return F.linkText=!1,$}return M.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function G(M,F){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?F.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=u,K.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:u,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&ce.copyState(Z,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?ce.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,F){if(F.formatting=!1,M!=F.thisLine.stream){if(F.header=0,F.hr=!1,M.match(/^\s*$/,!0))return v(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:M},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=L)){var $=M.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(F.indentation=$,F.indentationDiff=null,$>0)return null}}return F.f(M,F)},innerMode:function(M){return M.block==L?{state:M.htmlState,mode:Z}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,F,$){return M.block==L&&Z.indent?Z.indent(M.htmlState,F,$):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,F,$):ce.Pass},blankLine:v,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ce.defineMIME("text/markdown","markdown"),ce.defineMIME("text/x-markdown","markdown")})},osHv:function(nt,ze,oe){(function(ce){ce(oe("VrN/"))})(function(ce){"use strict";var J=ce.Pos;function O(h,a){return h.line-a.line||h.ch-a.ch}var Z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",D=new RegExp("<(/?)(["+Z+"]["+U+"]*)","g");function K(h,a,l,d){this.line=a,this.ch=l,this.cm=h,this.text=h.getLine(a),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function H(h,a){var l=h.cm.getTokenTypeAt(J(h.line,a));return l&&/\btag\b/.test(l)}function N(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function R(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function b(h){for(;;){var a=h.text.indexOf(">",h.ch);if(a==-1){if(N(h))continue;return}if(!H(h,a+1)){h.ch=a+1;continue}var l=h.text.lastIndexOf("/",a),d=l>-1&&!/\S/.test(h.text.slice(l+1,a));return h.ch=a+1,d?"selfClose":"regular"}}function _(h){for(;;){var a=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(a==-1){if(R(h))continue;return}if(!H(h,a+1)){h.ch=a;continue}D.lastIndex=a,h.ch=a;var l=D.exec(h.text);if(l&&l.index==a)return l}}function P(h){for(;;){D.lastIndex=h.ch;var a=D.exec(h.text);if(!a){if(N(h))continue;return}if(!H(h,a.index+1)){h.ch=a.index+1;continue}return h.ch=a.index+a[0].length,a}}function A(h){for(;;){var a=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(a==-1){if(R(h))continue;return}if(!H(h,a+1)){h.ch=a;continue}var l=h.text.lastIndexOf("/",a),d=l>-1&&!/\S/.test(h.text.slice(l+1,a));return h.ch=a+1,d?"selfClose":"regular"}}function S(h,a){for(var l=[];;){var d=P(h),w,v=h.line,m=h.ch-(d?d[0].length:0);if(!d||!(w=b(h)))return;if(w=="selfClose")continue;if(d[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==d[2]){l.length=L;break}if(L<0&&(!a||a==d[2]))return{tag:d[2],from:J(v,m),to:J(h.line,h.ch)}}else l.push(d[2])}}function C(h,a){for(var l=[];;){var d=A(h);if(!d)return;if(d=="selfClose"){_(h);continue}var w=h.line,v=h.ch,m=_(h);if(!m)return;if(m[1])l.push(m[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==m[2]){l.length=L;break}if(L<0&&(!a||a==m[2]))return{tag:m[2],from:J(h.line,h.ch),to:J(w,v)}}}}ce.registerHelper("fold","xml",function(h,a){for(var l=new K(h,a.line,0);;){var d=P(l);if(!d||l.line!=a.line)return;var w=b(l);if(!w)return;if(!d[1]&&w!="selfClose"){var v=J(l.line,l.ch),m=S(l,d[2]);return m&&O(m.from,v)>0?{from:v,to:m.from}:null}}}),ce.findMatchingTag=function(h,a,l){var d=new K(h,a.line,a.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=b(d),v=w&&J(d.line,d.ch),m=w&&_(d);if(!w||!m||O(d,a)>0)return;var L={from:J(d.line,d.ch),to:v,tag:m[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:m[1]?{open:C(d,m[2]),close:L,at:"close"}:(d=new K(h,v.line,v.ch,l),{open:L,close:S(d,m[2]),at:"open"})},ce.findEnclosingTag=function(h,a,l,d){for(var w=new K(h,a.line,a.ch,l);;){var v=C(w,d);if(!v)break;var m=new K(h,a.line,a.ch,l),L=S(m,v.tag);if(L)return{open:v,close:L}}},ce.scanForClosingTag=function(h,a,l,d){var w=new K(h,a.line,a.ch,d?{from:0,to:d}:null);return S(w,l)}})},p5ED:function(nt,ze,oe){"use strict";var ce=oe("+L6B"),J=oe("2/Rp"),O=oe("5Dmo"),Z=oe("3S7+"),U=oe("k1fw"),D=oe("9og8"),K=oe("tJVT"),H=oe("WmNS"),N=oe.n(H),R=oe("q1tI"),b=oe.n(R),_=oe("vHTk"),P=oe.n(_),A=oe("yEEn"),S=oe("ZW9T"),C=oe("1vsH"),h=oe("V0Rq"),a=oe("m3rI");ze.a=function(l){var d,w,v,m,L,y,f,p=l.editOffice,u=p===void 0?"view":p,o=l.data,E=l.theme,g=l.type,x=l.filename,I=l.monacoEditor,j=l.className,G=l.style,V=l.close,M=l.onClose,F=l.hasMask,$=l.disabledDownload,ie=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),de=Object(K.a)(ie,2),ge=de[0],Le=de[1],Ee=Object(R.useState)(""),_e=Object(K.a)(Ee,2),Se=_e[0],xe=_e[1],me=Object(R.useState)(),z=Object(K.a)(me,2),s=z[0],c=z[1],k=window.ENV==="build"?"/react/build":"",X=a.a.PROXY_SERVER||location.origin,B,se=1024*1024,ve=10*se,Te=Object(R.useRef)();(d=o)!==null&&d!==void 0&&d.startsWith("/api")&&g!=="txt"&&(o=(a.a.API_SERVER||location.origin)+o),g==="office"&&(B=Object(C.T)(o).filesize,B>ve&&(g="other")),x&&I&&(I.filename=x),Object(R.useEffect)(function(){var ke,Fe,je=(ke=document.cookie)===null||ke===void 0||((Fe=ke.replace(/\s/g,""))===null||Fe===void 0)?void 0:Fe.split(";");je==null||je.map(function(Be){var Ie=Be.split("=");Ie[0]==="_educoder_session"&&xe(Ie[1])})},[]),Object(R.useEffect)(function(){g==="office"&&Pe()},[g,o]);var Pe=function(){var ke=Object(D.a)(N.a.mark(function Fe(){var je,Be,Ie;return N.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return console.log("data:",o),je=o,o.startsWith("http")||(je=location.origin+je),Be=new URL(je).pathname.split("/").pop(),He.next=6,Object(h.V)({attachment_id:Be});case 6:Ie=He.sent,c(Ie);case 8:case"end":return He.stop()}},Fe)}));return function(){return ke.apply(this,arguments)}}(),Ae=function(){if(o.startsWith("http")||o.startsWith("blob:")){De();return}Object(C.z)(x||"educoder",o,x)},De=function(){Object(C.x)(x||"educoder",decodeURIComponent(o))};return b.a.createElement("div",{style:Object(U.a)({},G||{}),className:"".concat(F&&P.a.bgBlack," ").concat(g?P.a.wrp:"hide")},V&&b.a.createElement("div",{className:P.a.close,ref:Te},!$&&b.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Te.current}},b.a.createElement("span",{onClick:De},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Te.current}},b.a.createElement("span",{className:"",onClick:M},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(P.a[j]," ").concat(j," ").concat(P.a.monaco," ").concat(g==="txt"?"show":"hide")},g==="txt"&&b.a.createElement(S.b,I)),g==="audio"&&b.a.createElement("audio",{src:"".concat(((w=o)===null||w===void 0?void 0:w.indexOf("http://"))>-1||((v=o)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(o),autoPlay:!0}),g==="video"&&b.a.createElement(b.a.Fragment,null,((m=o)===null||m===void 0?void 0:m.indexOf("http"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(o),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(o),autoPlay:!0})),g==="office"&&s&&b.a.createElement("iframe",{src:"".concat(k,"/office.html?key=").concat(s.key,"&url=").concat(X+s.url,"&callbackUrl=").concat(X+s.callbackUrl,"&fileType=").concat(s.fileType,"&title=").concat(s.title,"&model=").concat(u,"&officeServer=").concat(a.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),g==="html"&&b.a.createElement("iframe",{src:o+"&disposition=inline"}),g==="pdf"&&b.a.createElement("iframe",{src:"".concat(k,"/js/pdfview/index.html?url=").concat(o,"&disabledDownload=").concat(!!$)}),g==="image"&&b.a.createElement("img",{src:"".concat(((L=o)===null||L===void 0?void 0:L.indexOf("http://"))>-1||((y=o)===null||y===void 0?void 0:y.indexOf("https://"))>-1||(f=o)!==null&&f!==void 0&&f.startsWith("/api")?"":"data:image/png;base64,").concat(o)}),g==="other"&&b.a.createElement("div",null,b.a.createElement(J.a,{type:"primary",size:"large",onClick:Ae},b.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),g==="download"&&b.a.createElement(J.a,{type:"primary",size:"large",onClick:Ae},b.a.createElement(A.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(nt,ze,oe){},rUJ1:function(nt,ze){const oe=/[&<>"']/,ce=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=y=>Z[y];function D(y,f){if(f){if(oe.test(y))return y.replace(ce,U)}else if(J.test(y))return y.replace(O,U);return y}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(y){return y.replace(K,(f,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const N=/(^|[^\[])\^/g;function R(y,f){y=y.source||y,f=f||"";const p={replace:(u,o)=>(o=o.source||o,o=o.replace(N,"$1"),y=y.replace(u,o),p),getRegex:()=>new RegExp(y,f)};return p}const b=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(y,f,p){if(y){let u;try{u=decodeURIComponent(H(p)).replace(b,"").toLowerCase()}catch(o){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}f&&!_.test(p)&&(p=a(f,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(u){return null}return p}const A={},S=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(y,f){A[" "+y]||(S.test(y)?A[" "+y]=y+"/":A[" "+y]=v(y,"/",!0)),y=A[" "+y];const p=y.indexOf(":")===-1;return f.substring(0,2)==="//"?p?f:y.replace(C,"$1")+f:f.charAt(0)==="/"?p?f:y.replace(h,"$1")+f:y+f}const l={exec:function(){}};function d(y){let f=1,p,u;for(;f<arguments.length;f++){p=arguments[f];for(u in p)Object.prototype.hasOwnProperty.call(p,u)&&(y[u]=p[u])}return y}function w(y,f){const p=y.replace(/\|/g,(E,g,x)=>{let I=!1,j=g;for(;--j>=0&&x[j]==="\\";)I=!I;return I?"|":" |"}),u=p.split(/ \|/);let o=0;if(u.length>f)u.splice(f);else for(;u.length<f;)u.push("");for(;o<u.length;o++)u[o]=u[o].trim().replace(/\\\|/g,"|");return u}function v(y,f,p){const u=y.length;if(u===0)return"";let o=0;for(;o<u;){const E=y.charAt(u-o-1);if(E===f&&!p)o++;else if(E!==f&&p)o++;else break}return y.substr(0,u-o)}function m(y,f){if(y.indexOf(f[1])===-1)return-1;const p=y.length;let u=0,o=0;for(;o<p;o++)if(y[o]==="\\")o++;else if(y[o]===f[0])u++;else if(y[o]===f[1]&&(u--,u<0))return o;return-1}function L(y){y&&y.sanitize&&!y.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")}nt.exports={escape:D,unescape:H,edit:R,cleanUrl:P,resolveUrl:a,noopTest:l,merge:d,splitCells:w,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:L}},ttuQ:function(nt,ze,oe){nt.exports={bg:"bg___3F6Km",name:"name___1NsJT",member:"member___2pzzt"}},ulZh:function(nt,ze,oe){typeof window!="undefined"&&function(J,O){nt.exports=O()}(this,function(){return function(ce){var J={};function O(Z){if(J[Z])return J[Z].exports;var U=J[Z]={i:Z,l:!1,exports:{}};return ce[Z].call(U.exports,U,U.exports,O),U.l=!0,U.exports}return O.m=ce,O.c=J,O.d=function(Z,U,D){O.o(Z,U)||Object.defineProperty(Z,U,{enumerable:!0,get:D})},O.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},O.t=function(Z,U){if(U&1&&(Z=O(Z)),U&8)return Z;if(U&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var D=Object.create(null);if(O.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:Z}),U&2&&typeof Z!="string")for(var K in Z)O.d(D,K,function(H){return Z[H]}.bind(null,K));return D},O.n=function(Z){var U=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return O.d(U,"a",U),U},O.o=function(Z,U){return Object.prototype.hasOwnProperty.call(Z,U)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,J,O){"use strict";var Z=Object.prototype.hasOwnProperty,U="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(U=!1));function K(b,_,P){this.fn=b,this.context=_,this.once=P||!1}function H(b,_,P,A,S){if(typeof P!="function")throw new TypeError("The listener must be a function");var C=new K(P,A||b,S),h=U?U+_:_;return b._events[h]?b._events[h].fn?b._events[h]=[b._events[h],C]:b._events[h].push(C):(b._events[h]=C,b._eventsCount++),b}function N(b,_){--b._eventsCount===0?b._events=new D:delete b._events[_]}function R(){this._events=new D,this._eventsCount=0}R.prototype.eventNames=function(){var _=[],P,A;if(this._eventsCount===0)return _;for(A in P=this._events)Z.call(P,A)&&_.push(U?A.slice(1):A);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(P)):_},R.prototype.listeners=function(_){var P=U?U+_:_,A=this._events[P];if(!A)return[];if(A.fn)return[A.fn];for(var S=0,C=A.length,h=new Array(C);S<C;S++)h[S]=A[S].fn;return h},R.prototype.listenerCount=function(_){var P=U?U+_:_,A=this._events[P];return A?A.fn?1:A.length:0},R.prototype.emit=function(_,P,A,S,C,h){var a=U?U+_:_;if(!this._events[a])return!1;var l=this._events[a],d=arguments.length,w,v;if(l.fn){l.once&&this.removeListener(_,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,P),!0;case 3:return l.fn.call(l.context,P,A),!0;case 4:return l.fn.call(l.context,P,A,S),!0;case 5:return l.fn.call(l.context,P,A,S,C),!0;case 6:return l.fn.call(l.context,P,A,S,C,h),!0}for(v=1,w=new Array(d-1);v<d;v++)w[v-1]=arguments[v];l.fn.apply(l.context,w)}else{var m=l.length,L;for(v=0;v<m;v++){l[v].once&&this.removeListener(_,l[v].fn,void 0,!0);switch(d){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,P);break;case 3:l[v].fn.call(l[v].context,P,A);break;case 4:l[v].fn.call(l[v].context,P,A,S);break;default:if(!w)for(L=1,w=new Array(d-1);L<d;L++)w[L-1]=arguments[L];l[v].fn.apply(l[v].context,w)}}}return!0},R.prototype.on=function(_,P,A){return H(this,_,P,A,!1)},R.prototype.once=function(_,P,A){return H(this,_,P,A,!0)},R.prototype.removeListener=function(_,P,A,S){var C=U?U+_:_;if(!this._events[C])return this;if(!P)return N(this,C),this;var h=this._events[C];if(h.fn)h.fn===P&&(!S||h.once)&&(!A||h.context===A)&&N(this,C);else{for(var a=0,l=[],d=h.length;a<d;a++)(h[a].fn!==P||S&&!h[a].once||A&&h[a].context!==A)&&l.push(h[a]);l.length?this._events[C]=l.length===1?l[0]:l:N(this,C)}return this},R.prototype.removeAllListeners=function(_){var P;return _?(P=U?U+_:_,this._events[P]&&N(this,P)):(this._events=new D,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=U,R.EventEmitter=R,ce.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,J,O){(function(Z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,N={buildAbsoluteURL:function(R,b,_){if(_=_||{},R=R.trim(),b=b.trim(),!b){if(!_.alwaysNormalize)return R;var P=N.parseURL(R);if(!P)throw new Error("Error trying to parse base URL.");return P.path=N.normalizePath(P.path),N.buildURLFromParts(P)}var A=N.parseURL(b);if(!A)throw new Error("Error trying to parse relative URL.");if(A.scheme)return _.alwaysNormalize?(A.path=N.normalizePath(A.path),N.buildURLFromParts(A)):b;var S=N.parseURL(R);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var C=D.exec(S.path);S.netLoc=C[1],S.path=C[2]}S.netLoc&&!S.path&&(S.path="/");var h={scheme:S.scheme,netLoc:A.netLoc,path:null,params:A.params,query:A.query,fragment:A.fragment};if(!A.netLoc&&(h.netLoc=S.netLoc,A.path[0]!=="/"))if(!A.path)h.path=S.path,A.params||(h.params=S.params,A.query||(h.query=S.query));else{var a=S.path,l=a.substring(0,a.lastIndexOf("/")+1)+A.path;h.path=N.normalizePath(l)}return h.path===null&&(h.path=_.alwaysNormalize?N.normalizePath(A.path):A.path),N.buildURLFromParts(h)},parseURL:function(R){var b=U.exec(R);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(K,"");R.length!==(R=R.replace(H,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ce.exports=N})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,J,O){function Z(_){var P={};function A(C){if(P[C])return P[C].exports;var h=P[C]={i:C,l:!1,exports:{}};return _[C].call(h.exports,h,h.exports,A),h.l=!0,h.exports}A.m=_,A.c=P,A.i=function(C){return C},A.d=function(C,h,a){A.o(C,h)||Object.defineProperty(C,h,{configurable:!1,enumerable:!0,get:a})},A.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},A.n=function(C){var h=C&&C.__esModule?function(){return C.default}:function(){return C};return A.d(h,"a",h),h},A.o=function(C,h){return Object.prototype.hasOwnProperty.call(C,h)},A.p="/",A.oe=function(C){throw console.error(C),C};var S=A(A.s=ENTRY_MODULE);return S.default||S}var U="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function K(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(_){return!isNaN(1*_)}function N(_,P,A){var S={};S[A]=[];var C=P.toString(),h=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return S;for(var a=h[1],l=new RegExp("(\\\\n|\\W)"+K(a)+D,"g"),d;d=l.exec(C);){if(d[3]==="dll-reference")continue;S[A].push(d[3])}for(l=new RegExp("\\("+K(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+D,"g");d=l.exec(C);)_[d[2]]||(S[A].push(d[1]),_[d[2]]=O(d[1]).m),S[d[2]]=S[d[2]]||[],S[d[2]].push(d[4]);for(var w=Object.keys(S),v=0;v<w.length;v++)for(var m=0;m<S[w[v]].length;m++)H(S[w[v]][m])&&(S[w[v]][m]=1*S[w[v]][m]);return S}function R(_){var P=Object.keys(_);return P.reduce(function(A,S){return A||_[S].length>0},!1)}function b(_,P){for(var A={main:[P]},S={main:[]},C={main:{}};R(A);)for(var h=Object.keys(A),a=0;a<h.length;a++){var l=h[a],d=A[l],w=d.pop();if(C[l]=C[l]||{},C[l][w]||!_[l][w])continue;C[l][w]=!0,S[l]=S[l]||[],S[l].push(w);for(var v=N(_,_[l][w],l),m=Object.keys(v),L=0;L<m.length;L++)A[m[L]]=A[m[L]]||[],A[m[L]]=A[m[L]].concat(v[m[L]])}return S}ce.exports=function(_,P){P=P||{};var A={main:O.m},S=P.all?{main:Object.keys(A.main)}:b(A,_),C="";Object.keys(S).filter(function(w){return w!=="main"}).forEach(function(w){for(var v=0;S[w][v];)v++;S[w].push(v),A[w][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+w+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+S[w].map(function(m){return""+JSON.stringify(m)+": "+A[w][m].toString()}).join(",")+`});
`}),C=C+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+S.main.map(function(w){return""+JSON.stringify(w)+": "+A.main[w].toString()}).join(",")+"}))(self);";var h=new window.Blob([C],{type:"text/javascript"});if(P.bare)return h;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(h),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"hlsDefaultConfig",function(){return L}),O.d(J,"mergeConfig",function(){return f}),O.d(J,"enableStreamingMode",function(){return p});var Z=O("./src/controller/abr-controller.ts"),U=O("./src/controller/audio-stream-controller.ts"),D=O("./src/controller/audio-track-controller.ts"),K=O("./src/controller/subtitle-stream-controller.ts"),H=O("./src/controller/subtitle-track-controller.ts"),N=O("./src/controller/buffer-controller.ts"),R=O("./src/controller/timeline-controller.ts"),b=O("./src/controller/cap-level-controller.ts"),_=O("./src/controller/fps-controller.ts"),P=O("./src/controller/eme-controller.ts"),A=O("./src/controller/cmcd-controller.ts"),S=O("./src/utils/xhr-loader.ts"),C=O("./src/utils/fetch-loader.ts"),h=O("./src/utils/cues.ts"),a=O("./src/utils/mediakeys-helper.ts"),l=O("./src/utils/logger.ts");function d(){return d=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var E=arguments[o];for(var g in E)Object.prototype.hasOwnProperty.call(E,g)&&(u[g]=E[g])}return u},d.apply(this,arguments)}function w(u,o){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(u);o&&(g=g.filter(function(x){return Object.getOwnPropertyDescriptor(u,x).enumerable})),E.push.apply(E,g)}return E}function v(u){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?w(Object(E),!0).forEach(function(g){m(u,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):w(Object(E)).forEach(function(g){Object.defineProperty(u,g,Object.getOwnPropertyDescriptor(E,g))})}return u}function m(u,o,E){return o in u?Object.defineProperty(u,o,{value:E,enumerable:!0,configurable:!0,writable:!0}):u[o]=E,u}var L=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:N.default,capLevelController:b.default,fpsController:_.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},y()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:H.default,timelineController:R.TimelineController,audioStreamController:U.default,audioTrackController:D.default,emeController:P.default,cmcdController:A.default});function y(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(u,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 d({},u,o)}function p(u){var o=u.loader;if(o!==C.default&&o!==S.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var E=Object(C.fetchSupported)();E&&(u.loader=C.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/ewma-bandwidth-estimator.ts"),D=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),H=O("./src/errors.ts"),N=O("./src/types/loader.ts"),R=O("./src/utils/logger.ts");function b(A,S){for(var C=0;C<S.length;C++){var h=S[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function _(A,S,C){return S&&b(A.prototype,S),C&&b(A,C),A}var P=function(){function A(C){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=C;var h=C.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var S=A.prototype;return S.registerListeners=function(){var h=this.hls;h.on(D.Events.FRAG_LOADING,this.onFragLoading,this),h.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(D.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(D.Events.FRAG_LOADING,this.onFragLoading,this),h.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(D.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(h,a){var l=a.frag;if(l.type===N.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=a.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(h,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var h=this.fragCurrent,a=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,w=l.config,v=l.media;if(!h||!v)return;var m=a?a.stats:h.stats,L=a?a.duration:h.duration;if(m.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||v.paused||!v.playbackRate||!v.readyState)return;var y=performance.now()-m.loading.start,f=Math.abs(v.playbackRate);if(y<=500*L/f)return;var p=l.levels,u=l.minAutoLevel,o=p[h.level],E=m.total||Math.max(m.loaded,Math.round(L*o.maxBitrate/8)),g=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),x=(E-m.loaded)/g,I=v.currentTime,j=(K.BufferHelper.bufferInfo(v,I,w.maxBufferHole).end-I)/f;if(j>=2*L/f||x<=j)return;var G=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>u;V--){var M=p[V].maxBitrate;if(G=L*M/(8*.8*g),G<j)break}if(G>=x)return;var F=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+h.sn+(a?" part "+a.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+x.toFixed(3)+` s
Estimated load time for the next fragment: `+G.toFixed(3)+` s
Time to underbuffer: `+j.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(y,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:a,stats:m})},S.onFragLoaded=function(h,a){var l=a.frag,d=a.part;if(l.type===N.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var w=d?d.stats:l.stats,v=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[l.level],L=(m.loaded?m.loaded.bytes:0)+w.loaded,y=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:L,duration:y},m.realBitrate=Math.round(8*L/y)}if(l.bitrateTest){var f={stats:w,frag:l,part:d,id:l.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},S.onFragBuffered=function(h,a){var l=a.frag,d=a.part,w=d?d.stats:l.stats;if(w.aborted)return;if(l.type!==N.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=w.parsing.end-w.loading.start;this.bwEstimator.sample(v,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},S.onError=function(h,a){switch(a.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var h=this.fragCurrent,a=this.partCurrent,l=this.hls,d=l.maxAutoLevel,w=l.config,v=l.minAutoLevel,m=l.media,L=a?a.duration:h?h.duration:0,y=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,u=(K.BufferHelper.bufferInfo(m,y,w.maxBufferHole).end-y)/f,o=this.findBestLevel(p,v,d,u,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(o>=0)return o;R.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,g=w.abrBandWidthFactor,x=w.abrBandWidthUpFactor;if(!u){var I=this.bitrateTestDelay;if(I){var j=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;E=j-I,R.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),g=x=1}}return o=this.findBestLevel(p,v,d,u+E,g,x),Math.max(o,0)},S.findBestLevel=function(h,a,l,d,w,v){for(var m,L=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,p=this.hls.levels,u=p[f],o=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),E=u==null?void 0:u.codecSet,g=y?y.duration:L?L.duration:0,x=l;x>=a;x--){var I=p[x];if(!I||E&&I.codecSet!==E)continue;var j=I.details,G=(y?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||g,V=void 0;x<=f?V=w*h:V=v*h;var M=p[x].maxBitrate,F=M*G/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(V)+"/"+M+"/"+G+"/"+d+"/"+F),V>M&&(!F||o&&!this.bitrateTestDelay||F<d))return x}return-1},_(A,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,a=this.bwEstimator;if(h!==-1&&(!a||!a.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),A}();J.default=P},"./src/controller/audio-stream-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),D=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-tracker.ts"),N=O("./src/types/level.ts"),R=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),_=O("./src/demux/chunk-cache.ts"),P=O("./src/demux/transmuxer-interface.ts"),A=O("./src/types/transmuxer.ts"),S=O("./src/controller/fragment-finders.ts"),C=O("./src/utils/discontinuities.ts"),h=O("./src/errors.ts"),a=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(L[p]=f[p])}return L},l.apply(this,arguments)}function d(L,y){L.prototype=Object.create(y.prototype),L.prototype.constructor=L,w(L,y)}function w(L,y){return w=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},w(L,y)}var v=100,m=function(L){d(y,L);function y(p,u){var o;return o=L.call(this,p,u,"[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 f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var u=this.hls;u.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(D.Events.ERROR,this.onError,this),u.on(D.Events.BUFFER_RESET,this.onBufferReset,this),u.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var u=this.hls;u.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(D.Events.ERROR,this.onError,this),u.off(D.Events.BUFFER_RESET,this.onBufferReset,this),u.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(u,o){var E=o.frag,g=o.id,x=o.initPTS;if(g==="main"){var I=E.cc;this.initPTS[E.cc]=x,this.log("InitPTS for cc: "+I+" found from main: "+x),this.videoTrackCC=I,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=U.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,o>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},f.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var u,o=this.levels,E=this.trackId,g=o==null||((u=o[E])===null||u===void 0)?void 0:u.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var x,I=performance.now(),j=this.retryDate;(!j||I>=j||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var G=this.waitingData;if(G){var V=G.frag,M=G.part,F=G.cache,$=G.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ie=F.flush(),de={frag:V,part:M,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(de),$&&L.prototype._handleFragmentLoadComplete.call(this,de)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ge=this.getLoadPosition(),Le=K.BufferHelper.bufferInfo(this.mediaBuffer,ge,this.config.maxBufferHole),Ee=Object(S.fragmentWithinToleranceTest)(Le.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(a.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Le.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},f.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:u,E=o.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},f.doTickIdle=function(){var u,o,E=this.hls,g=this.levels,x=this.media,I=this.trackId,j=E.config;if(!g||!g[I])return;if(!x&&(this.startFragRequested||!j.startFragPrefetch))return;var G=g[I],V=G.details;if(!V||V.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(M===null)return;var F=M.len,$=this.getMaxBufferLength(),ie=this.audioSwitch;if(F>=$&&!ie)return;if(!ie&&this._streamEnded(M,V)){E.trigger(D.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var de=V.fragments,ge=de[0].start,Le=M.end;if(ie){var Ee=this.getLoadPosition();Le=Ee,V.PTSKnown&&Ee<ge&&((M.end>ge||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=ge+.05))}var _e=this.getNextFragment(Le,V);if(!_e){this.bufferFlushed=!0;return}((u=_e.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((o=_e.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(_e,V):this.loadFragment(_e,V,Le)},f.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return o===null?u:Math.max(u,o.len)},f.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(u,o){var E=o.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(g){return new N.Level(g)})},f.onAudioTrackSwitching=function(u,o){var E=!!o.url;this.trackId=o.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(v):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(u,o){this.mainDetails=o.details},f.onAudioTrackLoaded=function(u,o){var E,g=this.levels,x=o.details,I=o.id;if(!g){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var j=g[I],G=0;if(x.live||(E=j.details)!==null&&E!==void 0&&E.live){var V=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!V)return;!j.details&&x.hasProgramDateTime&&V.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(x,V),G=x.fragments[0].start):G=this.alignPlaylists(x,j.details)}j.details=x,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(j.details,G),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=U.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(u){var o,E=u.frag,g=u.part,x=u.payload,I=this.config,j=this.trackId,G=this.levels;if(!G){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var V=G[j];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var F=I.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new P.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[E.cc],de=(o=E.initSegment)===null||o===void 0?void 0:o.data;if(ie!==void 0){var ge=!1,Le=g?g.index:-1,Ee=Le!==-1,_e=new A.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,x.byteLength,Le,Ee);$.push(x,de,F,"",E,g,M.totalduration,ge,_e,ie)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+j);var Se=this.waitingData=this.waitingData||{frag:E,part:g,cache:new _.default,complete:!1},xe=Se.cache;xe.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(u,o){var E=o.tracks.audio;E&&(this.mediaBuffer=E.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},f.onFragBuffered=function(u,o){var E=o.frag,g=o.part;if(E.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(g?" p: "+g.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,g)},f.onError=function(u,o){switch(o.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,o);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var E=!0,g=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);g&&g.len>.5&&(E=!this.reduceMaxBufferLength(g.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(u,o){var E=o.type;E===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(u){var o,E="audio",g=this.hls,x=u.remuxResult,I=u.chunkMeta,j=this.getCurrentContext(I);if(!j){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var G=j.frag,V=j.part,M=x.audio,F=x.text,$=x.id3,ie=x.initSegment;if(this.fragContextChanged(G))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,G,I),g.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:E,tracks:ie.tracks})),M){var de=M.startPTS,ge=M.endPTS,Le=M.startDTS,Ee=M.endDTS;V&&(V.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:ge,startDTS:Le,endDTS:Ee}),G.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,de,ge,Le,Ee),this.bufferFragmentData(M,G,V,I)}if($!=null&&(o=$.samples)!==null&&o!==void 0&&o.length){var _e=l({frag:G,id:E},$);g.trigger(D.Events.FRAG_PARSING_METADATA,_e)}if(F){var Se=l({frag:G,id:E},F);g.trigger(D.Events.FRAG_PARSING_USERDATA,Se)}},f._bufferInitSegment=function(u,o,E){if(this.state!==U.State.PARSING)return;u.video&&delete u.video;var g=u.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(D.Events.BUFFER_CODECS,u);var x=g.initSegment;if(x!=null&&x.byteLength){var I={type:"audio",frag:o,part:null,chunkMeta:E,parent:o.type,data:x};this.hls.trigger(D.Events.BUFFER_APPENDING,I)}this.tick()},f.loadFragment=function(u,o,E){var g=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||g===H.FragmentState.NOT_LOADED||g===H.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):o.live&&!Object(Z.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,o,E)))},f.completeAudioSwitch=function(){var u=this.hls,o=this.media,E=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:E})},y}(U.default);J.default=m},"./src/controller/audio-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function H(P,A){for(var S=0;S<A.length;S++){var C=A[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(P,C.key,C)}}function N(P,A,S){return A&&H(P.prototype,A),S&&H(P,S),P}function R(P,A){P.prototype=Object.create(A.prototype),P.prototype.constructor=P,b(P,A)}function b(P,A){return b=Object.setPrototypeOf||function(C,h){return C.__proto__=h,C},b(P,A)}var _=function(P){R(A,P);function A(C){var h;return h=P.call(this,C,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var S=A.prototype;return S.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(h,a){this.tracks=a.audioTracks||[]},S.onAudioTrackLoaded=function(h,a){var l=a.id,d=a.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var v=w.details;w.details=a.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,v))},S.onLevelLoading=function(h,a){this.switchLevel(a.level)},S.onLevelSwitching=function(h,a){this.switchLevel(a.level)},S.switchLevel=function(h){var a=this.hls.levels[h];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!d.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},S.onError=function(h,a){if(P.prototype.onError.call(this,h,a),a.fatal||!a.context)return;a.context.type===K.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},S.setAudioTrack=function(h){var a=this.tracksInGroup;if(h<0||h>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+h);var d=a[h],w=d.id,v=d.groupId,m=v===void 0?"":v,L=d.name,y=d.type,f=d.url;if(this.trackId=h,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:m,name:L,type:y,url:f}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(p)},S.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(h){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var d=a[l];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},S.loadPlaylist=function(h){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,d=a.groupId,w=a.url;if(h)try{w=h.addDirectives(w)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:w,id:l,groupId:d,deliveryDirectives:h||null})}},N(A,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),A}(D.default);J.default=_},"./src/controller/base-playlist-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return N});var Z=O("./src/polyfills/number.ts"),U=O("./src/types/level.ts"),D=O("./src/controller/level-helper.ts"),K=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),N=function(){function R(_,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,P+":"),this.warn=K.logger.warn.bind(K.logger,P+":"),this.hls=_}var b=R.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(P,A){A.fatal&&A.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(P,A){var S=A==null?void 0:A.renditionReports;if(S)for(var C=0;C<S.length;C++){var h=S[C],a=""+h.URI;if(a===P.substr(-a.length)){var l=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(A&&this.hls.config.lowLatencyMode){var w=Math.min(A.age-A.partTarget,A.targetduration);d!==void 0&&w>A.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(Z.isFiniteNumber)(d)?d:void 0,U.HlsSkip.No)}}},b.loadPlaylist=function(P){},b.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},b.playlistLoaded=function(P,A,S){var C=this,h=A.details,a=A.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||S!=null&&S.live){if(h.reloaded(S),S&&this.log("live playlist "+P+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),S&&h.fragments.length>0&&Object(D.mergeDetails)(S,h),!this.canLoad||!h.live)return;var d,w=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,L=h.lastPartSn,y=h.endSN,f=h.lastPartIndex,p=f!==-1,u=L===y,o=m?0:f;p?(w=u?y+1:L,v=u?o:f+1):w=y+1;var E=h.age,g=E+h.ageHeader,x=Math.min(g-h.partTarget,h.targetduration*1.5);if(x>0){if(S&&x>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+x+" with playlist age: "+h.age),x=0;else{var I=Math.floor(x/h.targetduration);if(w+=I,v!==void 0){var j=Math.round(x%h.targetduration/h.partTarget);v+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+x+" skip sn "+I+" to part "+v)}h.tuneInGoal=x}if(d=this.getDeliveryDirectives(h,A.deliveryDirectives,w,v),m||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,A.deliveryDirectives,w,v);var G=Object(D.computeReloadInterval)(h,a);w!==void 0&&h.canBlockReload&&(G-=h.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(G)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(d)},G)}else this.clearTimer()},b.getDeliveryDirectives=function(P,A,S,C){var h=Object(U.getSkipValue)(P,S);return A!=null&&A.skip&&P.deltaUpdateFailed&&(S=A.msn,C=A.part,h=U.HlsSkip.No),new U.HlsUrlParameters(S,C,h)},b.retryLoadingOrFail=function(P){var A=this,S=this.hls.config,C=this.retryCount<S.levelLoadingMaxRetry;if(C){var h;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(h=P.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return A.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return C},R}()},"./src/controller/base-stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"State",function(){return y}),O.d(J,"default",function(){return f});var Z=O("./src/polyfills/number.ts"),U=O("./src/task-loop.ts"),D=O("./src/controller/fragment-tracker.ts"),K=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts"),N=O("./src/events.ts"),R=O("./src/errors.ts"),b=O("./src/types/transmuxer.ts"),_=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/discontinuities.ts"),A=O("./src/controller/fragment-finders.ts"),S=O("./src/controller/level-helper.ts"),C=O("./src/loader/fragment-loader.ts"),h=O("./src/crypt/decrypter.ts"),a=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function d(p,u){for(var o=0;o<u.length;o++){var E=u[o];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(p,E.key,E)}}function w(p,u,o){return u&&d(p.prototype,u),o&&d(p,o),p}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function m(p,u){p.prototype=Object.create(u.prototype),p.prototype.constructor=p,L(p,u)}function L(p,u){return L=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},L(p,u)}var y={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"},f=function(p){m(u,p);function u(E,g,x){var I;return I=p.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=y.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=x,I.log=H.logger.log.bind(H.logger,x+":"),I.warn=H.logger.warn.bind(H.logger,x+":"),I.hls=E,I.fragmentLoader=new C.default(E.config),I.fragmentTracker=g,I.config=E.config,I.decrypter=new h.default(E,E.config),E.on(N.Events.KEY_LOADED,I.onKeyLoaded,v(I)),I}var o=u.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(g){},o.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},o._streamEnded=function(g,x){var I=this.fragCurrent,j=this.fragmentTracker;if(!x.live&&I&&I.sn===x.endSN&&!g.nextStart){var G=j.getState(I);return G===D.FragmentState.PARTIAL||G===D.FragmentState.OK}return!1},o.onMediaAttached=function(g,x){var I=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(j.startPosition)},o.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.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 g=this.config,x=this.fragCurrent,I=this.media,j=this.mediaBuffer,G=this.state,V=I?I.currentTime:0,M=K.BufferHelper.bufferInfo(j||I,V,g.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+G),G===y.ENDED)this.resetLoadingState();else if(x&&!M.len){var F=g.maxFragLookUpTolerance,$=x.start-F,ie=x.start+x.duration+F,de=V>ie;(V<$||de)&&(de&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(g,x){if(this.state!==y.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var I=this.levels[x.frag.level].details;I&&this.loadFragment(x.frag,I,x.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(N.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,p.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(g,x){this.log("Loading key for "+g.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=y.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(N.Events.KEY_LOADING,{frag:g})},o.loadFragment=function(g,x,I){this._loadFragForPlayback(g,x,I)},o._loadFragForPlayback=function(g,x,I){var j=this,G=function(M){if(j.fragContextChanged(g)){j.warn("Fragment "+g.sn+(M.part?" p: "+M.part.index:"")+" of level "+g.level+" was dropped during download."),j.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,j._handleFragmentLoadProgress(M)};this._doFragLoad(g,x,I,G).then(function(V){if(!V)return;j.fragLoadError=0;var M=j.state;if(j.fragContextChanged(g)){(M===y.FRAG_LOADING||M===y.BACKTRACKING||!j.fragCurrent&&M===y.PARSING)&&(j.fragmentTracker.removeFragment(g),j.state=y.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+g.sn+" of level "+g.level),j.hls.trigger(N.Events.FRAG_LOADED,V),j.state===y.BACKTRACKING)){j.fragmentTracker.backtrack(g,V),j.resetFragmentLoading(g);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(g)})},o.flushMainBuffer=function(g,x,I){if(I===void 0&&(I=null),!(g-x))return;var j={startOffset:g,endOffset:x,type:I};this.fragLoadError=0,this.hls.trigger(N.Events.BUFFER_FLUSHING,j)},o._loadInitSegment=function(g){var x=this;this._doFragLoad(g).then(function(I){if(!I||x.fragContextChanged(g)||!x.levels)throw new Error("init load aborted");return I}).then(function(I){var j=x.hls,G=I.payload,V=g.decryptdata;if(G&&G.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(G),V.key.buffer,V.iv.buffer).then(function(F){var $=self.performance.now();return j.trigger(N.Events.FRAG_DECRYPTED,{frag:g,payload:F,stats:{tstart:M,tdecrypt:$}}),I.payload=F,I})}return I}).then(function(I){var j=x.fragCurrent,G=x.hls,V=x.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[g.level].details;console.assert(M,"Level details are defined when init segment is loaded");var F=g.stats;x.state=y.IDLE,x.fragLoadError=0,g.data=new Uint8Array(I.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),I.frag===j&&G.trigger(N.Events.FRAG_BUFFERED,{stats:F,frag:j,part:null,id:g.type}),x.tick()}).catch(function(I){x.warn(I),x.resetFragmentLoading(g)})},o.fragContextChanged=function(g){var x=this.fragCurrent;return!g||!x||g.level!==x.level||g.sn!==x.sn||g.urlId!==x.urlId},o.fragBufferedComplete=function(g,x){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+a.default.toString(K.BufferHelper.getBuffered(I))),this.state=y.IDLE,this.tick()},o._handleFragmentLoadComplete=function(g){var x=this.transmuxer;if(!x)return;var I=g.frag,j=g.part,G=g.partsLoaded,V=!G||G.length===0||G.some(function(F){return!F}),M=new b.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,j?j.index:-1,!V);x.flush(M)},o._handleFragmentLoadProgress=function(g){},o._doFragLoad=function(g,x,I,j){var G=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(g.start,I||0),this.config.lowLatencyMode&&x){var V=x.partList;if(V&&j){I>g.end&&x.fragmentHint&&(g=x.fragmentHint);var M=this.getNextPart(V,g,I);if(M>-1){var F=V[M];return this.log("Loading part sn: "+g.sn+" p: "+F.index+" cc: "+g.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=y.FRAG_LOADING,this.hls.trigger(N.Events.FRAG_LOADING,{frag:g,part:V[M],targetBufferTime:I}),this.doFragPartsLoad(g,V,M,j).catch(function($){return G.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(V,I))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(I.toFixed(3))),Object(Z.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=y.FRAG_LOADING,this.hls.trigger(N.Events.FRAG_LOADING,{frag:g,targetBufferTime:I}),this.fragmentLoader.load(g,j).catch(function($){return G.handleFragLoadError($)})},o.doFragPartsLoad=function(g,x,I,j){var G=this;return new Promise(function(V,M){var F=[],$=function ie(de){var ge=x[de];G.fragmentLoader.loadPart(g,ge,j).then(function(Le){F[ge.index]=Le;var Ee=Le.part;G.hls.trigger(N.Events.FRAG_LOADED,Le);var _e=x[de+1];if(_e&&_e.fragment===g)ie(de+1);else return V({frag:g,part:Ee,partsLoaded:F})}).catch(M)};$(I)})},o.handleFragLoadError=function(g){var x=g.data;return x&&x.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(N.Events.ERROR,x),null},o._handleTransmuxerFlush=function(g){var x=this.getCurrentContext(g);if(!x||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var I=x.frag,j=x.part,G=x.level,V=self.performance.now();I.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(I,j,G,g.partial)},o.getCurrentContext=function(g){var x=this.levels,I=g.level,j=g.sn,G=g.part;if(!x||!x[I])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+I+". The current chunk will not be buffered."),null;var V=x[I],M=G>-1?Object(S.getPartWith)(V,j,G):null,F=M?M.fragment:Object(S.getFragmentWithSN)(V,j,this.fragCurrent);return F?{frag:F,part:M,level:V}:null},o.bufferFragmentData=function(g,x,I,j){if(!g||this.state!==y.PARSING)return;var G=g.data1,V=g.data2,M=G;if(G&&V&&(M=Object(_.appendUint8Array)(G,V)),!M||!M.length)return;var F={type:g.type,frag:x,part:I,chunkMeta:j,parent:x.type,data:M};this.hls.trigger(N.Events.BUFFER_APPENDING,F),g.dropped&&g.independent&&!I&&this.flushBufferGap(x)},o.flushBufferGap=function(g){var x=this.media;if(!x)return;if(!K.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,g.start);return}var I=x.currentTime,j=K.BufferHelper.bufferInfo(x,I,0),G=g.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,G*.25),M=Math.max(Math.min(g.start-V,j.end-V),I+V);g.start-M>V&&this.flushMainBuffer(M,g.start)},o.getFwdBufferInfo=function(g,x){var I=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var G=K.BufferHelper.bufferInfo(g,j,I.maxBufferHole);if(G.len===0&&G.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,x);if(V&&G.nextStart<V.end)return K.BufferHelper.bufferInfo(g,j,Math.max(G.nextStart,I.maxBufferHole))}return G},o.getMaxBufferLength=function(g){var x=this.config,I;return g?I=Math.max(8*x.maxBufferSize/g,x.maxBufferLength):I=x.maxBufferLength,Math.min(I,x.maxMaxBufferLength)},o.reduceMaxBufferLength=function(g){var x=this.config,I=g||x.maxBufferLength;return x.maxMaxBufferLength>=I?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(g,x){var I,j,G=x.fragments,V=G.length;if(!V)return null;var M=this.config,F=G[0].start,$;if(x.live){var ie=M.initialLiveManifestSize;if(V<ie)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ie+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(x,G),this.startPosition=$?this.hls.liveSyncPosition||$.start:g)}else g<=F&&($=G[0]);if(!$){var de=M.lowLatencyMode?x.partEnd:x.fragmentEnd;$=this.getFragmentAtPosition(g,de,x)}return(I=$)!==null&&I!==void 0&&I.initSegment&&!((j=$)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},o.getNextPart=function(g,x,I){for(var j=-1,G=!1,V=!0,M=0,F=g.length;M<F;M++){var $=g[M];if(V=V&&!$.independent,j>-1&&I<$.start)break;var ie=$.loaded;!ie&&(G||$.independent||V)&&$.fragment===x&&(j=M),G=ie}return j},o.loadedEndOfParts=function(g,x){var I=g[g.length-1];return I&&x>I.start&&I.loaded},o.getInitialLiveFragment=function(g,x){var I=this.fragPrevious,j=null;if(I){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),j=Object(A.findFragmentByPDT)(x,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var G=I.sn+1;if(G>=g.startSN&&G<=g.endSN){var V=x[G-g.startSN];I.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(A.findFragWithCC)(x,I.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(j=this.getFragmentAtPosition(M,this.bitrateTest?g.fragmentEnd:g.edge,g))}return j},o.getFragmentAtPosition=function(g,x,I){var j=this.config,G=this.fragPrevious,V=I.fragments,M=I.endSN,F=I.fragmentHint,$=j.maxFragLookUpTolerance,ie=!!(j.lowLatencyMode&&I.partList&&F);ie&&F&&!this.bitrateTest&&(V=V.concat(F),M=F.sn);var de;if(g<x){var ge=g>x-$?0:$;de=Object(A.findFragmentByPTS)(G,V,g,ge)}else de=V[V.length-1];if(de){var Le=de.sn-I.startSN,Ee=G&&de.level===G.level,_e=V[Le+1],Se=this.fragmentTracker.getState(de);if(Se===D.FragmentState.BACKTRACKED){de=null;for(var xe=Le;V[xe]&&this.fragmentTracker.getState(V[xe])===D.FragmentState.BACKTRACKED;)G?de=V[xe--]:de=V[--xe];de||(de=_e)}else G&&de.sn===G.sn&&!ie&&(Ee&&(de.sn<M&&this.fragmentTracker.getState(_e)!==D.FragmentState.OK?(this.log("SN "+de.sn+" just loaded, load next one: "+_e.sn),de=_e):de=null))}return de},o.synchronizeToLiveEdge=function(g){var x=this.config,I=this.media;if(!I)return;var j=this.hls.liveSyncPosition,G=I.currentTime,V=g.fragments[0].start,M=g.edge,F=G>=V-x.maxFragLookUpTolerance&&G<=M;if(j!==null&&I.duration>j&&(G<j||!F)){var $=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*g.targetduration;(!F&&I.readyState<4||G<M-$)&&(this.loadedmetadata||(this.nextLoadPosition=j),I.readyState&&(this.warn("Playback: "+G.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+j.toFixed(3)),I.currentTime=j))}},o.alignPlaylists=function(g,x){var I=this.levels,j=this.levelLastLoaded,G=this.fragPrevious,V=j!==null?I[j]:null,M=g.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var F=g.fragments[0].start,$=!x,ie=g.alignedSliding&&Object(Z.isFiniteNumber)(F);if($||!ie&&!F){Object(P.alignStream)(G,V,g);var de=g.fragments[0].start;return this.log("Live playlist sliding: "+de.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+g.startSN+" prev-sn: "+(G?G.sn:"na")+" fragments: "+M),de}return F},o.waitForCdnTuneIn=function(g){var x=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*x)},o.setStartPosition=function(g,x){var I=this.startPosition;if(I<x&&(I=-1),I===-1||this.lastCurrentTime===-1){var j=g.startTimeOffset;Object(Z.isFiniteNumber)(j)?(I=x+j,j<0&&(I+=g.totalduration),I=Math.min(Math.max(x,I),x+g.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+I),this.startPosition=I):g.live?I=this.hls.liveSyncPosition||x:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},o.getLoadPosition=function(){var g=this.media,x=0;return this.loadedmetadata&&g?x=g.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},o.handleFragLoadAborted=function(g,x){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(x?" part"+x.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},o.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=y.IDLE)},o.onFragmentOrKeyLoadError=function(g,x){if(x.fatal)return;var I=x.frag;if(!I||I.type!==g)return;var j=this.fragCurrent;console.assert(j&&I.sn===j.sn&&I.level===j.level&&I.urlId===j.urlId,"Frag load error must match current frag to retry");var G=this.config;if(this.fragLoadError+1<=G.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*G.fragLoadingRetryDelay,G.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+g+" "+I.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(g===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(H.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},o.afterBufferFlushed=function(g,x,I){if(!g)return;var j=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(x,j,I),this.state===y.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},o.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[g].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(g,x,I,j){var G=this,V=I.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(g.elementaryStreams).reduce(function(F,$){var ie=g.elementaryStreams[$];if(ie){var de=ie.endPTS-ie.startPTS;if(de<=0)return G.warn("Could not parse fragment "+g.sn+" "+$+" duration reliably ("+de+") resetting transmuxer to fallback to playlist timing"),G.resetTransmuxer(),F||!1;var ge=j?0:Object(S.updateFragPTSDTS)(V,g,ie.startPTS,ie.endPTS,ie.startDTS,ie.endDTS);return G.hls.trigger(N.Events.LEVEL_PTS_UPDATED,{details:V,level:I,drift:ge,type:$,frag:g,start:ie.startPTS,end:ie.endPTS}),!0}return F},!1);M?(this.state=y.PARSED,this.hls.trigger(N.Events.FRAG_PARSED,{frag:g,part:x})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(u,[{key:"state",get:function(){return this._state},set:function(g){var x=this._state;x!==g&&(this._state=g,this.log(x+"->"+g))}}]),u}(U.default)},"./src/controller/buffer-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return A});var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts"),K=O("./src/errors.ts"),H=O("./src/utils/buffer-helper.ts"),N=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),b=O("./src/controller/buffer-operation-queue.ts"),_=Object(N.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,A=function(){function S(h){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 l=a.hls,d=a.media,w=a.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),d&&(a.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){D.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){D.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var C=S.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.registerListeners=function(){var a=this.hls;a.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(U.Events.BUFFER_RESET,this.onBufferReset,this),a.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(U.Events.BUFFER_EOS,this.onBufferEos,this),a.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(U.Events.FRAG_PARSED,this.onFragParsed,this),a.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},C.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(U.Events.BUFFER_RESET,this.onBufferReset,this),a.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(U.Events.BUFFER_EOS,this.onBufferEos,this),a.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(U.Events.FRAG_PARSED,this.onFragParsed,this),a.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.onManifestParsed=function(a,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,D.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},C.onMediaAttaching=function(a,l){var d=this.media=l.media;if(d&&_){var w=this.mediaSource=new _;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},C.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(D.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(w){D.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(d&&self.URL.revokeObjectURL(d),a.src===d?(a.removeAttribute("src"),a.load()):D.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(U.Events.MEDIA_DETACHED,void 0)},C.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var d=a.sourceBuffer[l];try{d&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(d),a.sourceBuffer[l]=void 0)}catch(w){D.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},C.onBufferCodecs=function(a,l){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(w){var m=d.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var L=l[v],y=L.codec,f=L.levelCodec,p=L.container,u=(m.levelCodec||m.codec).replace(P,"$1"),o=(f||y).replace(P,"$1");if(u!==o){var E=p+";codecs="+(f||y);d.appendChangeType(v,E)}}}else d.pendingTracks[v]=l[v]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(a,l){var d=this,w=this.operationQueue,v={execute:function(){var L=d.sourceBuffer[a];L&&(D.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),L.changeType(l)),w.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(L){D.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",L)}};w.append(v,a)},C.onBufferAppending=function(a,l){var d=this,w=this.hls,v=this.operationQueue,m=this.tracks,L=l.data,y=l.type,f=l.frag,p=l.part,u=l.chunkMeta,o=u.buffering[y],E=self.performance.now();o.start=E;var g=f.stats.buffering,x=p?p.stats.buffering:null;g.start===0&&(g.start=E),x&&x.start===0&&(x.start=E);var I=m.audio,j=y==="audio"&&u.id===1&&(I==null?void 0:I.container)==="audio/mpeg",G={execute:function(){if(o.executeStart=self.performance.now(),j){var M=d.sourceBuffer[y];if(M){var F=f.start-M.timestampOffset;Math.abs(F)>=.1&&(D.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+F+") sn: "+f.sn+")"),M.timestampOffset=f.start)}}d.appendExecutor(L,y)},onStart:function(){},onComplete:function(){var M=self.performance.now();o.executeEnd=o.end=M,g.first===0&&(g.first=M),x&&x.first===0&&(x.first=M);var F=d.sourceBuffer,$={};for(var ie in F)$[ie]=H.BufferHelper.getBuffered(F[ie]);d.appendError=0,d.hls.trigger(U.Events.BUFFER_APPENDED,{type:y,frag:f,part:p,chunkMeta:u,parent:f.type,timeRanges:$})},onError:function(M){D.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",M);var F={type:K.ErrorTypes.MEDIA_ERROR,parent:f.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=K.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,F.details=K.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),w.trigger(U.Events.ERROR,F)}};v.append(G,y)},C.onBufferFlushing=function(a,l){var d=this,w=this.operationQueue,v=function(L){return{execute:d.removeExecutor.bind(d,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(U.Events.BUFFER_FLUSHED,{type:L})},onError:function(f){D.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",f)}}};l.type?w.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){w.append(v(m),m)})},C.onFragParsed=function(a,l){var d=this,w=l.frag,v=l.part,m=[],L=v?v.elementaryStreams:w.elementaryStreams;L[R.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(L[R.ElementaryStreamTypes.AUDIO]&&m.push("audio"),L[R.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var p=self.performance.now();w.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var u=v?v.stats:w.stats;d.hls.trigger(U.Events.FRAG_BUFFERED,{frag:w,part:v,stats:u,id:w.type})};m.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(y,m)},C.onFragChanged=function(a,l){this.flushBackBuffer()},C.onBufferEos=function(a,l){var d=this,w=this.getSourceBufferTypes().reduce(function(v,m){var L=d.sourceBuffer[m];return(!l.type||l.type===m)&&(L&&!L.ended&&(L.ended=!0,D.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var v=d.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},C.onLevelUpdated=function(a,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},C.flushBackBuffer=function(){var a=this.hls,l=this.details,d=this.media,w=this.sourceBuffer;if(!d||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Z.isFiniteNumber)(m)||m<0)return;var L=d.currentTime,y=l.levelTargetDuration,f=Math.max(m,y),p=Math.floor(L/y)*y-f;v.forEach(function(u){var o=w[u];if(o){var E=H.BufferHelper.getBuffered(o);E.length>0&&p>E.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),l.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:u}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,d=this.media,w=this.mediaSource,v=a.fragments[0].start+a.totalduration,m=d.duration,L=Object(Z.isFiniteNumber)(w.duration)?w.duration:0;a.live&&l.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(a)):(v>L&&v>m||!Object(Z.isFiniteNumber)(m))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),w.duration=v)},C.updateSeekableRange=function(a){var l=this.mediaSource,d=a.fragments,w=d.length;if(w&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,d[0].start),m=Math.max(v,v+a.totalduration);l.setLiveSeekableRange(v,m)}},C.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!a||w===2){this.createSourceBuffers(d),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){l.executeNext(m)})}},C.createSourceBuffers=function(a){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var v in a)if(!l[v]){var m=a[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var L=m.levelCodec||m.codec,y=m.container+";codecs="+L;D.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var f=l[v]=d.addSourceBuffer(y),p=v;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[v]={buffer:f,codec:L,container:m.container,levelCodec:m.levelCodec,id:m.id},w++}catch(u){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:y})}}w&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(a){var l=this.operationQueue,d=l.current(a);d.onStart()},C._onSBUpdateEnd=function(a){var l=this.operationQueue,d=l.current(a);d.onComplete(),l.shiftAndExecuteNext(a)},C._onSBUpdateError=function(a,l){D.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(a);d&&d.onError(l)},C.removeExecutor=function(a,l,d){var w=this.media,v=this.mediaSource,m=this.operationQueue,L=this.sourceBuffer,y=L[a];if(!w||!v||!y){D.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(a);return}var f=Object(Z.isFiniteNumber)(w.duration)?w.duration:Infinity,p=Object(Z.isFiniteNumber)(v.duration)?v.duration:Infinity,u=Math.max(0,l),o=Math.min(d,f,p);o>u?(D.logger.log("[buffer-controller]: Removing ["+u+","+o+"] from the "+a+" SourceBuffer"),console.assert(!y.updating,a+" sourceBuffer must not be updating"),y.remove(u,o)):m.shiftAndExecuteNext(a)},C.appendExecutor=function(a,l){var d=this.operationQueue,w=this.sourceBuffer,v=w[l];if(!v){D.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(a)},C.blockBuffers=function(a,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){D.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var w=this.operationQueue,v=l.map(function(m){return w.appendBlocker(m)});Promise.all(v).then(function(){a(),l.forEach(function(m){var L=d.sourceBuffer[m];(!L||!L.updating)&&w.shiftAndExecuteNext(m)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(a,l,d){var w=this.sourceBuffer[a];if(!w)return;var v=d.bind(this,a);this.listeners[a].push({event:l,listener:v}),w.addEventListener(l,v)},C.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(d){l.removeEventListener(d.event,d.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return U});var Z=O("./src/utils/logger.ts"),U=function(){function D(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var K=D.prototype;return K.append=function(N,R){var b=this.queues[R];b.push(N),b.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(N,R){var b=this.queues[R];b.unshift(N),this.executeNext(R)},K.appendBlocker=function(N){var R,b=new Promise(function(P){R=P}),_={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,N),b},K.executeNext=function(N){var R=this.buffers,b=this.queues,_=R[N],P=b[N];if(P.length){var A=P[0];try{A.execute()}catch(S){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),A.onError(S),(!_||!_.updating)&&(P.shift(),this.executeNext(N))}}},K.shiftAndExecuteNext=function(N){this.queues[N].shift(),this.executeNext(N)},K.current=function(N){return this.queues[N][0]},D}()},"./src/controller/cap-level-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts");function U(H,N){for(var R=0;R<N.length;R++){var b=N[R];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(H,b.key,b)}}function D(H,N,R){return N&&U(H.prototype,N),R&&U(H,R),H}var K=function(){function H(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var N=H.prototype;return N.setStreamController=function(b){this.streamController=b},N.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},N.registerListeners=function(){var b=this.hls;b.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},N.unregisterListener=function(){var b=this.hls;b.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},N.onFpsDropLevelCapping=function(b,_){H.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},N.onMediaAttaching=function(b,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},N.onManifestParsed=function(b,_){var P=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,P.config.capLevelToPlayerSize&&_.video&&this.startCapping()},N.onBufferCodecs=function(b,_){var P=this.hls;P.config.capLevelToPlayerSize&&_.video&&this.startCapping()},N.onMediaDetaching=function(){this.stopCapping()},N.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(b.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},N.getMaxLevel=function(b){var _=this,P=this.hls.levels;if(!P.length)return-1;var A=P.filter(function(S,C){return H.isLevelAllowed(C,_.restrictedLevels)&&C<=b});return this.clientRect=null,H.getMaxLevelByMediaSize(A,this.mediaWidth,this.mediaHeight)},N.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()},N.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},N.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,_={width:0,height:0};if(b){var P=b.getBoundingClientRect();_.width=P.width,_.height=P.height,!_.width&&!_.height&&(_.width=P.right-P.left||b.width||0,_.height=P.bottom-P.top||b.height||0)}return this.clientRect=_,_},H.isLevelAllowed=function(b,_){return _===void 0&&(_=[]),_.indexOf(b)===-1},H.getMaxLevelByMediaSize=function(b,_,P){if(!b||!b.length)return-1;for(var A=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},S=b.length-1,C=0;C<b.length;C+=1){var h=b[C];if((h.width>=_||h.height>=P)&&A(h,b[C+1])){S=C;break}}return S},D(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(_){}return b}}]),H}();J.default=K},"./src/controller/cmcd-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return A});var Z=O("./src/events.ts"),U=O("./src/types/cmcd.ts"),D=O("./src/utils/buffer-helper.ts"),K=O("./src/utils/logger.ts");function H(S,C){for(var h=0;h<C.length;h++){var a=C[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(S,a.key,a)}}function N(S,C,h){return C&&H(S.prototype,C),h&&H(S,h),S}function R(S,C){var h=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(h)return(h=h.call(S)).next.bind(h);if(Array.isArray(S)||(h=b(S))||C&&S&&typeof S.length=="number"){h&&(S=h);var a=0;return function(){return a>=S.length?{done:!0}:{done:!1,value:S[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(S,C){if(!S)return;if(typeof S=="string")return _(S,C);var h=Object.prototype.toString.call(S).slice(8,-1);if(h==="Object"&&S.constructor&&(h=S.constructor.name),h==="Map"||h==="Set")return Array.from(S);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return _(S,C)}function _(S,C){(C==null||C>S.length)&&(C=S.length);for(var h=0,a=new Array(C);h<C;h++)a[h]=S[h];return a}function P(){return P=Object.assign||function(S){for(var C=1;C<arguments.length;C++){var h=arguments[C];for(var a in h)Object.prototype.hasOwnProperty.call(h,a)&&(S[a]=h[a])}return S},P.apply(this,arguments)}var A=function(){function S(h){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(w){try{a.apply(w,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(v){K.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(w){try{var v=w.frag,m=a.hls.levels[v.level],L=a.getObjectType(v),y={d:v.duration*1e3,ot:L};(L===U.CMCDObjectType.VIDEO||L===U.CMCDObjectType.AUDIO||L==U.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=a.getTopBandwidth(L),y.bl=a.getBufferLength(L)),a.apply(w,y)}catch(f){K.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=h;var l=this.config=h.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||S.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var C=S.prototype;return C.registerListeners=function(){var a=this.hls;a.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},C.unregisterListeners=function(){var a=this.hls;a.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(a,l){var d,w;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},C.createData=function(){var a;return{v:U.CMCDVersion,sf:U.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}},C.apply=function(a,l){l===void 0&&(l={}),P(l,this.createData());var d=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var w=S.toHeaders(l);if(!Object.keys(w).length)return;a.headers||(a.headers={}),P(a.headers,w)}else{var v=S.toQuery(l);if(!v)return;a.url=S.appendQueryToUri(a.url,v)}},C.getObjectType=function(a){var l=a.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},C.getTopBandwidth=function(a){for(var l=0,d=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=R(d),v;!(v=w()).done;){var m=v.value;m.bitrate>l&&(l=m.bitrate)}return l>0?l:NaN},C.getBufferLength=function(a){var l=this.hls.media,d=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var w=D.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return w.len*1e3},C.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,d=a||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var v=w.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,y,f){l(L),this.loader.load(L,y,f)},N(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},C.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,d=a||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var v=w.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(L,y,f){l(L),this.loader.load(L,y,f)},N(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},S.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},S.serialize=function(a){for(var l=[],d=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},w=function(j){return Math.round(j)},v=function(j){return w(j/100)*100},m=function(j){return encodeURIComponent(j)},L={br:w,d:w,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:w},y=Object.keys(a||{}).sort(),f=R(y),p;!(p=f()).done;){var u=p.value,o=a[u];if(!d(o))continue;if(u==="v"&&o===1)continue;if(u=="pr"&&o===1)continue;var E=L[u];E&&(o=E(o));var g=typeof o,x=void 0;u==="ot"||u==="sf"||u==="st"?x=u+"="+o:g==="boolean"?x=u:g==="number"?x=u+"="+o:x=u+"="+JSON.stringify(o),l.push(x)}return l.join(",")},S.toHeaders=function(a){for(var l=Object.keys(a),d={},w=["Object","Request","Session","Status"],v=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,y=l;L<y.length;L++){var f=y[L],p=m[f]!=null?m[f]:1;v[p][f]=a[f]}for(var u=0;u<v.length;u++){var o=S.serialize(v[u]);o&&(d["CMCD-"+w[u]]=o)}return d},S.toQuery=function(a){return"CMCD="+encodeURIComponent(S.serialize(a))},S.appendQueryToUri=function(a,l){if(!l)return a;var d=a.includes("?")?"&":"?";return""+a+d+l},S}()},"./src/controller/eme-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/utils/logger.ts"),K=O("./src/utils/mediakeys-helper.ts");function H(A,S){for(var C=0;C<S.length;C++){var h=S[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function N(A,S,C){return S&&H(A.prototype,S),C&&H(A,C),A}var R=3,b=function(S,C,h){var a={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),C.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[a]},_=function(S,C,h,a){switch(S){case K.KeySystems.WIDEVINE:return b(C,h,a);default:throw new Error("Unknown key-system: "+S)}},P=function(){function A(C){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=C,this._config=C.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var S=A.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(h){switch(h){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},S._attemptKeySystemAccess=function(h,a,l){var d=this,w=_(h,a,l,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,w);this.mediaKeysPromise=v.then(function(m){return d._onMediaKeySystemAccessObtained(h,m)}),v.catch(function(m){D.logger.error('Failed to obtain key-system "'+h+'" access:',m)})},S._onMediaKeySystemAccessObtained=function(h,a){var l=this;D.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(v){return d.mediaKeys=v,D.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),v});return w.catch(function(v){D.logger.error("Failed to create media-keys:",v)}),w},S._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),h._onNewMediaKeySession(a.mediaKeysSession))})},S._onNewMediaKeySession=function(h){var a=this;D.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){a._onKeySessionMessage(h,l.message)},!1)},S._onKeySessionMessage=function(h,a){D.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){D.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},S.onMediaEncrypted=function(h){var a=this;if(D.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(w){if(!a._media)return;a._attemptSetMediaKeys(w),a._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},S._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}D.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(h,a){var l=this,d=this._mediaKeysList[0];if(!d){D.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){D.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){D.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){D.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}D.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(h,a).then(function(){D.logger.debug("Key-session generation succeeded")}).catch(function(v){D.logger.error("Error generating key-session request:",v),l.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(h,a,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,a,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,h),w=void 0}catch(v){D.logger.error(v)}try{d.readyState||d.open("POST",h,!0),w&&w.call(this.hls,d,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return d},S._onLicenseRequestReadyStageChange=function(h,a,l,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var w=h.response,v=this._licenseResponseCallback;if(v)try{w=v.call(this.hls,h,a)}catch(L){D.logger.error(L)}d(w)}else{if(D.logger.error("License Request XHR failed ("+a+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=R-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,d)}break}},S._generateLicenseRequestChallenge=function(h,a){switch(h.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},S._requestLicense=function(h,a){D.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){D.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),w=this._createLicenseXhr(d,h,a);D.logger.log("Sending license request to URL: "+d);var v=this._generateLicenseRequestChallenge(l,h);w.send(v)}catch(m){D.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(h,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var h=this._media,a=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(h,a){if(!this._emeEnabled)return;var l=a.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=a.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,l,d)},N(A,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),A}();J.default=P},"./src/controller/fps-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),U=O("./src/utils/logger.ts"),D=function(){function K(N){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=N,this.registerListeners()}var H=K.prototype;return H.setStreamController=function(R){this.streamController=R},H.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(R,b){var _=this.hls.config;if(_.capLevelOnFPSDrop){var P=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),_.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(R,b,_){var P=performance.now();if(b){if(this.lastTime){var A=P-this.lastTime,S=_-this.lastDroppedFrames,C=b-this.lastDecodedFrames,h=1e3*S/A,a=this.hls;if(a.trigger(Z.Events.FPS_DROP,{currentDropped:S,currentDecoded:C,totalDroppedFrames:_}),h>0&&S>a.config.fpsDroppedMonitoringThreshold*C){var l=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=_,this.lastDecodedFrames=b}},H.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var b=R.getVideoPlaybackQuality();this.checkFPS(R,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();J.default=D},"./src/controller/fragment-finders.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"findFragmentByPDT",function(){return D}),O.d(J,"findFragmentByPTS",function(){return K}),O.d(J,"fragmentWithinToleranceTest",function(){return H}),O.d(J,"pdtWithinToleranceTest",function(){return N}),O.d(J,"findFragWithCC",function(){return R});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/binary-search.ts");function D(b,_,P){if(_===null||!Array.isArray(b)||!b.length||!Object(Z.isFiniteNumber)(_))return null;var A=b[0].programDateTime;if(_<(A||0))return null;var S=b[b.length-1].endProgramDateTime;if(_>=(S||0))return null;P=P||0;for(var C=0;C<b.length;++C){var h=b[C];if(N(_,P,h))return h}return null}function K(b,_,P,A){P===void 0&&(P=0),A===void 0&&(A=0);var S=null;if(b?S=_[b.sn-_[0].sn+1]||null:P===0&&_[0].start===0&&(S=_[0]),S&&H(P,A,S)===0)return S;var C=U.default.search(_,H.bind(null,P,A));return C||S}function H(b,_,P){b===void 0&&(b=0),_===void 0&&(_=0);var A=Math.min(_,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-A<=b?1:P.start-A>b&&P.start?-1:0}function N(b,_,P){var A=Math.min(_,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,S=P.endProgramDateTime||0;return S-A>b}function R(b,_){return U.default.search(b,function(P){return P.cc<_?1:P.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"FragmentState",function(){return D}),O.d(J,"FragmentTracker",function(){return K});var Z=O("./src/events.ts"),U=O("./src/types/loader.ts"),D;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(D||(D={}));var K=function(){function R(_){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=_,this._registerListeners()}var b=R.prototype;return b._registerListeners=function(){var P=this.hls;P.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var P=this.hls;P.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(P,A){if(A===U.PlaylistLevelType.MAIN){var S=this.activeFragment,C=this.activeParts;if(!S)return null;if(C)for(var h=C.length;h--;){var a=C[h],l=a?a.end:S.appendedPTS;if(a.start<=P&&l!==void 0&&P<=l)return h>9&&(this.activeParts=C.slice(h-9)),a}else if(S.start<=P&&S.appendedPTS!==void 0&&P<=S.appendedPTS)return S}return this.getBufferedFrag(P,A)},b.getBufferedFrag=function(P,A){for(var S=this.fragments,C=Object.keys(S),h=C.length;h--;){var a=S[C[h]];if((a==null?void 0:a.body.type)===A&&a.buffered){var l=a.body;if(l.start<=P&&P<=l.end)return l}}return null},b.detectEvictedFragments=function(P,A,S){var C=this;Object.keys(this.fragments).forEach(function(h){var a=C.fragments[h];if(!a)return;if(!a.buffered){a.body.type===S&&C.removeFragment(a.body);return}var l=a.range[P];if(!l)return;l.time.some(function(d){var w=!C.isTimeBuffered(d.startPTS,d.endPTS,A);return w&&C.removeFragment(a.body),w})})},b.detectPartialFragments=function(P){var A=this,S=this.timeRanges,C=P.frag,h=P.part;if(!S||C.sn==="initSegment")return;var a=N(C),l=this.fragments[a];if(!l)return;Object.keys(S).forEach(function(d){var w=C.elementaryStreams[d];if(!w)return;var v=S[d],m=h!==null||w.partial===!0;l.range[d]=A.getBufferedTimes(C,h,m,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},b.fragBuffered=function(P){var A=N(P),S=this.fragments[A];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},b.getBufferedTimes=function(P,A,S,C){for(var h={time:[],partial:S},a=A?A.start:P.start,l=A?A.end:P.end,d=P.minEndPTS||l,w=P.maxStartPTS||a,v=0;v<C.length;v++){var m=C.start(v)-this.bufferPadding,L=C.end(v)+this.bufferPadding;if(w>=m&&d<=L){h.time.push({startPTS:Math.max(a,C.start(v)),endPTS:Math.min(l,C.end(v))});break}else if(a<L&&l>m)h.partial=!0,h.time.push({startPTS:Math.max(a,C.start(v)),endPTS:Math.min(l,C.end(v))});else if(l<=m)break}return h},b.getPartialFragment=function(P){var A=null,S,C,h,a=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var v=d[w];if(!v)return;H(v)&&(C=v.body.start-l,h=v.body.end+l,P>=C&&P<=h&&(S=Math.min(P-C,h-P),a<=S&&(A=v.body,a=S)))}),A},b.getState=function(P){var A=N(P),S=this.fragments[A];return S?S.buffered?H(S)?D.PARTIAL:D.OK:S.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},b.backtrack=function(P,A){var S=N(P),C=this.fragments[S];if(!C||C.backtrack)return null;var h=C.backtrack=A||C.loaded;return C.loaded=null,h},b.getBacktrackData=function(P){var A=N(P),S=this.fragments[A];if(S){var C,h=S.backtrack;if(h!=null&&(C=h.payload)!==null&&C!==void 0&&C.byteLength)return h;this.removeFragment(P)}return null},b.isTimeBuffered=function(P,A,S){for(var C,h,a=0;a<S.length;a++){if(C=S.start(a)-this.bufferPadding,h=S.end(a)+this.bufferPadding,P>=C&&A<=h)return!0;if(A<=C)return!1}return!1},b.onFragLoaded=function(P,A){var S=A.frag,C=A.part;if(S.sn==="initSegment"||S.bitrateTest||C)return;var h=N(S);this.fragments[h]={body:S,loaded:A,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(P,A){var S=this,C=A.frag,h=A.part,a=A.timeRanges;if(C.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=C,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(d){var w=a[d];if(S.detectEvictedFragments(d,w),!h)for(var v=0;v<w.length;v++)C.appendedPTS=Math.max(w.end(v),C.appendedPTS||0)})},b.onFragBuffered=function(P,A){this.detectPartialFragments(A)},b.hasFragment=function(P){var A=N(P);return!!this.fragments[A]},b.removeFragmentsInRange=function(P,A,S){var C=this;Object.keys(this.fragments).forEach(function(h){var a=C.fragments[h];if(!a)return;if(a.buffered){var l=a.body;l.type===S&&l.start<A&&l.end>P&&C.removeFragment(l)}})},b.removeFragment=function(P){var A=N(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[A]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function H(R){var b,_;return R.buffered&&(((b=R.range.video)===null||b===void 0?void 0:b.partial)||((_=R.range.audio)===null||_===void 0?void 0:_.partial))}function N(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"STALL_MINIMUM_DURATION_MS",function(){return H}),O.d(J,"MAX_START_GAP_JUMP",function(){return N}),O.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d(J,"SKIP_BUFFER_RANGE_START",function(){return b}),O.d(J,"default",function(){return _});var Z=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),D=O("./src/events.ts"),K=O("./src/utils/logger.ts"),H=250,N=2,R=.1,b=.05,_=function(){function P(S,C,h,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=S,this.media=C,this.fragmentTracker=h,this.hls=a}var A=P.prototype;return A.destroy=function(){this.hls=this.fragmentTracker=this.media=null},A.poll=function(C){var h=this.config,a=this.media,l=this.stalled,d=a.currentTime,w=a.seeking,v=this.seeking&&!w,m=!this.seeking&&w;if(this.seeking=w,d!==C){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;K.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Z.BufferHelper.getBuffered(a).length)return;var y=Z.BufferHelper.bufferInfo(a,d,0),f=y.len>0,p=y.nextStart||0;if(!f&&!p)return;if(w){var u=y.len>N,o=!p||p-d>N&&!this.fragmentTracker.getPartialFragment(d);if(u||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,g=Math.max(p,y.start||0)-d,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=x==null||((E=x.details)===null||E===void 0)?void 0:E.live,j=I?x.details.targetduration*2:N;if(g>0&&g<=j){this._trySkipBufferHole(null);return}}var G=self.performance.now();if(l===null){this.stalled=G;return}var V=G-l;!w&&V>=H&&this._reportStall(y.len);var M=Z.BufferHelper.bufferInfo(a,d,h.maxBufferHole);this._tryFixBufferStall(M,V)},A._tryFixBufferStall=function(C,h){var a=this.config,l=this.fragmentTracker,d=this.media,w=d.currentTime,v=l.getPartialFragment(w);if(v){var m=this._trySkipBufferHole(v);if(m)return}C.len>a.maxBufferHole&&h>a.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},A._reportStall=function(C){var h=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+C+")"),h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},A._trySkipBufferHole=function(C){for(var h=this.config,a=this.hls,l=this.media,d=l.currentTime,w=0,v=Z.BufferHelper.getBuffered(l),m=0;m<v.length;m++){var L=v.start(m);if(d+h.maxBufferHole>=w&&d<L){var y=Math.max(L+b,l.currentTime+R);return K.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+y),this.moved=!0,this.stalled=null,l.currentTime=y,C&&a.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+y,frag:C}),y}w=v.end(m)}return 0},A._tryNudgeBuffer=function(){var C=this.config,h=this.hls,a=this.media,l=a.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<C.nudgeMaxRetry){var w=l+d*C.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+l+" to "+w),a.currentTime=w,h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+C.nudgeMaxRetry+" nudges"),h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),D=O("./src/demux/id3.ts"),K=.25,H=function(){function N(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var R=N.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var _=this.hls;_.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var _=this.hls;_.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(_,P){this.media=P.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(_){if(!this.media)return;for(var P=0;P<_.length;P++){var A=_[P];if(A.kind==="metadata"&&A.label==="id3")return Object(U.sendAddTrackEvent)(A,this.media),A}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(_,P){if(!this.media)return;var A=P.frag,S=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<S.length;h++){var a=D.getID3Frames(S[h].data);if(a){var l=S[h].pts,d=h<S.length-1?S[h+1].pts:A.end,w=d-l;w<=0&&(d=l+K);for(var v=0;v<a.length;v++){var m=a[v];if(!D.isTimeStampFrame(m)){var L=new C(l,d,"");L.value=m,this.id3Track.addCue(L)}}}}},R.onBufferFlushing=function(_,P){var A=P.startOffset,S=P.endOffset,C=P.type;if(!C||C==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,A,S)}},N}();J.default=H},"./src/controller/latency-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return N});var Z=O("./src/errors.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts");function K(R,b){for(var _=0;_<b.length;_++){var P=b[_];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(R,P.key,P)}}function H(R,b,_){return b&&K(R.prototype,b),_&&K(R,_),R}var N=function(){function R(_){var P=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 P.timeupdate()},this.hls=_,this.config=_.config,this.registerListeners()}var b=R.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},b.onMediaAttached=function(P,A){this.media=A.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(P,A){var S=A.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(P,A){if(A.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,D.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var P=this.media,A=this.levelDetails;if(!P||!A)return;this.currentTime=P.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var C=this.config,h=C.lowLatencyMode,a=C.maxLiveSyncPlaybackRate;if(!h||a===1)return;var l=this.targetLatency;if(l===null)return;var d=S-l,w=Math.min(this.maxLatency,l+A.targetduration),v=d<w;if(A.live&&v&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,a)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,L))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},b.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},b.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},H(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,A=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:A?P.liveMaxLatencyDurationCount*A.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var A=P.holdBack,S=P.partHoldBack,C=P.targetduration,h=this.config,a=h.liveSyncDuration,l=h.liveSyncDurationCount,d=h.lowLatencyMode,w=this.hls.userConfig,v=d&&S||A;(w.liveSyncDuration||w.liveSyncDurationCount||v===0)&&(v=a!==void 0?a:l*C);var m=C,L=1;return v+Math.min(this.stallCount*L,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),A=this.targetLatency,S=this.levelDetails;if(P===null||A===null||S===null)return null;var C=S.edge,h=P-A-this.edgeStalled,a=C-S.totalduration,l=C-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(a,h),l)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var A=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-A,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,A=this.levelDetails;if(!P||!A)return 0;var S=P.buffered.length;return S?P.buffered.end(S-1):A.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return h});var Z=O("./src/types/level.ts"),U=O("./src/events.ts"),D=O("./src/errors.ts"),K=O("./src/utils/codecs.ts"),H=O("./src/controller/level-helper.ts"),N=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function b(){return b=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(a[w]=d[w])}return a},b.apply(this,arguments)}function _(a,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(a,w.key,w)}}function P(a,l,d){return l&&_(a.prototype,l),d&&_(a,d),a}function A(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,S(a,l)}function S(a,l){return S=Object.setPrototypeOf||function(w,v){return w.__proto__=v,w},S(a,l)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(a){A(l,a);function l(w){var v;return v=a.call(this,w,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var d=l.prototype;return d._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},d.startLoad=function(){var v=this._levels;v.forEach(function(m){m.loadError=0}),a.prototype.startLoad.call(this)},d.onManifestLoaded=function(v,m){var L=[],y=[],f=[],p,u={},o,E=!1,g=!1,x=!1;if(m.levels.forEach(function(V){var M=V.attrs;E=E||!!(V.width&&V.height),g=g||!!V.videoCodec,x=x||!!V.audioCodec,C&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var F=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;o=u[F],o?o.url.push(V.url):(o=new Z.Level(V),u[F]=o,L.push(o)),M&&(M.AUDIO&&Object(H.addGroupId)(o,"audio",M.AUDIO),M.SUBTITLES&&Object(H.addGroupId)(o,"text",M.SUBTITLES))}),(E||g)&&x&&(L=L.filter(function(V){var M=V.videoCodec,F=V.width,$=V.height;return!!M||!!(F&&$)})),L=L.filter(function(V){var M=V.audioCodec,F=V.videoCodec;return(!M||Object(K.isCodecSupportedInMp4)(M,"audio"))&&(!F||Object(K.isCodecSupportedInMp4)(F,"video"))}),m.audioTracks&&(y=m.audioTracks.filter(function(V){return!V.audioCodec||Object(K.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(y)),m.subtitles&&(f=m.subtitles,Object(H.assignTrackIdsByGroup)(f)),L.length>0){p=L[0].bitrate,L.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=L;for(var I=0;I<L.length;I++)if(L[I].bitrate===p){this._firstLevel=I,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+p);break}var j=x&&!g,G={levels:L,audioTracks:y,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:x,video:g,altAudio:!j&&y.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,G),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(v,m){if(a.prototype.onError.call(this,v,m),m.fatal)return;var L=m.context,y=this._levels[this.currentLevelIndex];if(L&&(L.type===R.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&L.groupId===y.audioGroupIds[y.urlId]||L.type===R.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&L.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,p=!0,u;switch(m.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var o=this._levels[m.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=m.frag.level)):u=m.frag.level}break;case D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(p=!1),u=L.level),f=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,f=!0;break}u!==void 0&&this.recoverLevel(m,u,f,p)},d.recoverLevel=function(v,m,L,y){var f=v.details,p=this._levels[m];if(p.loadError++,L){var u=this.retryLoadingOrFail(v);if(u)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var o=p.url.length;if(o>1&&p.loadError<o)v.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var E=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(f+": switch to "+E),v.levelRetry=!0,this.hls.nextAutoLevel=E)}}},d.redundantFailover=function(v){var m=this._levels[v],L=m.url.length;if(L>1){var y=(m.urlId+1)%L;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(f){f.urlId=y}),this.level=v}},d.onFragLoaded=function(v,m){var L=m.frag;if(L!==void 0&&L.type===R.PlaylistLevelType.MAIN){var y=this._levels[L.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},d.onLevelLoaded=function(v,m){var L,y=m.level,f=m.details,p=this._levels[y];if(!p){var u;this.warn("Invalid level index "+y),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(f.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,p.details)):(L=m.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(f.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(v,m){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var y=-1,f=this.hls.audioTracks[m.id].groupId,p=0;p<L.audioGroupIds.length;p++)if(L.audioGroupIds[p]===f){y=p;break}y!==L.urlId&&(L.urlId=y,this.startLoad())}},d.loadPlaylist=function(v){var m=this.currentLevelIndex,L=this._levels[m];if(this.canLoad&&L&&L.url.length>0){var y=L.urlId,f=L.url[y];if(v)try{f=v.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+y+" "+f),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:f,level:m,id:y,deliveryDirectives:v||null})}},d.removeLevel=function(v,m){var L=function(p,u){return u!==m},y=this._levels.filter(function(f,p){return p!==v?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(L),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(L)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(L)),f.urlId=0,!0):!1}).map(function(f,p){var u=f.details;return u!=null&&u.fragments&&u.fragments.forEach(function(o){o.level=p}),f});this._levels=y,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:y})},P(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===v&&(m=L[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=L.length){var y=v<0;if(this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:y,reason:"invalid level idx"}),y)return;v=Math.min(v,L.length-1)}this.clearTimer();var f=this.currentLevelIndex,p=L[f],u=L[v];this.log("switching to level "+v+" from "+f),this.currentLevelIndex=v;var o=b({},u,{level:v,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);var E=u.details;if(!E||E.live){var g=this.switchParams(u.uri,p==null?void 0:p.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(N.default)},"./src/controller/level-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"addGroupId",function(){return D}),O.d(J,"assignTrackIdsByGroup",function(){return K}),O.d(J,"updatePTS",function(){return H}),O.d(J,"updateFragPTSDTS",function(){return R}),O.d(J,"mergeDetails",function(){return b}),O.d(J,"mapPartIntersection",function(){return _}),O.d(J,"mapFragmentIntersection",function(){return P}),O.d(J,"adjustSliding",function(){return A}),O.d(J,"addSliding",function(){return S}),O.d(J,"computeReloadInterval",function(){return C}),O.d(J,"getFragmentWithSN",function(){return h}),O.d(J,"getPartWith",function(){return a});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts");function D(l,d,w){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function K(l){var d={};l.forEach(function(w){var v=w.groupId||"";w.id=d[v]=d[v]||0,d[v]++})}function H(l,d,w){var v=l[d],m=l[w];N(v,m)}function N(l,d){var w=d.startPTS;if(Object(Z.isFiniteNumber)(w)){var v=0,m;d.sn>l.sn?(v=w-l.start,m=l):(v=l.start-w,m=d),m.duration!==v&&(m.duration=v)}else if(d.sn>l.sn){var L=l.cc===d.cc;L&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function R(l,d,w,v,m,L){var y=v-w;y<=0&&(U.logger.warn("Fragment should have a positive duration",d),v=w+d.duration,L=m+d.duration);var f=w,p=v,u=d.startPTS,o=d.endPTS;if(Object(Z.isFiniteNumber)(u)){var E=Math.abs(u-w);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(E,d.deltaPTS):d.deltaPTS=E,f=Math.max(w,u),w=Math.min(w,u),m=Math.min(m,d.startDTS),p=Math.min(v,o),v=Math.max(v,o),L=Math.max(L,d.endDTS)}d.duration=v-w;var g=w-d.start;d.appendedPTS=v,d.start=d.startPTS=w,d.maxStartPTS=f,d.startDTS=m,d.endPTS=v,d.minEndPTS=p,d.endDTS=L;var x=d.sn;if(!l||x<l.startSN||x>l.endSN)return 0;var I,j=x-l.startSN,G=l.fragments;for(G[j]=d,I=j;I>0;I--)N(G[I],G[I-1]);for(I=j;I<G.length-1;I++)N(G[I],G[I+1]);return l.fragmentHint&&N(G[G.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,g}function b(l,d){for(var w=null,v=l.fragments,m=v.length-1;m>=0;m--){var L=v[m].initSegment;if(L){w=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var y=0,f;if(P(l,d,function(I,j){I.relurl&&(y=I.cc-j.cc),Object(Z.isFiniteNumber)(I.startPTS)&&Object(Z.isFiniteNumber)(I.endPTS)&&(j.start=j.startPTS=I.startPTS,j.startDTS=I.startDTS,j.appendedPTS=I.appendedPTS,j.maxStartPTS=I.maxStartPTS,j.endPTS=I.endPTS,j.endDTS=I.endDTS,j.minEndPTS=I.minEndPTS,j.duration=I.endPTS-I.startPTS,j.duration&&(f=j),d.PTSKnown=d.alignedSliding=!0),j.elementaryStreams=I.elementaryStreams,j.loader=I.loader,j.stats=I.stats,j.urlId=I.urlId,I.initSegment&&(j.initSegment=I.initSegment,w=I.initSegment)}),w){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(I){var j;(!I.initSegment||I.initSegment.relurl===((j=w)===null||j===void 0?void 0:j.relurl))&&(I.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(I){return!I}),d.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=d.skippedSegments;u--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var o=d.fragments;if(y){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<o.length;E++)o[E].cc+=y}d.skippedSegments&&(d.startCC=d.fragments[0].cc),_(l.partList,d.partList,function(I,j){j.elementaryStreams=I.elementaryStreams,j.stats=I.stats}),f?R(d,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):A(l,d),o.length&&(d.totalduration=d.edge-o[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var g=d.advancedDateTime;if(d.advanced&&g){var x=d.edge;d.driftStart||(d.driftStartTime=g,d.driftStart=x),d.driftEndTime=g,d.driftEnd=x}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function _(l,d,w){if(l&&d)for(var v=0,m=0,L=l.length;m<=L;m++){var y=l[m],f=d[m+v];y&&f&&y.index===f.index&&y.fragment.sn===f.fragment.sn?w(y,f):v--}}function P(l,d,w){for(var v=d.skippedSegments,m=Math.max(l.startSN,d.startSN)-d.startSN,L=(l.fragmentHint?1:0)+(v?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,y=d.startSN-l.startSN,f=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=m;u<=L;u++){var o=p[y+u],E=f[u];v&&!E&&u<v&&(E=d.fragments[u]=o),o&&E&&w(o,E)}}function A(l,d){var w=d.startSN+d.skippedSegments-l.startSN,v=l.fragments;if(w<0||w>=v.length)return;S(d,v[w].start)}function S(l,d){if(d){for(var w=l.fragments,v=l.skippedSegments;v<w.length;v++)w[v].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function C(l,d){var w=1e3*l.levelTargetDuration,v=w/2,m=l.age,L=m>0&&m<w*3,y=d.loading.end-d.loading.start,f,p=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;f=Math.max(Math.min(v,y*2),u),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=v;else L?(p=Math.min(p||w/2,m),l.availabilityDelay=p,f=p+w-m):f=w-y;return Math.round(f)}function h(l,d,w){if(!l||!l.details)return null;var v=l.details,m=v.fragments[d-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===d?m:d<v.startSN&&w&&w.sn===d?w:null)}function a(l,d,w){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var m=v.length;m--;){var L=v[m];if(L.index===w&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return v});var Z=O("./src/polyfills/number.ts"),U=O("./src/controller/base-stream-controller.ts"),D=O("./src/is-supported.ts"),K=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),N=O("./src/controller/fragment-tracker.ts"),R=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),_=O("./src/demux/transmuxer-interface.ts"),P=O("./src/types/transmuxer.ts"),A=O("./src/controller/gap-controller.ts"),S=O("./src/errors.ts"),C=O("./src/utils/logger.ts");function h(m,L){for(var y=0;y<L.length;y++){var f=L[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function a(m,L,y){return L&&h(m.prototype,L),y&&h(m,y),m}function l(m,L){m.prototype=Object.create(L.prototype),m.prototype.constructor=m,d(m,L)}function d(m,L){return d=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},d(m,L)}var w=100,v=function(m){l(L,m);function L(f,p){var u;return u=m.call(this,f,p,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var y=L.prototype;return y._registerListeners=function(){var p=this.hls;p.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(K.Events.ERROR,this.onError,this),p.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var p=this.hls;p.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(K.Events.ERROR,this.onError,this),p.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(p){if(this.levels){var u=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=o.startLevel;E===-1&&(o.config.testBandwidth?(E=0,this.bitrateTest=!0):E=o.nextAutoLevel),this.level=o.nextLoadLevel=E,this.loadedmetadata=!1}u>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),p=u),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var p,u=this.levels,o=this.level,E=u==null||((p=u[o])===null||p===void 0)?void 0:p.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,x=self.performance.now(),I=this.retryDate;(!I||x>=I||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var p,u,o=this.hls,E=this.levelLastLoaded,g=this.levels,x=this.media,I=o.config,j=o.nextLoadLevel;if(E===null||!x&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[j])return;var G=g[j];this.level=o.nextLoadLevel=j;var V=G.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,R.PlaylistLevelType.MAIN);if(M===null)return;var F=M.len,$=this.getMaxBufferLength(G.maxBitrate);if(F>=$)return;if(this._streamEnded(M,V)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,ie),this.state=U.State.ENDED;return}var de=M.end,ge=this.getNextFragment(de,V);if(this.couldBacktrack&&!this.fragPrevious&&ge&&ge.sn!=="initSegment"){var Le=ge.sn-V.startSN;Le>1&&(ge=V.fragments[Le-1],this.fragmentTracker.removeFragment(ge))}if(ge&&this.fragmentTracker.getState(ge)===N.FragmentState.OK&&this.nextLoadPosition>de){var Ee=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,Ee,R.PlaylistLevelType.MAIN),ge=this.getNextFragment(this.nextLoadPosition,V)}if(!ge)return;ge.initSegment&&!ge.initSegment.data&&!this.bitrateTest&&(ge=ge.initSegment),((p=ge.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((u=ge.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ge,V):this.loadFragment(ge,V,de)},y.loadFragment=function(p,u,o){var E,g=this.fragmentTracker.getState(p);if(this.fragCurrent=p,g===N.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(p);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else g=N.FragmentState.NOT_LOADED}g===N.FragmentState.NOT_LOADED||g===N.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,p,u,o)):g===N.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(p){var u=this.fragmentTracker.getAppendedFrag(p,R.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},y.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,R.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var p=this.levels,u=this.media;if(u!=null&&u.readyState){var o,E=this.getAppendedFrag(u.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!u.paused&&p){var g=this.hls.nextLoadLevel,x=p[g],I=this.fragLastKbps;I&&this.fragCurrent?o=this.fragCurrent.duration*x.maxBitrate/(1e3*I)+1:o=0}else o=0;var j=this.getBufferedFrag(u.currentTime+o);if(j){var G=this.followingBufferedFrag(j);if(G){this.abortCurrentFrag();var V=G.maxStartPTS?G.maxStartPTS:G.start,M=G.duration,F=Math.max(j.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(p,u){m.prototype.flushMainBuffer.call(this,p,u,this.altAudio?"video":null)},y.onMediaAttached=function(p,u){m.prototype.onMediaAttached.call(this,p,u);var o=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new A.default(this.config,o,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var p=this.media,u=p?p.currentTime:null;Object(Z.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(p,u){var o=!1,E=!1,g;u.levels.forEach(function(x){g=x.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(o=!0),g.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=o&&E&&!Object(D.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},y.onLevelLoading=function(p,u){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var E=o[u.level];(!E.details||E.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(E.details))&&(this.state=U.State.WAITING_LEVEL)},y.onLevelLoaded=function(p,u){var o,E=this.levels,g=u.level,x=u.details,I=x.totalduration;if(!E){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+I);var j=this.fragCurrent;j&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==u.level&&j.loader&&(this.state=U.State.IDLE,j.loader.abort()));var G=E[g],V=0;if(x.live||(o=G.details)!==null&&o!==void 0&&o.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;V=this.alignPlaylists(x,G.details)}if(G.details=x,this.levelLastLoaded=g,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:x,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=U.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,V),this.tick()},y._handleFragmentLoadProgress=function(p){var u,o=p.frag,E=p.part,g=p.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var I=x[o.level],j=I.details;if(!j){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var G=I.videoCodec,V=j.PTSKnown||!j.live,M=(u=o.initSegment)===null||u===void 0?void 0:u.data,F=this._getAudioCodec(I),$=this.transmuxer=this.transmuxer||new _.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=E?E.index:-1,de=ie!==-1,ge=new P.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,g.byteLength,ie,de),Le=this.initPTS[o.cc];$.push(g,M,F,G,o,E,j.totalduration,V,ge,Le)},y.onAudioTrackSwitching=function(p,u){var o=this.altAudio,E=!!u.url,g=u.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;o&&I.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:g})}},y.onAudioTrackSwitched=function(p,u){var o=u.id,E=!!this.hls.audioTracks[o].url;if(E){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=E,this.tick()},y.onBufferCreated=function(p,u){var o=u.tracks,E,g,x=!1;for(var I in o){var j=o[I];if(j.id==="main"){if(g=I,E=j,I==="video"){var G=o[I];G&&(this.videoBuffer=G.buffer)}}else x=!0}x&&E?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(p,u){var o=u.frag,E=u.part;if(o&&o.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(E?" p: "+E.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=E?E.stats:o.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,E)},y.onError=function(p,u){switch(u.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,u);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=U.State.ERROR):!u.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var o=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(o=!this.reduceMaxBufferLength(E.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var p=this.media,u=this.gapController;if(!p||!u||!p.readyState)return;var o=H.BufferHelper.getBuffered(p);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(p,u){var o=u.type;if(o!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(o===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,o,R.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(p,u){this.levels=u.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var p=this.media,u=p.currentTime,o=this.startPosition;if(o>=0&&u<o){if(p.seeking){C.logger.log("could not seek to "+o+", already seeking at "+u);return}var E=H.BufferHelper.getBuffered(p),g=E.length?E.start(0):0,x=g-o;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(C.logger.log("adjusting start position by "+x+" to match buffer start"),o+=x,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+u),p.currentTime=o}},y._getAudioCodec=function(p){var u=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},y._loadBitrateTestFrag=function(p){var u=this;this._doFragLoad(p).then(function(o){var E=u.hls;if(!o||E.nextLoadLevel||u.fragContextChanged(p))return;u.fragLoadError=0,u.state=U.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var g=p.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),E.trigger(K.Events.FRAG_LOADED,o)})},y._handleTransmuxComplete=function(p){var u,o="main",E=this.hls,g=p.remuxResult,x=p.chunkMeta,I=this.getCurrentContext(x);if(!I){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var j=I.frag,G=I.part,V=I.level,M=g.video,F=g.text,$=g.id3,ie=g.initSegment,de=this.altAudio?void 0:g.audio;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,ie){ie.tracks&&(this._bufferInitSegment(V,ie.tracks,j,x),E.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:o,tracks:ie.tracks}));var ge=ie.initPTS,Le=ie.timescale;Object(Z.isFiniteNumber)(ge)&&(this.initPTS[j.cc]=ge,E.trigger(K.Events.INIT_PTS_FOUND,{frag:j,id:o,initPTS:ge,timescale:Le}))}if(M&&g.independent!==!1){if(V.details){var Ee=M.startPTS,_e=M.endPTS,Se=M.startDTS,xe=M.endDTS;if(G)G.elementaryStreams[M.type]={startPTS:Ee,endPTS:_e,startDTS:Se,endDTS:xe};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Ee){this.backtrack(j);return}j.setElementaryStreamInfo(M.type,j.start,_e,j.start,xe,!0)}j.setElementaryStreamInfo(M.type,Ee,_e,Se,xe),this.bufferFragmentData(M,j,G,x)}}else if(g.independent===!1){this.backtrack(j);return}if(de){var z=de.startPTS,s=de.endPTS,c=de.startDTS,k=de.endDTS;G&&(G.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:z,endPTS:s,startDTS:c,endDTS:k}),j.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,z,s,c,k),this.bufferFragmentData(de,j,G,x)}if($!=null&&(u=$.samples)!==null&&u!==void 0&&u.length){var X={frag:j,id:o,samples:$.samples};E.trigger(K.Events.FRAG_PARSING_METADATA,X)}if(F){var B={frag:j,id:o,samples:F.samples};E.trigger(K.Events.FRAG_PARSING_USERDATA,B)}},y._bufferInitSegment=function(p,u,o,E){var g=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var x=u.audio,I=u.video,j=u.audiovideo;if(x){var G=p.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(G&&(G.indexOf("mp4a.40.5")!==-1?G="mp4a.40.2":G="mp4a.40.5"),x.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(G="mp4a.40.5")),V.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(G="mp4a.40.2",this.log("Android: force audio codec to "+G)),p.audioCodec&&p.audioCodec!==G&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+G+'"'),x.levelCodec=G,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(G||"")+"/"+(p.audioCodec||"")+"/"+x.codec+"]")}I&&(I.levelCodec=p.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+I.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(M){var F=u[M],$=F.initSegment;$!=null&&$.byteLength&&g.hls.trigger(K.Events.BUFFER_APPENDING,{type:M,data:$,frag:o,part:null,chunkMeta:E,parent:o.type})}),this.tick()},y.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var u=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,u?this.resetFragmentLoading(p):this.state=U.State.BACKTRACKING},y.checkFragmentChanged=function(){var p=this.media,u=null;if(p&&p.readyState>1&&p.seeking===!1){var o=p.currentTime;if(H.BufferHelper.isBuffered(p,o)?u=this.getAppendedFrag(o):H.BufferHelper.isBuffered(p,o+.1)&&(u=this.getAppendedFrag(o+.1)),u){var E=this.fragPlaying,g=u.level;(!E||u.sn!==E.sn||E.level!==g||u.urlId!==E.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:u}),(!E||E.level!==g)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=u)}}},a(L,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var u=this.getAppendedFrag(p.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var u=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"SubtitleStreamController",function(){return l});var Z=O("./src/events.ts"),U=O("./src/utils/logger.ts"),D=O("./src/utils/buffer-helper.ts"),K=O("./src/controller/fragment-finders.ts"),H=O("./src/utils/discontinuities.ts"),N=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),b=O("./src/controller/base-stream-controller.ts"),_=O("./src/types/loader.ts"),P=O("./src/types/level.ts");function A(d,w){for(var v=0;v<w.length;v++){var m=w[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function S(d,w,v){return w&&A(d.prototype,w),v&&A(d,v),d}function C(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,h(d,w)}function h(d,w){return h=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},h(d,w)}var a=500,l=function(d){C(w,d);function w(m,L){var y;return y=d.call(this,m,L,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var v=w.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var L=this.hls;L.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(Z.Events.ERROR,this.onError,this),L.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var L=this.hls;L.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(Z.Events.ERROR,this.onError,this),L.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(a),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(L,y){this.mainDetails=y.details},v.onSubtitleFragProcessed=function(L,y){var f=y.frag,p=y.success;if(this.fragPrevious=f,this.state=b.State.IDLE,!p)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var o,E=f.start,g=0;g<u.length;g++)if(E>=u[g].start&&E<=u[g].end){o=u[g];break}var x=f.start+f.duration;o?o.end=x:(o={start:E,end:x},u.push(o)),this.fragmentTracker.fragBuffered(f)},v.onBufferFlushing=function(L,y){var f=y.startOffset,p=y.endOffset;if(f===0&&p!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,o=this.levels;if(!o.length||!o[u]||!o[u].details)return;var E=o[u].details,g=E.targetduration,x=p-g;if(x<=0)return;y.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(I){for(var j=0;j<I.length;){if(I[j].end<=x){I.shift();continue}else if(I[j].start<x)I[j].start=x;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(f,x,_.PlaylistLevelType.SUBTITLE)}},v.onError=function(L,y){var f,p=y.frag;if(!p||p.type!==_.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},v.onSubtitleTracksUpdated=function(L,y){var f=this,p=y.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(u){return new P.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){f.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(L,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(a)},v.onSubtitleTrackLoaded=function(L,y){var f,p=y.details,u=y.id,o=this.currentTrackId,E=this.levels;if(!E.length)return;var g=E[o];if(u>=E.length||u!==o||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(f=g.details)!==null&&f!==void 0&&f.live){var x=this.mainDetails;if(p.deltaUpdateFailed||!x)return;var I=x.fragments[0];if(!g.details)p.hasProgramDateTime&&x.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(p,x):I&&Object(N.addSliding)(p,I.start);else{var j=this.alignPlaylists(p,g.details);j===0&&I&&Object(N.addSliding)(p,I.start)}}if(g.details=p,this.levelLastLoaded=u,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var G=Object(K.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);G||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},v._handleFragmentLoadComplete=function(L){var y=L.frag,f=L.payload,p=y.decryptdata,u=this.hls;if(this.fragContextChanged(y))return;if(f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(E){var g=performance.now();u.trigger(Z.Events.FRAG_DECRYPTED,{frag:y,payload:E,stats:{tstart:o,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var L,y=this.currentTrackId,f=this.levels;if(!f.length||!f[y]||!f[y].details)return;var p=f[y].details,u=p.targetduration,o=this.config,E=this.media,g=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-u,o.maxBufferHole),x=g.end,I=g.len,j=this.getMaxBufferLength()+u;if(I>j)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var G=p.fragments,V=G.length,M=p.edge,F,$=this.fragPrevious;if(x<M){var ie=o.maxFragLookUpTolerance;$&&p.hasProgramDateTime&&(F=Object(K.findFragmentByPDT)(G,$.endProgramDateTime,ie)),F||(F=Object(K.findFragmentByPTS)($,G,x,ie),!F&&$&&$.start<G[0].start&&(F=G[0]))}else F=G[V-1];(L=F)!==null&&L!==void 0&&L.encrypted?(U.logger.log("Loading key for "+F.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===R.FragmentState.NOT_LOADED&&this.loadFragment(F,p,x)}},v.loadFragment=function(L,y,f){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,y,f)},S(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(b.default)},"./src/controller/subtitle-track-controller.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/events.ts"),U=O("./src/utils/texttrack-utils.ts"),D=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function H(A,S){for(var C=0;C<S.length;C++){var h=S[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function N(A,S,C){return S&&H(A.prototype,S),C&&H(A,C),A}function R(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,b(A,S)}function b(A,S){return b=Object.setPrototypeOf||function(h,a){return h.__proto__=a,h},b(A,S)}var _=function(A){R(S,A);function S(h){var a;return a=A.call(this,h,"[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 C=S.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,A.prototype.destroy.call(this)},C.registerListeners=function(){var a=this.hls;a.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Z.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var a=this.hls;a.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Z.Events.ERROR,this.onError,this)},C.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},C.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},C.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=P(this.media.textTracks);a.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},C.onSubtitleTrackLoaded=function(a,l){var d=l.id,w=l.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+d);return}var L=m.details;m.details=l.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,L))},C.onLevelLoading=function(a,l){this.switchLevel(l.level)},C.onLevelSwitching=function(a,l){this.switchLevel(l.level)},C.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(y){return!d||y.groupId===d});this.tracksInGroup=v;var m=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,L),m!==-1&&this.setSubtitleTrack(m,w)}},C.findTrackId=function(a){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var w=l[d];if((!this.selectDefaultTrack||w.default)&&(!a||a===w.name))return w.id}return-1},C.onError=function(a,l){if(A.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},C.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,w=l.groupId,v=l.url;if(a)try{v=a.addDirectives(v)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:v,id:d,groupId:w,deliveryDirectives:a||null})}},C.toggleTrackModes=function(a){var l=this,d=this.media,w=this.subtitleDisplay,v=this.trackId;if(!d)return;var m=P(d.textTracks),L=m.filter(function(p){return p.groupId===l.groupId});if(a===-1)[].slice.call(m).forEach(function(p){p.mode="disabled"});else{var y=L[v];y&&(y.mode="disabled")}var f=L[a];f&&(f.mode=w?"showing":"hidden")},C.setSubtitleTrack=function(a,l){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(d=w[a])!==null&&d!==void 0&&d.details)||a<-1||a>=w.length)return;this.clearTimer();var v=w[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,v){var m=v.id,L=v.groupId,y=L===void 0?"":L,f=v.name,p=v.type,u=v.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:f,type:p,url:u});var o=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},C.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=P(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")a=d;else if(l[d].mode==="showing"){a=d;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},N(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),S}(D.default);function P(A){for(var S=[],C=0;C<A.length;C++){var h=A[C];h.kind==="subtitles"&&h.label&&S.push(A[C])}return S}J.default=_},"./src/controller/timeline-controller.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"TimelineController",function(){return P});var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/utils/cea-608-parser.ts"),K=O("./src/utils/output-filter.ts"),H=O("./src/utils/webvtt-parser.ts"),N=O("./src/utils/texttrack-utils.ts"),R=O("./src/utils/imsc1-ttml-parser.ts"),b=O("./src/types/loader.ts"),_=O("./src/utils/logger.ts"),P=function(){function h(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new K.default(this,"textTrack1"),w=new K.default(this,"textTrack2"),v=new K.default(this,"textTrack3"),m=new K.default(this,"textTrack4");this.cea608Parser1=new D.default(1,d,w),this.cea608Parser2=new D.default(3,v,m)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=h.prototype;return a.destroy=function(){var d=this.hls;d.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(U.Events.FRAG_LOADING,this.onFragLoading,this),d.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(d,w,v,m,L){for(var y=!1,f=L.length;f--;){var p=L[f],u=S(p[0],p[1],w,v);if(u>=0&&(p[0]=Math.min(p[0],w),p[1]=Math.max(p[1],v),y=!0,u/(v-w)>.5))return}if(y||L.push([w,v]),this.config.renderTextTracksNatively){var o=this.captionsTracks[d];this.Cues.newCue(o,w,v,m)}else{var E=this.Cues.newCue(null,w,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:E,track:d})}},a.onInitPtsFound=function(d,w){var v=this,m=w.frag,L=w.id,y=w.initPTS,f=w.timescale,p=this.unparsedVttFrags;L==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=f),p.length&&(this.unparsedVttFrags=[],p.forEach(function(u){v.onFragLoaded(U.Events.FRAG_LOADED,u)}))},a.getExistingTrack=function(d){var w=this.media;if(w)for(var v=0;v<w.textTracks.length;v++){var m=w.textTracks[v];if(m[d])return m}return null},a.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},a.createNativeTrack=function(d){if(this.captionsTracks[d])return;var w=this.captionsProperties,v=this.captionsTracks,m=this.media,L=w[d],y=L.label,f=L.languageCode,p=this.getExistingTrack(d);if(p)v[d]=p,Object(N.clearCurrentCues)(v[d]),Object(N.sendAddTrackEvent)(v[d],m);else{var u=this.createTextTrack("captions",y,f);u&&(u[d]=!0,v[d]=u)}},a.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var v=w.label,m={_id:d,label:v,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},a.createTextTrack=function(d,w,v){var m=this.media;return m?m.addTextTrack(d,w,v):void 0},a.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},a.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(N.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),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 d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var v=0;v<w.length;v++)Object(N.clearCurrentCues)(w[v])},a.onSubtitleTracksUpdated=function(d,w){var v=this;this.textTracks=[];var m=w.subtitleTracks||[],L=m.some(function(u){return u.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var y=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,o){var E;if(o<f.length){for(var g=null,x=0;x<f.length;x++)if(A(f[x],u)){g=f[x];break}g&&(E=g)}E?Object(N.clearCurrentCues)(E):(E=v.createTextTrack("subtitles",u.name,u.lang),E&&(E.mode="disabled")),E&&(E.groupId=u.groupId,v.textTracks.push(E))})}else if(!y&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},a.onManifestLoaded=function(d,w){var v=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(m){var L=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!L)return;var y="textTrack"+L[1],f=v.captionsProperties[y];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},a.onFragLoading=function(d,w){var v=this.cea608Parser1,m=this.cea608Parser2,L=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(v&&m))return;if(w.frag.type===b.PlaylistLevelType.MAIN){var f,p,u=w.frag.sn,o=(f=w==null||((p=w.part)===null||p===void 0)?void 0:p.index)!=null?f:-1;u===L+1||u===L&&o===y+1||(v.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=o}},a.onFragLoaded=function(d,w){var v=w.frag,m=w.payload,L=this.initPTS,y=this.unparsedVttFrags;if(v.type===b.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(Z.isFiniteNumber)(L[v.cc])){y.push(w),L.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var f=v.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var p=this.tracks[v.level],u=this.vttCCs;u[v.cc]||(u[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===R.IMSC1_CODEC?this._parseIMSC1(v,m):this._parseVTTs(v,m,u)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(d,w){var v=this,m=this.hls;Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(L){v._appendCues(L,d.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){_.logger.log("Failed to parse IMSC1: "+L),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},a._parseVTTs=function(d,w,v){var m=this,L=this.hls;Object(H.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],v,d.cc,d.start,function(y){m._appendCues(y,d.level),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(y){m._fallbackToIMSC1(d,w),_.logger.log("Failed to parse VTT cue: "+y),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:y})})},a._fallbackToIMSC1=function(d,w){var v=this,m=this.tracks[d.level];m.textCodec||Object(R.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=R.IMSC1_CODEC,v._parseIMSC1(d,w)},function(){m.textCodec="wvtt"})},a._appendCues=function(d,w){var v=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[w];if(m.mode==="disabled")return;d.forEach(function(f){return Object(N.addCueToTrack)(m,f)})}else{var L=this.tracks[w],y=L.default?"default":"subtitles"+w;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:d,track:y})}},a.onFragDecrypted=function(d,w){var v=w.frag;if(v.type===b.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(U.Events.FRAG_LOADED,w)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(d,w){var v=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(v&&m))return;for(var L=0;L<w.samples.length;L++){var y=w.samples[L].bytes;if(y){var f=this.extractCea608Data(y);v.addData(w.samples[L].pts,f[0]),m.addData(w.samples[L].pts,f[1])}}},a.onBufferFlushing=function(d,w){var v=w.startOffset,m=w.endOffset,L=w.endOffsetSubtitles,y=w.type,f=this.media;if(!f||f.currentTime<m)return;if(!y||y==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(o){return Object(N.removeCuesInRange)(p[o],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(o){return Object(N.removeCuesInRange)(u[o],v,L)})}},a.extractCea608Data=function(d){for(var w=d[0]&31,v=2,m=[[],[]],L=0;L<w;L++){var y=d[v++],f=127&d[v++],p=127&d[v++],u=(4&y)!==0,o=3&y;if(f===0&&p===0)continue;u&&((o===0||o===1)&&(m[o].push(f),m[o].push(p)))}return m},h}();function A(h,a){return h&&h.label===a.name&&!(h.textTrack1||h.textTrack2)}function S(h,a,l,d){return Math.min(a,d)-Math.max(h,l)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function U(K,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=H}var D=U.prototype;return D.decrypt=function(H,N){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},N,H)},U}()},"./src/crypt/aes-decryptor.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"removePadding",function(){return U}),O.d(J,"default",function(){return D});var Z=O("./src/utils/typed-array.ts");function U(K){var H=K.byteLength,N=H&&new DataView(K.buffer).getUint8(H-1);return N?Object(Z.sliceUint8)(K,0,H-N):K}var D=function(){function K(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=K.prototype;return H.uint8ArrayToUint32Array_=function(R){for(var b=new DataView(R),_=new Uint32Array(4),P=0;P<4;P++)_[P]=b.getUint32(P*4);return _},H.initTable=function(){var R=this.sBox,b=this.invSBox,_=this.subMix,P=_[0],A=_[1],S=_[2],C=_[3],h=this.invSubMix,a=h[0],l=h[1],d=h[2],w=h[3],v=new Uint32Array(256),m=0,L=0,y=0;for(y=0;y<256;y++)y<128?v[y]=y<<1:v[y]=y<<1^283;for(y=0;y<256;y++){var f=L^L<<1^L<<2^L<<3^L<<4;f=f>>>8^f&255^99,R[m]=f,b[f]=m;var p=v[m],u=v[p],o=v[u],E=v[f]*257^f*16843008;P[m]=E<<24|E>>>8,A[m]=E<<16|E>>>16,S[m]=E<<8|E>>>24,C[m]=E,E=o*16843009^u*65537^p*257^m*16843008,a[f]=E<<24|E>>>8,l[f]=E<<16|E>>>16,d[f]=E<<8|E>>>24,w[f]=E,m?(m=p^v[v[v[o^p]]],L^=v[v[L]]):m=L=1}},H.expandKey=function(R){for(var b=this.uint8ArrayToUint32Array_(R),_=!0,P=0;P<b.length&&_;)_=b[P]===this.key[P],P++;if(_)return;this.key=b;var A=this.keySize=b.length;if(A!==4&&A!==6&&A!==8)throw new Error("Invalid aes key size="+A);var S=this.ksRows=(A+6+1)*4,C,h,a=this.keySchedule=new Uint32Array(S),l=this.invKeySchedule=new Uint32Array(S),d=this.sBox,w=this.rcon,v=this.invSubMix,m=v[0],L=v[1],y=v[2],f=v[3],p,u;for(C=0;C<S;C++){if(C<A){p=a[C]=b[C];continue}u=p,C%A===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=w[C/A|0]<<24):A>6&&C%A===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),a[C]=p=(a[C-A]^u)>>>0}for(h=0;h<S;h++)C=S-h,h&3?u=a[C]:u=a[C-4],h<4||C<=4?l[h]=u:l[h]=m[d[u>>>24]]^L[d[u>>>16&255]]^y[d[u>>>8&255]]^f[d[u&255]],l[h]=l[h]>>>0},H.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},H.decrypt=function(R,b,_){for(var P=this.keySize+6,A=this.invKeySchedule,S=this.invSBox,C=this.invSubMix,h=C[0],a=C[1],l=C[2],d=C[3],w=this.uint8ArrayToUint32Array_(_),v=w[0],m=w[1],L=w[2],y=w[3],f=new Int32Array(R),p=new Int32Array(f.length),u,o,E,g,x,I,j,G,V,M,F,$,ie,de,ge=this.networkToHostOrderSwap;b<f.length;){for(V=ge(f[b]),M=ge(f[b+1]),F=ge(f[b+2]),$=ge(f[b+3]),x=V^A[0],I=$^A[1],j=F^A[2],G=M^A[3],ie=4,de=1;de<P;de++)u=h[x>>>24]^a[I>>16&255]^l[j>>8&255]^d[G&255]^A[ie],o=h[I>>>24]^a[j>>16&255]^l[G>>8&255]^d[x&255]^A[ie+1],E=h[j>>>24]^a[G>>16&255]^l[x>>8&255]^d[I&255]^A[ie+2],g=h[G>>>24]^a[x>>16&255]^l[I>>8&255]^d[j&255]^A[ie+3],x=u,I=o,j=E,G=g,ie=ie+4;u=S[x>>>24]<<24^S[I>>16&255]<<16^S[j>>8&255]<<8^S[G&255]^A[ie],o=S[I>>>24]<<24^S[j>>16&255]<<16^S[G>>8&255]<<8^S[x&255]^A[ie+1],E=S[j>>>24]<<24^S[G>>16&255]<<16^S[x>>8&255]<<8^S[I&255]^A[ie+2],g=S[G>>>24]<<24^S[x>>16&255]<<16^S[I>>8&255]<<8^S[j&255]^A[ie+3],p[b]=ge(u^v),p[b+1]=ge(g^m),p[b+2]=ge(E^L),p[b+3]=ge(o^y),v=V,m=M,L=F,y=$,b=b+4}return p.buffer},K}()},"./src/crypt/decrypter.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return b});var Z=O("./src/crypt/aes-crypto.ts"),U=O("./src/crypt/fast-aes-key.ts"),D=O("./src/crypt/aes-decryptor.ts"),K=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),N=O("./src/utils/typed-array.ts"),R=16,b=function(){function _(A,S,C){var h=C===void 0?{}:C,a=h.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=A,this.config=S,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=_.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var C=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(C):C},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(S,C,h,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),C,h);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),C,h).then(a)},P.softwareDecrypt=function(S,C,h){var a=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(S=Object(H.appendUint8Array)(d,S),this.remainderData=null);var w=this.getValidChunk(S);if(!w.length)return null;a&&(h=a);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new D.default),v.expandKey(C);var m=l;return this.currentResult=v.decrypt(w.buffer,0,h),this.currentIV=Object(N.sliceUint8)(w,-16).buffer,m||null},P.webCryptoDecrypt=function(S,C,h){var a=this,l=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new U.default(l,C)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new Z.default(l,h);return w.decrypt(S.buffer,d)}).catch(function(d){return a.onWebCryptoError(d,S,C,h)})},P.onWebCryptoError=function(S,C,h,a){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,h,a)},P.getValidChunk=function(S){var C=S,h=S.length-S.length%R;return h!==S.length&&(C=Object(N.sliceUint8)(S,0,h),this.remainderData=Object(N.sliceUint8)(S,h)),C},P.logOnce=function(S){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},_}()},"./src/crypt/fast-aes-key.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function U(K,H){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=H}var D=U.prototype;return D.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/adts.ts"),D=O("./src/utils/logger.ts"),K=O("./src/demux/id3.ts");function H(b,_){b.prototype=Object.create(_.prototype),b.prototype.constructor=b,N(b,_)}function N(b,_){return N=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},N(b,_)}var R=function(b){H(_,b);function _(A,S){var C;return C=b.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=A,C.config=S,C}var P=_.prototype;return P.resetInitSegment=function(S,C,h){b.prototype.resetInitSegment.call(this,S,C,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},_.probe=function(S){if(!S)return!1;for(var C=K.getID3Data(S,0)||[],h=C.length,a=S.length;h<a;h++)if(U.probe(S,h))return D.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(S,C){return U.canParse(S,C)},P.appendFrame=function(S,C,h){U.initTrackConfig(S,this.observer,C,h,S.manifestCodec);var a=U.appendFrame(S,C,h,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},_}(Z.default);R.minProbeByteLength=9,J.default=R},"./src/demux/adts.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"getAudioConfig",function(){return K}),O.d(J,"isHeaderPattern",function(){return H}),O.d(J,"getHeaderLength",function(){return N}),O.d(J,"getFullFrameLength",function(){return R}),O.d(J,"canGetFrameLength",function(){return b}),O.d(J,"isHeader",function(){return _}),O.d(J,"canParse",function(){return P}),O.d(J,"probe",function(){return A}),O.d(J,"initTrackConfig",function(){return S}),O.d(J,"getFrameDuration",function(){return C}),O.d(J,"parseFrameHeader",function(){return h}),O.d(J,"appendFrame",function(){return a});var Z=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),D=O("./src/events.ts");function K(l,d,w,v){var m,L,y,f,p=navigator.userAgent.toLowerCase(),u=v,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[w+2]&192)>>>6)+1;var E=(d[w+2]&60)>>>2;if(E>o.length-1){l.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return y=(d[w+2]&1)<<2,y|=(d[w+3]&192)>>>6,Z.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+E),/firefox/i.test(p)?E>=6?(m=5,f=new Array(4),L=E-3):(m=2,f=new Array(2),L=E):p.indexOf("android")!==-1?(m=2,f=new Array(2),L=E):(m=5,f=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&E>=6?L=E-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(E>=6&&y===1||/vivaldi/i.test(p))||!v&&y===1)&&(m=2,f=new Array(2)),L=E)),f[0]=m<<3,f[0]|=(E&14)>>1,f[1]|=(E&1)<<7,f[1]|=y<<3,m===5&&(f[1]|=(L&14)>>1,f[2]=(L&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:o[E],channelCount:y,codec:"mp4a.40."+m,manifestCodec:u}}function H(l,d){return l[d]===255&&(l[d+1]&246)===240}function N(l,d){return l[d+1]&1?7:9}function R(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function b(l,d){return d+5<l.length}function _(l,d){return d+1<l.length&&H(l,d)}function P(l,d){return b(l,d)&&H(l,d)&&R(l,d)<=l.length-d}function A(l,d){if(_(l,d)){var w=N(l,d);if(d+w>=l.length)return!1;var v=R(l,d);if(v<=w)return!1;var m=d+v;return m===l.length||_(l,m)}return!1}function S(l,d,w,v,m){if(!l.samplerate){var L=K(d,w,v,m);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function C(l){return 1024*9e4/l}function h(l,d,w,v,m){var L=N(l,d),y=R(l,d);if(y-=L,y>0){var f=w+v*m;return{headerLength:L,frameLength:y,stamp:f}}}function a(l,d,w,v,m){var L=C(l.samplerate),y=h(d,w,v,m,L);if(y){var f=y.frameLength,p=y.headerLength,u=y.stamp,o=p+f,E=Math.max(0,w+o-d.length),g;E?(g=new Uint8Array(o-p),g.set(d.subarray(w+p,d.length),0)):g=d.subarray(w+p,w+o);var x={unit:g,pts:u};return E||l.samples.push(x),{sample:x,length:o,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"initPTSFn",function(){return R});var Z=O("./src/polyfills/number.ts"),U=O("./src/demux/id3.ts"),D=O("./src/demux/dummy-demuxed-track.ts"),K=O("./src/utils/mp4-tools.ts"),H=O("./src/utils/typed-array.ts"),N=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var _=b.prototype;return _.resetInitSegment=function(A,S,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(A,S){return!1},_.appendFrame=function(A,S,C){},_.demux=function(A,S){this.cachedData&&(A=Object(K.appendUint8Array)(this.cachedData,A),this.cachedData=null);var C=U.getID3Data(A,0),h=C?C.length:0,a,l,d=this._audioTrack,w=this._id3Track,v=C?U.getTimeStamp(C):void 0,m=A.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(v,S)),C&&C.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),l=this.initPTS;h<m;){if(this.canParse(A,h)){var L=this.appendFrame(d,A,h);L?(this.frameIndex++,l=L.sample.pts,h+=L.length,a=h):h=m}else U.canParse(A,h)?(C=U.getID3Data(A,h),w.samples.push({pts:l,dts:l,data:C}),h+=C.length,a=h):h++;if(h===m&&a!==m){var y=Object(H.sliceUint8)(A,a);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:d,avcTrack:Object(D.dummyTrack)(),id3Track:w,textTrack:Object(D.dummyTrack)()}},_.demuxSampleAes=function(A,S,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(A){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(D.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(D.dummyTrack)()}},_.destroy=function(){},b}(),R=function(_,P){return Object(Z.isFiniteNumber)(_)?_*90:P*9e4};J.default=N},"./src/demux/chunk-cache.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function D(){this.chunks=[],this.dataLength=0}var K=D.prototype;return K.push=function(N){this.chunks.push(N),this.dataLength+=N.length},K.flush=function(){var N=this.chunks,R=this.dataLength,b;if(N.length)N.length===1?b=N[0]:b=U(N,R);else return new Uint8Array(0);return this.reset(),b},K.reset=function(){this.chunks.length=0,this.dataLength=0},D}();function U(D,K){for(var H=new Uint8Array(K),N=0,R=0;R<D.length;R++){var b=D[R];H.set(b,N),N+=b.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/logger.ts"),U=function(){function D(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var K=D.prototype;return K.loadWord=function(){var N=this.data,R=this.bytesAvailable,b=N.byteLength-R,_=new Uint8Array(4),P=Math.min(4,R);if(P===0)throw new Error("no bytes available");_.set(N.subarray(b,b+P)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},K.skipBits=function(N){var R;this.bitsAvailable>N?(this.word<<=N,this.bitsAvailable-=N):(N-=this.bitsAvailable,R=N>>3,N-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=N,this.bitsAvailable-=N)},K.readBits=function(N){var R=Math.min(this.bitsAvailable,N),b=this.word>>>32-R;return N>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=N-R,R>0&&this.bitsAvailable?b<<R|this.readBits(R):b},K.skipLZ=function(){var N;for(N=0;N<this.bitsAvailable;++N)if((this.word&2147483648>>>N)!==0)return this.word<<=N,this.bitsAvailable-=N,N;return this.loadWord(),N+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var N=this.skipLZ();return this.readBits(N+1)-1},K.readEG=function(){var N=this.readUEG();return 1&N?1+N>>>1:-1*(N>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(N){for(var R=8,b=8,_,P=0;P<N;P++)b!==0&&(_=this.readEG(),b=(R+_+256)%256),R=b===0?R:b},K.readSPS=function(){var N=0,R=0,b=0,_=0,P,A,S,C=this.readUByte.bind(this),h=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),v=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);C();var L=C();if(h(5),d(3),C(),v(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var y=a();if(y===3&&d(1),v(),v(),d(1),l())for(A=y!==3?8:12,S=0;S<A;S++)l()&&(S<6?m(16):m(64))}v();var f=a();if(f===0)a();else if(f===1)for(d(1),w(),w(),P=a(),S=0;S<P;S++)w();v(),d(1);var p=a(),u=a(),o=h(1);o===0&&d(1),d(1),l()&&(N=a(),R=a(),b=a(),_=a());var E=[1,1];if(l()&&l()){var g=C();switch(g){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((p+1)*16-N*2-R*2),height:(2-o)*(u+1)*16-(o?2:4)*(b+_),pixelRatio:E}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();J.default=U},"./src/demux/id3.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isHeader",function(){return Z}),O.d(J,"isFooter",function(){return U}),O.d(J,"getID3Data",function(){return D}),O.d(J,"canParse",function(){return H}),O.d(J,"getTimeStamp",function(){return N}),O.d(J,"isTimeStampFrame",function(){return R}),O.d(J,"getID3Frames",function(){return _}),O.d(J,"decodeFrame",function(){return P}),O.d(J,"utf8ArrayToStr",function(){return a}),O.d(J,"testables",function(){return l});var Z=function(m,L){return L+10<=m.length&&(m[L]===73&&m[L+1]===68&&m[L+2]===51&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},U=function(m,L){return L+10<=m.length&&(m[L]===51&&m[L+1]===68&&m[L+2]===73&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},D=function(m,L){for(var y=L,f=0;Z(m,L);){f+=10;var p=K(m,L+6);f+=p,U(m,L+10)&&(f+=10),L+=f}return f>0?m.subarray(y,y+f):void 0},K=function(m,L){var y=0;return y=(m[L]&127)<<21,y|=(m[L+1]&127)<<14,y|=(m[L+2]&127)<<7,y|=m[L+3]&127,y},H=function(m,L){return Z(m,L)&&K(m,L+6)+10<=m.length-L},N=function(m){for(var L=_(m),y=0;y<L.length;y++){var f=L[y];if(R(f))return h(f)}return},R=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},b=function(m){var L=String.fromCharCode(m[0],m[1],m[2],m[3]),y=K(m,4),f=10;return{type:L,size:y,data:m.subarray(f,f+y)}},_=function(m){for(var L=0,y=[];Z(m,L);){var f=K(m,L+6);L+=10;for(var p=L+f;L+8<p;){var u=b(m.subarray(L)),o=P(u);o&&y.push(o),L+=u.size+10}U(m,L)&&(L+=10)}return y},P=function(m){return m.type==="PRIV"?A(m):m.type[0]==="W"?C(m):S(m)},A=function(m){if(m.size<2)return;var L=a(m.data,!0),y=new Uint8Array(m.data.subarray(L.length+1));return{key:m.type,info:L,data:y.buffer}},S=function(m){if(m.size<2)return;if(m.type==="TXXX"){var L=1,y=a(m.data.subarray(L),!0);L+=y.length+1;var f=a(m.data.subarray(L));return{key:m.type,info:y,data:f}}var p=a(m.data.subarray(1));return{key:m.type,data:p}},C=function(m){if(m.type==="WXXX"){if(m.size<2)return;var L=1,y=a(m.data.subarray(L),!0);L+=y.length+1;var f=a(m.data.subarray(L));return{key:m.type,info:y,data:f}}var p=a(m.data);return{key:m.type,data:p}},h=function(m){if(m.data.byteLength===8){var L=new Uint8Array(m.data),y=L[3]&1,f=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return f/=45,y&&(f+=4772185884e-2),Math.round(f)}return},a=function(m,L){L===void 0&&(L=!1);var y=w();if(y){var f=y.decode(m);if(L){var p=f.indexOf("\0");return p!==-1?f.substring(0,p):f}return f.replace(/\0/g,"")}for(var u=m.length,o,E,g,x="",I=0;I<u;){if(o=m[I++],o===0&&L)return x;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:x+=String.fromCharCode(o);break;case 12:case 13:E=m[I++],x+=String.fromCharCode((o&31)<<6|E&63);break;case 14:E=m[I++],g=m[I++],x+=String.fromCharCode((o&15)<<12|(E&63)<<6|(g&63)<<0);break;default:}}return x},l={decodeTextFrame:S},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/id3.ts"),D=O("./src/utils/logger.ts"),K=O("./src/demux/mpegaudio.ts");function H(b,_){b.prototype=Object.create(_.prototype),b.prototype.constructor=b,N(b,_)}function N(b,_){return N=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},N(b,_)}var R=function(b){H(_,b);function _(){return b.apply(this,arguments)||this}var P=_.prototype;return P.resetInitSegment=function(S,C,h){b.prototype.resetInitSegment.call(this,S,C,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},_.probe=function(S){if(!S)return!1;for(var C=U.getID3Data(S,0)||[],h=C.length,a=S.length;h<a;h++)if(K.probe(S,h))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(S,C){return K.canParse(S,C)},P.appendFrame=function(S,C,h){return this.initPTS===null?void 0:K.appendFrame(S,C,h,this.initPTS,this.frameIndex)},_}(Z.default);R.minProbeByteLength=4,J.default=R},"./src/demux/mp4demuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/mp4-tools.ts"),U=O("./src/demux/dummy-demuxed-track.ts"),D=function(){function K(N,R){this.remainderData=null,this.config=void 0,this.config=R}var H=K.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},K.probe=function(R){return Object(Z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},H.demux=function(R){var b=R,_=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(Z.appendUint8Array)(this.remainderData,R));var P=Object(Z.segmentValidRange)(b);this.remainderData=P.remainder,_.samples=P.valid||new Uint8Array}else _.samples=b;return{audioTrack:Object(U.dummyTrack)(),avcTrack:_,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.flush=function(){var R=Object(U.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:R,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(R,b,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},K}();D.minProbeByteLength=1024,J.default=D},"./src/demux/mpegaudio.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"appendFrame",function(){return N}),O.d(J,"parseHeader",function(){return R}),O.d(J,"isHeaderPattern",function(){return b}),O.d(J,"isHeader",function(){return _}),O.d(J,"canParse",function(){return P}),O.d(J,"probe",function(){return A});var Z=null,U=[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],D=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function N(S,C,h,a,l){if(h+24>C.length)return;var d=R(C,h);if(d&&h+d.frameLength<=C.length){var w=d.samplesPerFrame*9e4/d.sampleRate,v=a+l*w,m={unit:C.subarray(h,h+d.frameLength),pts:v,dts:v};return S.config=[],S.channelCount=d.channelCount,S.samplerate=d.sampleRate,S.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function R(S,C){var h=S[C+1]>>3&3,a=S[C+1]>>1&3,l=S[C+2]>>4&15,d=S[C+2]>>2&3;if(h!==1&&l!==0&&l!==15&&d!==3){var w=S[C+2]>>1&1,v=S[C+3]>>6,m=h===3?3-a:a===3?3:4,L=U[m*14+l-1]*1e3,y=h===3?0:h===2?1:2,f=D[y*3+d],p=v===3?1:2,u=K[h][a],o=H[a],E=u*8*o,g=Math.floor(u*L/f+w)*o;if(Z===null){var x=navigator.userAgent||"",I=x.match(/Chrome\/(\d+)/i);Z=I?parseInt(I[1]):0}var j=!!Z&&Z<=87;return j&&a===2&&L>=224e3&&v===0&&(S[C+3]=S[C+3]|128),{sampleRate:f,channelCount:p,frameLength:g,samplesPerFrame:E}}}function b(S,C){return S[C]===255&&(S[C+1]&224)===224&&(S[C+1]&6)!==0}function _(S,C){return C+1<S.length&&b(S,C)}function P(S,C){var h=4;return b(S,C)&&h<=S.length-C}function A(S,C){if(C+1<S.length&&b(S,C)){var h=4,a=R(S,C),l=h;a!=null&&a.frameLength&&(l=a.frameLength);var d=C+l;return d===S.length||_(S,d)}return!1}},"./src/demux/sample-aes.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/crypt/decrypter.ts"),U=O("./src/demux/tsdemuxer.ts"),D=function(){function K(N,R,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new Z.default(N,R,{removePKCS7Padding:!1})}var H=K.prototype;return H.decryptBuffer=function(R,b){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,b)},H.decryptAacSample=function(R,b,_,P){var A=R[b].unit,S=A.subarray(16,A.length-A.length%16),C=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),h=this;this.decryptBuffer(C,function(a){var l=new Uint8Array(a);A.set(l,16),P||h.decryptAacSamples(R,b+1,_)})},H.decryptAacSamples=function(R,b,_){for(;;b++){if(b>=R.length){_();return}if(R[b].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(R,b,_,P),!P)return}},H.getAvcEncryptedData=function(R){for(var b=Math.floor((R.length-48)/160)*16+16,_=new Int8Array(b),P=0,A=32;A<=R.length-16;A+=160,P+=16)_.set(R.subarray(A,A+16),P);return _},H.getAvcDecryptedUnit=function(R,b){for(var _=new Uint8Array(b),P=0,A=32;A<=R.length-16;A+=160,P+=16)R.set(_.subarray(P,P+16),A);return R},H.decryptAvcSample=function(R,b,_,P,A,S){var C=Object(U.discardEPB)(A.data),h=this.getAvcEncryptedData(C),a=this;this.decryptBuffer(h.buffer,function(l){A.data=a.getAvcDecryptedUnit(C,l),S||a.decryptAvcSamples(R,b,_+1,P)})},H.decryptAvcSamples=function(R,b,_,P){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,_=0){if(b>=R.length){P();return}for(var A=R[b].units;!(_>=A.length);_++){var S=A[_];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(R,b,_,P,S,C),!C)return}}},K}();J.default=D},"./src/demux/transmuxer-interface.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return A});var Z=O("./node_modules/webworkify-webpack/index.js"),U=O.n(Z),D=O("./src/events.ts"),K=O("./src/demux/transmuxer.ts"),H=O("./src/utils/logger.ts"),N=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),b=O("./node_modules/eventemitter3/index.js"),_=O.n(b),P=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},A=function(){function S(h,a,l,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=a,this.onTransmuxComplete=l,this.onFlush=d;var v=h.config,m=function(u,o){o=o||{},o.frag=w.frag,o.id=w.id,h.trigger(u,o)};this.observer=new b.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,m),this.observer.on(D.Events.ERROR,m);var L={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var f;try{f=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(p){h.trigger(D.Events.ERROR,{type:N.ErrorTypes.OTHER_ERROR,details:N.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},f.postMessage({cmd:"init",typeSupported:L,vendor:y,id:a,config:JSON.stringify(v)})}catch(p){H.logger.warn("Error in worker:",p),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new K.default(this.observer,L,v,y,a),this.worker=null}}else this.transmuxer=new K.default(this.observer,L,v,y,a)}var C=S.prototype;return C.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},C.push=function(a,l,d,w,v,m,L,y,f,p){var u=this;f.transmuxing.start=self.performance.now();var o=this.transmuxer,E=this.worker,g=m?m.start:v.start,x=v.decryptdata,I=this.frag,j=!(I&&v.cc===I.cc),G=!(I&&f.level===I.level),V=I?f.sn-I.sn:-1,M=this.part?f.part-this.part.index:1,F=!G&&(V===1||V===0&&M===1),$=self.performance.now();(G||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),m&&(M||!F)&&(m.stats.parsing.start=$);var ie=new K.TransmuxState(j,F,y,G,g);if(!F||j){H.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+j+`
trackSwitch: `+G+`
contiguous: `+F+`
accurateTimeOffset: `+y+`
timeOffset: `+g);var de=new K.TransmuxConfig(d,w,l,L,p);this.configureTransmuxer(de)}if(this.frag=v,this.part=m,E)E.postMessage({cmd:"demux",data:a,decryptdata:x,chunkMeta:f,state:ie},a instanceof ArrayBuffer?[a]:[]);else if(o){var ge=o.push(a,x,f,ie);Object(K.isPromise)(ge)?ge.then(function(Le){u.handleTransmuxComplete(Le)}):this.handleTransmuxComplete(ge)}},C.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:a});else if(d){var v=d.flush(a);Object(K.isPromise)(v)?v.then(function(m){l.handleFlushResult(m,a)}):this.handleFlushResult(v,a)}},C.handleFlushResult=function(a,l){var d=this;a.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(l)},C.onWorkerMessage=function(a){var l=a.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},C.configureTransmuxer=function(a){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):d&&d.configure(a)},C.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},S}()},"./src/demux/transmuxer-worker.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return N});var Z=O("./src/demux/transmuxer.ts"),U=O("./src/events.ts"),D=O("./src/utils/logger.ts"),K=O("./node_modules/eventemitter3/index.js"),H=O.n(K);function N(A){var S=new K.EventEmitter,C=function(a,l){A.postMessage({event:a,data:l})};S.on(U.Events.FRAG_DECRYPTED,C),S.on(U.Events.ERROR,C),A.addEventListener("message",function(h){var a=h.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);A.transmuxer=new Z.default(S,a.typeSupported,l,a.vendor,a.id),Object(D.enableLogs)(l.debug),C("init",null);break}case"configure":{A.transmuxer.configure(a.config);break}case"demux":{var d=A.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Z.isPromise)(d)?d.then(function(m){R(A,m)}):R(A,d);break}case"flush":{var w=a.chunkMeta,v=A.transmuxer.flush(w);Object(Z.isPromise)(v)?v.then(function(m){_(A,m,w)}):_(A,v,w);break}default:break}})}function R(A,S){if(P(S.remuxResult))return;var C=[],h=S.remuxResult,a=h.audio,l=h.video;a&&b(C,a),l&&b(C,l),A.postMessage({event:"transmuxComplete",data:S},C)}function b(A,S){S.data1&&A.push(S.data1.buffer),S.data2&&A.push(S.data2.buffer)}function _(A,S,C){S.forEach(function(h){R(A,h)}),A.postMessage({event:"flush",data:C})}function P(A){return!A.audio&&!A.video&&!A.text&&!A.id3&&!A.initSegment}},"./src/demux/transmuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return l}),O.d(J,"isPromise",function(){return v}),O.d(J,"TransmuxConfig",function(){return m}),O.d(J,"TransmuxState",function(){return L});var Z=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/crypt/decrypter.ts"),K=O("./src/demux/aacdemuxer.ts"),H=O("./src/demux/mp4demuxer.ts"),N=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),b=O("./src/remux/mp4-remuxer.ts"),_=O("./src/remux/passthrough-remuxer.ts"),P=O("./src/demux/chunk-cache.ts"),A=O("./src/utils/mp4-tools.ts"),S=O("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(y){S.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var h=[{demux:N.default,remux:b.default},{demux:H.default,remux:_.default},{demux:K.default,remux:b.default},{demux:R.default,remux:b.default}],a=1024;h.forEach(function(y){var f=y.demux;a=Math.max(a,f.minProbeByteLength)});var l=function(){function y(p,u,o,E,g){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 P.default,this.observer=p,this.typeSupported=u,this.config=o,this.vendor=E,this.id=g}var f=y.prototype;return f.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},f.push=function(u,o,E,g){var x=this,I=E.transmuxing;I.executeStart=C();var j=new Uint8Array(u),G=this.cache,V=this.config,M=this.currentTransmuxState,F=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=d(j,o);if($&&$.method==="AES-128"){var ie=this.getDecrypter();if(V.enableSoftwareAES){var de=ie.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!de)return I.executeEnd=C(),w(E);j=new Uint8Array(de)}else return this.decryptionPromise=ie.webCryptoDecrypt(j,$.key.buffer,$.iv.buffer).then(function(ve){var Te=x.push(ve,null,E);return x.decryptionPromise=null,Te}),this.decryptionPromise}var ge=g||M,Le=ge.contiguous,Ee=ge.discontinuity,_e=ge.trackSwitch,Se=ge.accurateTimeOffset,xe=ge.timeOffset,me=F.audioCodec,z=F.videoCodec,s=F.defaultInitPts,c=F.duration,k=F.initSegmentData;if((Ee||_e)&&this.resetInitSegment(k,me,z,c),Ee&&this.resetInitialTimestamp(s),Le||this.resetContiguity(),this.needsProbing(j,Ee,_e)){if(G.dataLength){var X=G.flush();j=Object(A.appendUint8Array)(X,j)}this.configureTransmuxer(j,F)}var B=this.transmux(j,$,xe,Se,E),se=this.currentTransmuxState;return se.contiguous=!0,se.discontinuity=!1,se.trackSwitch=!1,I.executeEnd=C(),B},f.flush=function(u){var o=this,E=u.transmuxing;E.executeStart=C();var g=this.decrypter,x=this.cache,I=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return o.flush(u)});var G=[],V=I.timeOffset;if(g){var M=g.flush();M&&G.push(this.push(M,null,u))}var F=x.dataLength;x.reset();var $=this.demuxer,ie=this.remuxer;if(!$||!ie)return F>=a&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=C(),[w(u)];var de=$.flush(V);return v(de)?de.then(function(ge){return o.flushRemux(G,ge,u),G}):(this.flushRemux(G,de,u),G)},f.flushRemux=function(u,o,E){var g=o.audioTrack,x=o.avcTrack,I=o.id3Track,j=o.textTrack,G=this.currentTransmuxState,V=G.accurateTimeOffset,M=G.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var F=this.remuxer.remux(g,x,I,j,M,V,!0,this.id);u.push({remuxResult:F,chunkMeta:E}),E.transmuxing.executeEnd=C()},f.resetInitialTimestamp=function(u){var o=this.demuxer,E=this.remuxer;if(!o||!E)return;o.resetTimeStamp(u),E.resetTimeStamp(u)},f.resetContiguity=function(){var u=this.demuxer,o=this.remuxer;if(!u||!o)return;u.resetContiguity(),o.resetNextTimestamp()},f.resetInitSegment=function(u,o,E,g){var x=this.demuxer,I=this.remuxer;if(!x||!I)return;x.resetInitSegment(o,E,g),I.resetInitSegment(u,o,E)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(u,o,E,g,x){var I;return o&&o.method==="SAMPLE-AES"?I=this.transmuxSampleAes(u,o,E,g,x):I=this.transmuxUnencrypted(u,E,g,x),I},f.transmuxUnencrypted=function(u,o,E,g){var x=this.demuxer.demux(u,o,!1,!this.config.progressive),I=x.audioTrack,j=x.avcTrack,G=x.id3Track,V=x.textTrack,M=this.remuxer.remux(I,j,G,V,o,E,!1,this.id);return{remuxResult:M,chunkMeta:g}},f.transmuxSampleAes=function(u,o,E,g,x){var I=this;return this.demuxer.demuxSampleAes(u,o,E).then(function(j){var G=I.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,E,g,!1,I.id);return{remuxResult:G,chunkMeta:x}})},f.configureTransmuxer=function(u,o){for(var E=this.config,g=this.observer,x=this.typeSupported,I=this.vendor,j=o.audioCodec,G=o.defaultInitPts,V=o.duration,M=o.initSegmentData,F=o.videoCodec,$,ie=0,de=h.length;ie<de;ie++)if(h[ie].demux.probe(u)){$=h[ie];break}$||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:H.default,remux:_.default});var ge=this.demuxer,Le=this.remuxer,Ee=$.remux,_e=$.demux;(!Le||!(Le instanceof Ee))&&(this.remuxer=new Ee(g,E,x,I)),(!ge||!(ge instanceof _e))&&(this.demuxer=new _e(g,E,x),this.probe=_e.probe),this.resetInitSegment(M,j,F,V),this.resetInitialTimestamp(G)},f.needsProbing=function(u,o,E){return!this.demuxer||!this.remuxer||o||E},f.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new D.default(this.observer,this.config)),u},y}();function d(y,f){var p=null;return y.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(p=f),p}var w=function(f){return{remuxResult:{},chunkMeta:f}};function v(y){return"then"in y&&y.then instanceof Function}var m=function(f,p,u,o,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=p,this.initSegmentData=u,this.duration=o,this.defaultInitPts=E},L=function(f,p,u,o,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=p,this.accurateTimeOffset=u,this.trackSwitch=o,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"discardEPB",function(){return w});var Z=O("./src/demux/adts.ts"),U=O("./src/demux/mpegaudio.ts"),D=O("./src/demux/exp-golomb.ts"),K=O("./src/demux/id3.ts"),H=O("./src/demux/sample-aes.ts"),N=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),b=O("./src/utils/logger.ts"),_=O("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},A=function(){function v(L,y,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=y,this.typeSupported=f}v.probe=function(y){var f=v.syncOffset(y);return f<0?!1:(f&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},v.syncOffset=function(y){for(var f=Math.min(1e3,y.length-3*188),p=0;p<f;){if(y[p]===71&&y[p+188]===71&&y[p+2*188]===71)return p;p++}return-1},v.createTrack=function(y,f){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:P[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?f:void 0}};var m=v.prototype;return m.resetInitSegment=function(y,f,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",p),this._audioTrack=v.createTrack("audio",p),this._id3Track=v.createTrack("id3",p),this._txtTrack=v.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=f,this._duration=p},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,f=this._avcTrack,p=this._id3Track;y&&(y.pesData=null),f&&(f.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,f,p,u){p===void 0&&(p=!1),u===void 0&&(u=!1),p||(this.sampleAes=null);var o,E=this._avcTrack,g=this._audioTrack,x=this._id3Track,I=E.pid,j=E.pesData,G=g.pid,V=x.pid,M=g.pesData,F=x.pesData,$=!1,ie=this.pmtParsed,de=this._pmtId,ge=y.length;if(this.remainderData&&(y=Object(R.appendUint8Array)(this.remainderData,y),ge=y.length,this.remainderData=null),ge<188&&!u)return this.remainderData=y,{audioTrack:g,avcTrack:E,id3Track:x,textTrack:this._txtTrack};var Le=Math.max(0,v.syncOffset(y));ge-=(ge+Le)%188,ge<y.byteLength&&!u&&(this.remainderData=new Uint8Array(y.buffer,ge,y.buffer.byteLength-ge));for(var Ee=Le;Ee<ge;Ee+=188)if(y[Ee]===71){var _e=!!(y[Ee+1]&64),Se=((y[Ee+1]&31)<<8)+y[Ee+2],xe=(y[Ee+3]&48)>>4,me=void 0;if(xe>1){if(me=Ee+5+y[Ee+4],me===Ee+188)continue}else me=Ee+4;switch(Se){case I:_e&&(j&&(o=a(j))&&this.parseAVCPES(o,!1),j={data:[],size:0}),j&&(j.data.push(y.subarray(me,Ee+188)),j.size+=Ee+188-me);break;case G:_e&&(M&&(o=a(M))&&(g.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),M={data:[],size:0}),M&&(M.data.push(y.subarray(me,Ee+188)),M.size+=Ee+188-me);break;case V:_e&&(F&&(o=a(F))&&this.parseID3PES(o),F={data:[],size:0}),F&&(F.data.push(y.subarray(me,Ee+188)),F.size+=Ee+188-me);break;case 0:_e&&(me+=y[me]+1),de=this._pmtId=C(y,me);break;case de:{_e&&(me+=y[me]+1);var z=h(y,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);I=z.avc,I>0&&(E.pid=I),G=z.audio,G>0&&(g.pid=G,g.isAAC=z.isAAC),V=z.id3,V>0&&(x.pid=V),$&&!ie&&(b.logger.log("reparse from beginning"),$=!1,Ee=Le-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=j,g.pesData=M,x.pesData=F;var s={audioTrack:g,avcTrack:E,id3Track:x,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(s),s},m.flush=function(){var y=this.remainderData;this.remainderData=null;var f;return y?f=this.demux(y,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(y){var f=y.audioTrack,p=y.avcTrack,u=y.id3Track,o=p.pesData,E=f.pesData,g=u.pesData,x;o&&(x=a(o))?(this.parseAVCPES(x,!0),p.pesData=null):p.pesData=o,E&&(x=a(E))?(f.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),f.pesData=null):(E!=null&&E.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),g&&(x=a(g))?(this.parseID3PES(x),u.pesData=null):u.pesData=g},m.demuxSampleAes=function(y,f,p){var u=this.demux(y,p,!0,!this.config.progressive),o=this.sampleAes=new H.default(this.observer,this.config,f);return this.decrypt(u,o)},m.decrypt=function(y,f){return new Promise(function(p){var u=y.audioTrack,o=y.avcTrack;u.samples&&u.isAAC?f.decryptAacSamples(u.samples,0,function(){o.samples?f.decryptAvcSamples(o.samples,0,0,function(){p(y)}):p(y)}):o.samples&&f.decryptAvcSamples(o.samples,0,0,function(){p(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,f){var p=this,u=this._avcTrack,o=this.parseAVCNALu(y.data),E=!1,g=this.avcSample,x,I=!1;y.data=null,g&&o.length&&!u.audFound&&(l(g,u),g=this.avcSample=S(!1,y.pts,y.dts,"")),o.forEach(function(j){switch(j.type){case 1:{x=!0,g||(g=p.avcSample=S(!0,y.pts,y.dts,"")),E&&(g.debug+="NDR "),g.frame=!0;var G=j.data;if(I&&G.length>4){var V=new D.default(G).readSliceType();(V===2||V===4||V===7||V===9)&&(g.key=!0)}break}case 5:x=!0,g||(g=p.avcSample=S(!0,y.pts,y.dts,"")),E&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{x=!0,E&&g&&(g.debug+="SEI ");var M=new D.default(w(j.data));M.readUByte();for(var F=0,$=0,ie=!1,de=0;!ie&&M.bytesAvailable>1;){F=0;do de=M.readUByte(),F+=de;while(de===255);$=0;do de=M.readUByte(),$+=de;while(de===255);if(F===4&&M.bytesAvailable!==0){ie=!0;var ge=M.readUByte();if(ge===181){var Le=M.readUShort();if(Le===49){var Ee=M.readUInt();if(Ee===1195456820){var _e=M.readUByte();if(_e===3){for(var Se=M.readUByte(),xe=M.readUByte(),me=31&Se,z=[Se,xe],s=0;s<me;s++)z.push(M.readUByte()),z.push(M.readUByte()),z.push(M.readUByte());d(p._txtTrack.samples,{type:3,pts:y.pts,bytes:z})}}}}}else if(F===5&&M.bytesAvailable!==0){if(ie=!0,$>16){for(var c=[],k=0;k<16;k++)c.push(M.readUByte().toString(16)),(k===3||k===5||k===7||k===9)&&c.push("-");for(var X=$-16,B=new Uint8Array(X),se=0;se<X;se++)B[se]=M.readUByte();d(p._txtTrack.samples,{pts:y.pts,payloadType:F,uuid:c.join(""),userData:Object(K.utf8ArrayToStr)(B),userDataBytes:B})}}else if($<M.bytesAvailable)for(var ve=0;ve<$;ve++)M.readUByte()}break}case 7:if(x=!0,I=!0,E&&g&&(g.debug+="SPS "),!u.sps){var Te=new D.default(j.data),Pe=Te.readSPS();u.width=Pe.width,u.height=Pe.height,u.pixelRatio=Pe.pixelRatio,u.sps=[j.data],u.duration=p._duration;for(var Ae=j.data.subarray(1,4),De="avc1.",ke=0;ke<3;ke++){var Fe=Ae[ke].toString(16);Fe.length<2&&(Fe="0"+Fe),De+=Fe}u.codec=De}break;case 8:x=!0,E&&g&&(g.debug+="PPS "),u.pps||(u.pps=[j.data]);break;case 9:x=!1,u.audFound=!0,g&&l(g,u),g=p.avcSample=S(!1,y.pts,y.dts,E?"AUD ":"");break;case 12:x=!1;break;default:x=!1,g&&(g.debug+="unknown NAL "+j.type+" ");break}if(g&&x){var je=g.units;je.push(j)}}),f&&g&&(l(g,u),this.avcSample=null)},m.getLastNalUnit=function(){var y,f=this.avcSample,p;if(!f||f.units.length===0){var u=this._avcTrack.samples;f=u[u.length-1]}if((y=f)!==null&&y!==void 0&&y.units){var o=f.units;p=o[o.length-1]}return p},m.parseAVCNALu=function(y){var f=y.byteLength,p=this._avcTrack,u=p.naluState||0,o=u,E=[],g=0,x,I,j,G=-1,V=0;for(u===-1&&(G=0,V=y[0]&31,u=0,g=1);g<f;){if(x=y[g++],!u){u=x?0:1;continue}if(u===1){u=x?0:2;continue}if(!x)u=3;else if(x===1){if(G>=0){var M={data:y.subarray(G,g-u-1),type:V};E.push(M)}else{var F=this.getLastNalUnit();if(F&&(o&&g<=4-o&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-o))),I=g-u-1,I>0)){var $=new Uint8Array(F.data.byteLength+I);$.set(F.data,0),$.set(y.subarray(0,I),F.data.byteLength),F.data=$,F.state=0}}g<f?(j=y[g]&31,G=g,V=j,u=0):u=-1}else u=0}if(G>=0&&u>=0){var ie={data:y.subarray(G,f),type:V,state:u};E.push(ie)}if(E.length===0){var de=this.getLastNalUnit();if(de){var ge=new Uint8Array(de.data.byteLength+y.byteLength);ge.set(de.data,0),ge.set(y,de.data.byteLength),de.data=ge}}return p.naluState=u,E},m.parseAACPES=function(y){var f=0,p=this._audioTrack,u=this.aacOverFlow,o=y.data;if(u){this.aacOverFlow=null;var E=u.sample.unit.byteLength,g=Math.min(u.missing,E),x=E-g;u.sample.unit.set(o.subarray(0,g),x),p.samples.push(u.sample),f=u.missing}var I,j;for(I=f,j=o.length;I<j-1&&!Z.isHeader(o,I);I++);if(I!==f){var G,V;if(I<j-1?(G="AAC PES did not start with ADTS header,offset:"+I,V=!1):(G="no ADTS header found in AAC PES",V=!0),b.logger.warn("parsing error:"+G),this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:G}),V)return}Z.initTrackConfig(p,this.observer,o,I,this.audioCodec);var M;if(y.pts!==void 0)M=y.pts;else if(u){var F=Z.getFrameDuration(p.samplerate);M=u.sample.pts+F}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;I<j;)if(Z.isHeader(o,I)){if(I+5<j){var ie=Z.appendFrame(p,o,I,M,$);if(ie)if(ie.missing)this.aacOverFlow=ie;else{I+=ie.length,$++;continue}}break}else I++},m.parseMPEGPES=function(y){var f=y.data,p=f.length,u=0,o=0,E=y.pts;if(E===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<p;)if(U.isHeader(f,o)){var g=U.appendFrame(this._audioTrack,f,o,E,u);if(g)o+=g.length,u++;else break}else o++},m.parseID3PES=function(y){if(y.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},v}();A.minProbeByteLength=188;function S(v,m,L,y){return{key:v,frame:!1,pts:m,dts:L,units:[],debug:y,length:0}}function C(v,m){return(v[m+10]&31)<<8|v[m+11]}function h(v,m,L,y){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[m+1]&15)<<8|v[m+2],u=m+3+p-4,o=(v[m+10]&15)<<8|v[m+11];for(m+=12+o;m<u;){var E=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!y){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=E);break;case 21:f.id3===-1&&(f.id3=E);break;case 219:if(!y){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=E);break;case 3:case 4:L?f.audio===-1&&(f.audio=E,f.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((v[m+3]&15)<<8|v[m+4])+5}return f}function a(v){var m=0,L,y,f,p,u,o=v.data;if(!v||v.size===0)return null;for(;o[0].length<19&&o.length>1;){var E=new Uint8Array(o[0].length+o[1].length);E.set(o[0]),E.set(o[1],o[0].length),o[0]=E,o.splice(1,1)}L=o[0];var g=(L[0]<<16)+(L[1]<<8)+L[2];if(g===1){if(y=(L[4]<<8)+L[5],y&&y>v.size-6)return null;var x=L[7];x&192&&(p=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,x&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,p-u>60*9e4&&(b.logger.warn(Math.round((p-u)/9e4)+"s delta between PTS and DTS, align them"),p=u)):u=p),f=L[8];var I=f+9;if(v.size<=I)return null;v.size-=I;for(var j=new Uint8Array(v.size),G=0,V=o.length;G<V;G++){L=o[G];var M=L.byteLength;if(I)if(I>M){I-=M;continue}else L=L.subarray(I),M-=I,I=0;j.set(L,m),m+=M}return y&&(y-=f+3),{data:j,pts:p,dts:u,len:y}}return null}function l(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var L=m.samples,y=L.length;if(y){var f=L[y-1];v.pts=f.pts,v.dts=f.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&b.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function d(v,m){var L=v.length;if(L>0){if(m.pts>=v[L-1].pts)v.push(m);else for(var y=L-1;y>=0;y--)if(m.pts<v[y].pts){v.splice(y,0,m);break}}else v.push(m)}function w(v){for(var m=v.byteLength,L=[],y=1;y<m-2;)v[y]===0&&v[y+1]===0&&v[y+2]===3?(L.push(y+2),y+=2):y++;if(L.length===0)return v;var f=m-L.length,p=new Uint8Array(f),u=0;for(y=0;y<f;u++,y++)u===L[0]&&(u++,L.shift()),p[y]=v[u];return p}J.default=A},"./src/errors.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ErrorTypes",function(){return Z}),O.d(J,"ErrorDetails",function(){return U});var Z;(function(D){D.NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError"})(Z||(Z={}));var U;(function(D){D.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",D.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",D.KEY_SYSTEM_NO_SESSION="keySystemNoSession",D.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",D.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",D.MANIFEST_LOAD_ERROR="manifestLoadError",D.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",D.MANIFEST_PARSING_ERROR="manifestParsingError",D.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",D.LEVEL_EMPTY_ERROR="levelEmptyError",D.LEVEL_LOAD_ERROR="levelLoadError",D.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",D.LEVEL_SWITCH_ERROR="levelSwitchError",D.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",D.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",D.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",D.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",D.FRAG_LOAD_ERROR="fragLoadError",D.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",D.FRAG_DECRYPT_ERROR="fragDecryptError",D.FRAG_PARSING_ERROR="fragParsingError",D.REMUX_ALLOC_ERROR="remuxAllocError",D.KEY_LOAD_ERROR="keyLoadError",D.KEY_LOAD_TIMEOUT="keyLoadTimeOut",D.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",D.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",D.BUFFER_APPEND_ERROR="bufferAppendError",D.BUFFER_APPENDING_ERROR="bufferAppendingError",D.BUFFER_STALLED_ERROR="bufferStalledError",D.BUFFER_FULL_ERROR="bufferFullError",D.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",D.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",D.INTERNAL_EXCEPTION="internalException",D.INTERNAL_ABORTED="aborted",D.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"Events",function(){return Z});var Z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return v});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Z),D=O("./src/loader/playlist-loader.ts"),K=O("./src/loader/key-loader.ts"),H=O("./src/controller/id3-track-controller.ts"),N=O("./src/controller/latency-controller.ts"),R=O("./src/controller/level-controller.ts"),b=O("./src/controller/fragment-tracker.ts"),_=O("./src/controller/stream-controller.ts"),P=O("./src/is-supported.ts"),A=O("./src/utils/logger.ts"),S=O("./src/config.ts"),C=O("./node_modules/eventemitter3/index.js"),h=O.n(C),a=O("./src/events.ts"),l=O("./src/errors.ts");function d(m,L){for(var y=0;y<L.length;y++){var f=L[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function w(m,L,y){return L&&d(m.prototype,L),y&&d(m,y),m}var v=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new C.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 f=this.config=Object(S.mergeConfig)(m.DefaultConfig,y);this.userConfig=y,Object(A.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(S.enableStreamingMode)(f);var p=f.abrController,u=f.bufferController,o=f.capLevelController,E=f.fpsController,g=this.abrController=new p(this),x=this.bufferController=new u(this),I=this.capLevelController=new o(this),j=new E(this),G=new D.default(this),V=new K.default(this),M=new H.default(this),F=this.levelController=new R.default(this),$=new b.FragmentTracker(this),ie=this.streamController=new _.default(this,$);I.setStreamController(ie),j.setStreamController(ie);var de=[F,ie];this.networkControllers=de;var ge=[G,V,g,x,I,j,M,$];this.audioTrackController=this.createController(f.audioTrackController,null,de),this.createController(f.audioStreamController,$,de),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,de),this.createController(f.subtitleStreamController,$,de),this.createController(f.timelineController,null,ge),this.emeController=this.createController(f.emeController,null,ge),this.cmcdController=this.createController(f.cmcdController,null,ge),this.latencyController=this.createController(N.default,null,ge),this.coreComponents=ge}var L=m.prototype;return L.createController=function(f,p,u){if(f){var o=p?new f(this,p):new f(this);return u&&u.push(o),o}return null},L.on=function(f,p,u){u===void 0&&(u=this),this._emitter.on(f,p,u)},L.once=function(f,p,u){u===void 0&&(u=this),this._emitter.once(f,p,u)},L.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},L.off=function(f,p,u,o){u===void 0&&(u=this),this._emitter.off(f,p,u,o)},L.listeners=function(f){return this._emitter.listeners(f)},L.emit=function(f,p,u){return this._emitter.emit(f,p,u)},L.trigger=function(f,p){if(this.config.debug)return this.emit(f,f,p);try{return this.emit(f,f,p)}catch(u){A.logger.error("An internal error happened while handling event "+f+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:u})}return!1},L.listenerCount=function(f){return this._emitter.listenerCount(f)},L.destroy=function(){A.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},L.attachMedia=function(f){A.logger.log("attachMedia"),this._media=f,this.trigger(a.Events.MEDIA_ATTACHING,{media:f})},L.detachMedia=function(){A.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(f){this.stopLoad();var p=this.media,u=this.url,o=this.url=Z.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});A.logger.log("loadSource:"+o),p&&u&&u!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(a.Events.MANIFEST_LOADING,{url:f})},L.startLoad=function(f){f===void 0&&(f=-1),A.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(p){p.startLoad(f)})},L.stopLoad=function(){A.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},L.swapAudioCodec=function(){A.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){A.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},L.removeLevel=function(f,p){p===void 0&&(p=0),this.levelController.removeLevel(f,p)},w(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){A.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){A.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){A.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){A.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){A.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var p=!!f;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(A.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,p=this.config.minAutoBitrate;if(!f)return 0;for(var u=f.length,o=0;o<u;o++)if(f[o].maxBitrate>p)return o;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,p=this.autoLevelCapping,u;return p===-1&&f&&f.length?u=f.length-1:u=p,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var p=this.audioTrackController;p&&(p.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{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 l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:S.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isSupported",function(){return D}),O.d(J,"changeTypeSupported",function(){return K});var Z=O("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var H=Object(Z.getMediaSource)();if(!H)return!1;var N=U(),R=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!N||N.prototype&&typeof N.prototype.appendBuffer=="function"&&typeof N.prototype.remove=="function";return!!R&&!!b}function K(){var H,N=U();return typeof(N==null||((H=N.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return A}),O.d(J,"LoadError",function(){return C});var Z=O("./src/polyfills/number.ts"),U=O("./src/errors.ts");function D(h,a){h.prototype=Object.create(a.prototype),h.prototype.constructor=h,b(h,a)}function K(h){var a=typeof Map=="function"?new Map:void 0;return K=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(d))return a.get(d);a.set(d,w)}function w(){return H(d,arguments,_(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),b(w,d)},K(h)}function H(h,a,l){return N()?H=Reflect.construct:H=function(w,v,m){var L=[null];L.push.apply(L,v);var y=Function.bind.apply(w,L),f=new y;return m&&b(f,m.prototype),f},H.apply(null,arguments)}function N(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function R(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function b(h,a){return b=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},b(h,a)}function _(h){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},_(h)}var P=Math.pow(2,17),A=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=h.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(d,w){var v=this,m=d.url;if(!m)return Promise.reject(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var L=this.config,y=L.fLoader,f=L.loader;return new Promise(function(p,u){v.loader&&v.loader.destroy();var o=v.loader=d.loader=y?new y(L):new f(L),E=S(d),g={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:P};d.stats=o.stats,o.load(E,g,{onSuccess:function(I,j,G,V){v.resetLoader(d,o),p({frag:d,part:null,payload:I.data,networkDetails:V})},onError:function(I,j,G){v.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:I,networkDetails:G}))},onAbort:function(I,j,G){v.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:G}))},onTimeout:function(I,j,G){v.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:G}))},onProgress:function(I,j,G,V){w&&w({frag:d,part:null,payload:G,networkDetails:V})}})})},a.loadPart=function(d,w,v){var m=this;this.abort();var L=this.config,y=L.fLoader,f=L.loader;return new Promise(function(p,u){m.loader&&m.loader.destroy();var o=m.loader=d.loader=y?new y(L):new f(L),E=S(d,w),g={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:P};w.stats=o.stats,o.load(E,g,{onSuccess:function(I,j,G,V){m.resetLoader(d,o),m.updateStatsFromPart(d,w);var M={frag:d,part:w,payload:I.data,networkDetails:V};v(M),p(M)},onError:function(I,j,G){m.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:I,networkDetails:G}))},onAbort:function(I,j,G){d.stats.aborted=w.stats.aborted,m.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:G}))},onTimeout:function(I,j,G){m.resetLoader(d,o),u(new C({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:G}))}})})},a.updateStatsFromPart=function(d,w){var v=d.stats,m=w.stats,L=m.total;if(v.loaded+=m.loaded,L){var y=Math.round(d.duration/w.duration),f=Math.min(Math.round(v.loaded/L),y),p=y-f,u=p*Math.round(v.loaded/f);v.total=v.loaded+u}else v.total=Math.max(v.loaded,v.total);var o=v.loading,E=m.loading;o.start?o.first+=E.first-E.start:(o.start=E.start,o.first=E.first),o.end=E.end},a.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},h}();function S(h,a){a===void 0&&(a=null);var l=a||h,d={frag:h,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(w)&&Object(Z.isFiniteNumber)(v)&&(d.rangeStart=w,d.rangeEnd=v),d}var C=function(h){D(a,h);function a(l){for(var d,w=arguments.length,v=new Array(w>1?w-1:0),m=1;m<w;m++)v[m-1]=arguments[m];return d=h.call.apply(h,[this].concat(v))||this,d.data=void 0,d.data=l,d}return a}(K(Error))},"./src/loader/fragment.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ElementaryStreamTypes",function(){return A}),O.d(J,"BaseSegment",function(){return S}),O.d(J,"Fragment",function(){return C}),O.d(J,"Part",function(){return h});var Z=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),D=O.n(U),K=O("./src/utils/logger.ts"),H=O("./src/loader/level-key.ts"),N=O("./src/loader/load-stats.ts");function R(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,b(a,l)}function b(a,l){return b=Object.setPrototypeOf||function(w,v){return w.__proto__=v,w},b(a,l)}function _(a,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(a,w.key,w)}}function P(a,l,d){return l&&_(a.prototype,l),d&&_(a,d),a}var A;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(A||(A={}));var S=function(){function a(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[A.AUDIO]=null,w[A.VIDEO]=null,w[A.AUDIOVIDEO]=null,w),this.baseurl=d}var l=a.prototype;return l.setByteRange=function(w,v){var m=w.split("@",2),L=[];m.length===1?L[0]=v?v.byteRangeEndOffset:0:L[0]=parseInt(m[1]),L[1]=parseInt(m[0])+L[0],this._byteRange=L},P(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(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),a}(),C=function(a){R(l,a);function l(w,v){var m;return m=a.call(this,v)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new N.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=w,m}var d=l.prototype;return d.createInitializationVector=function(v){for(var m=new Uint8Array(16),L=12;L<16;L++)m[L]=v>>8*(15-L)&255;return m},d.setDecryptDataFromLevelKey=function(v,m){var L=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(L=H.LevelKey.fromURI(v.uri),L.method=v.method,L.iv=this.createInitializationVector(m),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(v,m,L,y,f,p){p===void 0&&(p=!1);var u=this.elementaryStreams,o=u[v];if(!o){u[v]={startPTS:m,endPTS:L,startDTS:y,endDTS:f,partial:p};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,L),o.startDTS=Math.min(o.startDTS,y),o.endDTS=Math.max(o.endDTS,f)},d.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[A.AUDIO]=null,v[A.VIDEO]=null,v[A.AUDIOVIDEO]=null},P(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var v=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(S),h=function(a){R(l,a);function l(d,w,v,m,L){var y;y=a.call(this,v)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new N.LoadStats,y.duration=d.decimalFloatingPoint("DURATION"),y.gap=d.bool("GAP"),y.independent=d.bool("INDEPENDENT"),y.relurl=d.enumeratedString("URI"),y.fragment=w,y.index=m;var f=d.enumeratedString("BYTERANGE");return f&&y.setByteRange(f,L),L&&(y.fragOffset=L.fragOffset+L.duration),y}return P(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(S)},"./src/loader/key-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return K});var Z=O("./src/events.ts"),U=O("./src/errors.ts"),D=O("./src/utils/logger.ts"),K=function(){function H(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var N=H.prototype;return N._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},N._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},N.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var _=this.loaders[b];_&&_.destroy()}this.loaders={}},N.onKeyLoading=function(b,_){var P=_.frag,A=P.type,S=this.loaders[A];if(!P.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=P.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(S&&(D.logger.warn("abort previous key loader for type:"+A),S.abort()),!C){D.logger.warn("key uri is falsy");return}var a=h.loader,l=P.loader=this.loaders[A]=new a(h);this.decrypturl=C,this.decryptkey=null;var d={url:C,frag:P,responseType:"arraybuffer"},w={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,w,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:P}))},N.loadsuccess=function(b,_,P){var A=P.frag;if(!A.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=A.decryptdata.key=new Uint8Array(b.data),A.loader=null,delete this.loaders[A.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:A})},N.loaderror=function(b,_){var P=_.frag,A=P.loader;A&&A.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:b})},N.loadtimeout=function(b,_){var P=_.frag,A=P.loader;A&&A.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},H}()},"./src/loader/level-details.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LevelDetails",function(){return H});var Z=O("./src/polyfills/number.ts");function U(N,R){for(var b=0;b<R.length;b++){var _=R[b];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(N,_.key,_)}}function D(N,R,b){return R&&U(N.prototype,R),b&&U(N,b),N}var K=10,H=function(){function N(b){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=b}var R=N.prototype;return R.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-_.lastPartSn,A=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!A||!!P,this.advanced=this.endSN>_.endSN||P>0||P===0&&A>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},D(N,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var _=this.driftEndTime-this.driftStartTime;if(_>0){var P=this.driftEnd-this.driftStart;return P*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.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 _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),N}()},"./src/loader/level-key.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LevelKey",function(){return H});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(Z);function D(N,R){for(var b=0;b<R.length;b++){var _=R[b];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(N,_.key,_)}}function K(N,R,b){return R&&D(N.prototype,R),b&&D(N,b),N}var H=function(){N.fromURL=function(b,_){return new N(b,_)},N.fromURI=function(b){return new N(b)};function N(R,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(Z.buildAbsoluteURL)(R,b,{alwaysNormalize:!0}):this._uri=R}return K(N,[{key:"uri",get:function(){return this._uri}}]),N}()},"./src/loader/load-stats.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"LoadStats",function(){return Z});var Z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return l});var Z=O("./src/polyfills/number.ts"),U=O("./node_modules/url-toolkit/src/url-toolkit.js"),D=O.n(U),K=O("./src/loader/fragment.ts"),H=O("./src/loader/level-details.ts"),N=O("./src/loader/level-key.ts"),R=O("./src/utils/attr-list.ts"),b=O("./src/utils/logger.ts"),_=O("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,A=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),C=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function a(L){var y,f;return h.test((y=(f=U.parseURL(L))===null||f===void 0?void 0:f.path)!=null?y:"")}var l=function(){function L(){}return L.findGroup=function(f,p){for(var u=0;u<f.length;u++){var o=f[u];if(o.id===p)return o}},L.convertAVC1ToAVCOTI=function(f){var p=f.split(".");if(p.length>2){var u=p.shift()+".";return u+=parseInt(p.shift()).toString(16),u+=("000"+parseInt(p.shift()).toString(16)).substr(-4),u}return f},L.resolve=function(f,p){return U.buildAbsoluteURL(p,f,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(f,p){var u=[],o={},E=!1;P.lastIndex=0;for(var g;(g=P.exec(f))!=null;)if(g[1]){var x=new R.AttrList(g[1]),I={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:L.resolve(g[2],p)},j=x.decimalResolution("RESOLUTION");j&&(I.width=j.width,I.height=j.height),d((x.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=L.convertAVC1ToAVCOTI(I.videoCodec)),u.push(I)}else if(g[3]){var G=new R.AttrList(g[3]);G["DATA-ID"]&&(E=!0,o[G["DATA-ID"]]=G)}return{levels:u,sessionData:E?o:null}},L.parseMasterPlaylistMedia=function(f,p,u,o){o===void 0&&(o=[]);var E,g=[],x=0;for(A.lastIndex=0;(E=A.exec(f))!==null;){var I=new R.AttrList(E[1]);if(I.TYPE===u){var j={attrs:I,bitrate:0,id:x++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:u,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?L.resolve(I.URI,p):""};if(o.length){var G=L.findGroup(o,j.groupId)||o[0];w(j,G,"audioCodec"),w(j,G,"textCodec")}g.push(j)}}return g},L.parseLevelPlaylist=function(f,p,u,o,E){var g=new H.LevelDetails(p),x=g.fragments,I=null,j=0,G=0,V=0,M=0,F=null,$=new K.Fragment(o,p),ie,de,ge,Le=-1,Ee=!1;for(S.lastIndex=0,g.m3u8=f;(ie=S.exec(f))!==null;){Ee&&(Ee=!1,$=new K.Fragment(o,p),$.start=V,$.sn=j,$.cc=M,$.level=u,I&&($.initSegment=I,$.rawProgramDateTime=I.rawProgramDateTime));var _e=ie[1];if(_e){$.duration=parseFloat(_e);var Se=(" "+ie[2]).slice(1);$.title=Se||null,$.tagList.push(Se?["INF",_e,Se]:["INF",_e])}else if(ie[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,ge&&($.levelkey=ge),$.sn=j,$.level=u,$.cc=M,$.urlId=E,x.push($),$.relurl=(" "+ie[3]).slice(1),m($,F),F=$,V+=$.duration,j++,G=0,Ee=!0);else if(ie[4]){var xe=(" "+ie[4]).slice(1);F?$.setByteRange(xe,F):$.setByteRange(xe)}else if(ie[5])$.rawProgramDateTime=(" "+ie[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Le===-1&&(Le=x.length);else{if(ie=ie[0].match(C),!ie){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(de=1;de<ie.length&&!(typeof ie[de]!="undefined");de++);var me=(" "+ie[de]).slice(1),z=(" "+ie[de+1]).slice(1),s=ie[de+2]?(" "+ie[de+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":g.type=z.toUpperCase();break;case"MEDIA-SEQUENCE":j=g.startSN=parseInt(z);break;case"SKIP":{var c=new R.AttrList(z),k=c.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(k)){g.skippedSegments=k;for(var X=k;X--;)x.unshift(null);j+=k}var B=c.enumeratedString("RECENTLY-REMOVED-DATERANGES");B&&(g.recentlyRemovedDateranges=B.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(z);break;case"VERSION":g.version=parseInt(z);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(z||s)&&$.tagList.push(s?[z,s]:[z]);break;case"DIS":M++;case"GAP":$.tagList.push([me]);break;case"BITRATE":$.tagList.push([me,z]);break;case"DISCONTINUITY-SEQ":M=parseInt(z);break;case"KEY":{var se,ve=new R.AttrList(z),Te=ve.enumeratedString("METHOD"),Pe=ve.URI,Ae=ve.hexadecimalInteger("IV"),De=ve.enumeratedString("KEYFORMATVERSIONS"),ke=ve.enumeratedString("KEYID"),Fe=(se=ve.enumeratedString("KEYFORMAT"))!=null?se:"identity",je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(je.indexOf(Fe)>-1){b.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;Te&&(ge=N.LevelKey.fromURL(p,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Te)>=0&&(ge.method=Te,ge.keyFormat=Fe,ke&&(ge.keyID=ke),De&&(ge.keyFormatVersions=De),ge.iv=Ae));break}case"START":{var Be=new R.AttrList(z),Ie=Be.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(Ie)&&(g.startTimeOffset=Ie);break}case"MAP":{var Ye=new R.AttrList(z);$.relurl=Ye.URI,Ye.BYTERANGE&&$.setByteRange(Ye.BYTERANGE),$.level=u,$.sn="initSegment",ge&&($.levelkey=ge),$.initSegment=null,I=$,Ee=!0;break}case"SERVER-CONTROL":{var He=new R.AttrList(z);g.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),g.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new R.AttrList(z);g.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=g.partList;Oe||(Oe=g.partList=[]);var tt=G>0?Oe[Oe.length-1]:void 0,Qe=G++,le=new K.Part(new R.AttrList(z),$,p,Qe,tt);Oe.push(le),$.duration+=le.duration;break}case"PRELOAD-HINT":{var q=new R.AttrList(z);g.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new R.AttrList(z);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ee);break}default:b.logger.warn("line parsed but not handled: "+ie);break}}}F&&!F.relurl?(x.pop(),V-=F.duration,g.partList&&(g.fragmentHint=F)):g.partList&&(m($,F),$.cc=M,g.fragmentHint=$);var ae=x.length,ue=x[0],te=x[ae-1];if(V+=g.skippedSegments*g.targetduration,V>0&&ae&&te){g.averagetargetduration=V/ae;var ne=te.sn;g.endSN=ne!=="initSegment"?ne:0,ue&&(g.startCC=ue.cc,ue.initSegment||g.fragments.every(function(he){return he.relurl&&a(he.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new K.Fragment(o,p),$.relurl=te.relurl,$.level=u,$.sn="initSegment",ue.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(V+=g.fragmentHint.duration),g.totalduration=V,g.endCC=M,Le>0&&v(x,Le),g},L}();function d(L,y){["video","audio","text"].forEach(function(f){var p=L.filter(function(o){return Object(_.isCodecType)(o,f)});if(p.length){var u=p.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=u.length>0?u[0]:p[0],L=L.filter(function(o){return p.indexOf(o)===-1})}}),y.unknownCodecs=L}function w(L,y,f){var p=y[f];p&&(L[f]=p)}function v(L,y){for(var f=L[y],p=y;p--;){var u=L[p];if(!u)return;u.programDateTime=f.programDateTime-u.duration*1e3,f=u}}function m(L,y){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):y!=null&&y.programDateTime&&(L.programDateTime=y.endProgramDateTime),Object(Z.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),D=O("./src/errors.ts"),K=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),N=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),b=O("./src/utils/attr-list.ts");function _(S){var C=S.type;switch(C){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function P(S,C){var h=S.url;return(h===void 0||h.indexOf("data:")===0)&&(h=C.url),h}var A=function(){function S(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var C=S.prototype;return C.registerListeners=function(){var a=this.hls;a.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.createInternalLoader=function(a){var l=this.hls.config,d=l.pLoader,w=l.loader,v=d||w,m=new v(l);return a.loader=m,this.loaders[a.type]=m,m},C.getInternalLoader=function(a){return this.loaders[a.type]},C.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},C.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(a,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},C.onLevelLoading=function(a,l){var d=l.id,w=l.level,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:R.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},C.onAudioTrackLoading=function(a,l){var d=l.id,w=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},C.onSubtitleTrackLoading=function(a,l){var d=l.id,w=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},C.load=function(a){var l,d=this.hls.config,w=this.getInternalLoader(a);if(w){var v=w.context;if(v&&v.url===a.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),w.abort()}var m,L,y,f;switch(a.type){case R.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,y=d.manifestLoadingRetryDelay,f=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:m=0,L=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,y=d.levelLoadingRetryDelay,f=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var p;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?p=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?p=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(p=this.hls.subtitleTracks[a.id].details),p){var u=p.partTarget,o=p.targetduration;u&&o&&(L=Math.min(Math.max(u*3,o*.8)*1e3,L))}}var E={timeout:L,maxRetry:m,retryDelay:y,maxRetryDelay:f,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(a,E,g)},C.loadsuccess=function(a,l,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(a,d),this.handlePlaylistLoaded(a,l,d,w);return}this.resetInternalLoader(d.type);var v=a.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,d,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,d,w):this.handleMasterPlaylist(a,l,d,w)},C.loaderror=function(a,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,a)},C.loadtimeout=function(a,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},C.handleMasterPlaylist=function(a,l,d,w){var v=this.hls,m=a.data,L=P(a,d),y=N.default.parseMasterPlaylist(m,L),f=y.levels,p=y.sessionData;if(!f.length){this.handleManifestParsingError(a,d,"no level found in manifest",w);return}var u=f.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),o=f.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),E=N.default.parseMasterPlaylistMedia(m,L,"AUDIO",u),g=N.default.parseMasterPlaylistMedia(m,L,"SUBTITLES",o),x=N.default.parseMasterPlaylistMedia(m,L,"CLOSED-CAPTIONS");if(E.length){var I=E.some(function(j){return!j.url});!I&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:f,audioTracks:E,subtitles:g,captions:x,url:L,stats:l,networkDetails:w,sessionData:p})},C.handleTrackOrLevelPlaylist=function(a,l,d,w){var v=this.hls,m=d.id,L=d.level,y=d.type,f=P(a,d),p=Object(Z.isFiniteNumber)(m)?m:0,u=Object(Z.isFiniteNumber)(L)?L:p,o=_(d),E=N.default.parseLevelPlaylist(a.data,f,u,o,p);if(!E.fragments.length){v.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(y===R.PlaylistContextType.MANIFEST){var g={attrs:new b.AttrList({}),bitrate:0,details:E,name:"",url:f};v.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:f,stats:l,networkDetails:w,sessionData:null})}if(l.parsing.end=performance.now(),E.needSidxRanges){var x,I=(x=E.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:I,isSidxRequest:!0,type:y,level:L,levelDetails:E,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=E,this.handlePlaylistLoaded(a,l,d,w)},C.handleSidxRequest=function(a,l){var d=Object(H.parseSegmentIndex)(new Uint8Array(a.data));if(!d)return;var w=d.references,v=l.levelDetails;w.forEach(function(m,L){var y=m.info,f=v.fragments[L];f.byteRange.length===0&&f.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),f.initSegment&&f.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(a,l,d,w){this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:a.url,reason:d,response:a,context:l,networkDetails:w})},C.handleNetworkError=function(a,l,d,w){d===void 0&&(d=!1),K.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var v=D.ErrorDetails.UNKNOWN,m=!1,L=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:v=d?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case R.PlaylistContextType.LEVEL:v=d?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.AUDIO_TRACK:v=d?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:v=d?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}L&&this.resetInternalLoader(a.type);var y={type:D.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:a.url,loader:L,context:a,networkDetails:l};w&&(y.response=w),this.hls.trigger(U.Events.ERROR,y)},C.handlePlaylistLoaded=function(a,l,d,w){var v=d.type,m=d.level,L=d.id,y=d.groupId,f=d.loader,p=d.levelDetails,u=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(a,d,"invalid target duration",w);return}if(!f)return;p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:p,level:m||0,id:L||0,stats:l,networkDetails:w,deliveryDirectives:u});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:p,id:L||0,groupId:y||"",stats:l,networkDetails:w,deliveryDirectives:u});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:p,id:L||0,groupId:y||"",stats:l,networkDetails:w,deliveryDirectives:u});break}},S}();J.default=A},"./src/polyfills/number.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isFiniteNumber",function(){return Z}),O.d(J,"MAX_SAFE_INTEGER",function(){return U});var Z=Number.isFinite||function(D){return typeof D=="number"&&isFinite(D)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,J,O){"use strict";O.r(J);var Z=function(){function U(){}return U.getSilentFrame=function(K,H){switch(K){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(H===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(H===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();J.default=Z},"./src/remux/mp4-generator.ts":function(ce,J,O){"use strict";O.r(J);var Z=Math.pow(2,32)-1,U=function(){function D(){}return D.init=function(){D.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var H;for(H in D.types)D.types.hasOwnProperty(H)&&(D.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var N=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]),R=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]);D.HDLR_TYPES={video:N,audio:R};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=_,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),A=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,P,S,P,A),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,b))},D.box=function(H){for(var N=8,R=arguments.length,b=new Array(R>1?R-1:0),_=1;_<R;_++)b[_-1]=arguments[_];for(var P=b.length,A=P;P--;)N+=b[P].byteLength;var S=new Uint8Array(N);for(S[0]=N>>24&255,S[1]=N>>16&255,S[2]=N>>8&255,S[3]=N&255,S.set(H,4),P=0,N=8;P<A;P++)S.set(b[P],N),N+=b[P].byteLength;return S},D.hdlr=function(H){return D.box(D.types.hdlr,D.HDLR_TYPES[H])},D.mdat=function(H){return D.box(D.types.mdat,H)},D.mdhd=function(H,N){N*=H;var R=Math.floor(N/(Z+1)),b=Math.floor(N%(Z+1));return D.box(D.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},D.mdia=function(H){return D.box(D.types.mdia,D.mdhd(H.timescale,H.duration),D.hdlr(H.type),D.minf(H))},D.mfhd=function(H){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},D.minf=function(H){return H.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(H)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(H))},D.moof=function(H,N,R){return D.box(D.types.moof,D.mfhd(H),D.traf(R,N))},D.moov=function(H){for(var N=H.length,R=[];N--;)R[N]=D.trak(H[N]);return D.box.apply(null,[D.types.moov,D.mvhd(H[0].timescale,H[0].duration)].concat(R).concat(D.mvex(H)))},D.mvex=function(H){for(var N=H.length,R=[];N--;)R[N]=D.trex(H[N]);return D.box.apply(null,[D.types.mvex].concat(R))},D.mvhd=function(H,N){N*=H;var R=Math.floor(N/(Z+1)),b=Math.floor(N%(Z+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,b>>24,b>>16&255,b>>8&255,b&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 D.box(D.types.mvhd,_)},D.sdtp=function(H){var N=H.samples||[],R=new Uint8Array(4+N.length),b,_;for(b=0;b<N.length;b++)_=N[b].flags,R[b+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return D.box(D.types.sdtp,R)},D.stbl=function(H){return D.box(D.types.stbl,D.stsd(H),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(H){var N=[],R=[],b,_,P;for(b=0;b<H.sps.length;b++)_=H.sps[b],P=_.byteLength,N.push(P>>>8&255),N.push(P&255),N=N.concat(Array.prototype.slice.call(_));for(b=0;b<H.pps.length;b++)_=H.pps[b],P=_.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(_));var A=D.box(D.types.avcC,new Uint8Array([1,N[3],N[4],N[5],252|3,224|H.sps.length].concat(N).concat([H.pps.length]).concat(R))),S=H.width,C=H.height,h=H.pixelRatio[0],a=H.pixelRatio[1];return D.box(D.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,S>>8&255,S&255,C>>8&255,C&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,a>>24,a>>16&255,a>>8&255,a&255])))},D.esds=function(H){var N=H.config.length;return new Uint8Array([0,0,0,0,3,23+N,0,1,0,4,15+N,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([N]).concat(H.config).concat([6,1,2]))},D.mp4a=function(H){var N=H.samplerate;return D.box(D.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,N>>8&255,N&255,0,0]),D.box(D.types.esds,D.esds(H)))},D.mp3=function(H){var N=H.samplerate;return D.box(D.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,N>>8&255,N&255,0,0]))},D.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(H)):D.box(D.types.stsd,D.STSD,D.mp4a(H)):D.box(D.types.stsd,D.STSD,D.avc1(H))},D.tkhd=function(H){var N=H.id,R=H.duration*H.timescale,b=H.width,_=H.height,P=Math.floor(R/(Z+1)),A=Math.floor(R%(Z+1));return D.box(D.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,b>>8&255,b&255,0,0,_>>8&255,_&255,0,0]))},D.traf=function(H,N){var R=D.sdtp(H),b=H.id,_=Math.floor(N/(Z+1)),P=Math.floor(N%(Z+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,P>>24,P>>16&255,P>>8&255,P&255])),D.trun(H,R.length+16+20+8+16+8+8),R)},D.trak=function(H){return H.duration=H.duration||4294967295,D.box(D.types.trak,D.tkhd(H),D.mdia(H))},D.trex=function(H){var N=H.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(H,N){var R=H.samples||[],b=R.length,_=12+16*b,P=new Uint8Array(_),A,S,C,h,a,l;for(N+=8+_,P.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255],0),A=0;A<b;A++)S=R[A],C=S.duration,h=S.size,a=S.flags,l=S.cts,P.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*A);return D.box(D.types.trun,P)},D.initSegment=function(H){D.types||D.init();var N=D.moov(H),R=new Uint8Array(D.FTYP.byteLength+N.byteLength);return R.set(D.FTYP),R.set(N,D.FTYP.byteLength),R},D}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,J.default=U},"./src/remux/mp4-remuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return l}),O.d(J,"normalizePts",function(){return d});var Z=O("./src/polyfills/number.ts"),U=O("./src/remux/aac-helper.ts"),D=O("./src/remux/mp4-generator.ts"),K=O("./src/events.ts"),H=O("./src/errors.ts"),N=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),b=O("./src/utils/timescale-conversion.ts");function _(){return _=Object.assign||function(L){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(L[p]=f[p])}return L},_.apply(this,arguments)}var P=10*1e3,A=1024,S=1152,C=null,h=null,a=!1,l=function(){function L(f,p,u,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=f,this.config=p,this.typeSupported=u,this.ISGenerated=!1,C===null){var E=navigator.userAgent||"",g=E.match(/Chrome\/(\d+)/i);C=g?parseInt(g[1]):0}if(h===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);h=x?parseInt(x[1]):0}a=!!C&&C<75||!!h&&h<600}var y=L.prototype;return y.destroy=function(){},y.resetTimeStamp=function(p){N.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},y.resetNextTimestamp=function(){N.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){N.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(p){var u=!1,o=p.reduce(function(E,g){var x=g.pts-E;return x<-4294967296?(u=!0,d(E,g.pts)):x>0?E:g.pts},p[0].pts);return u&&N.logger.debug("PTS rollover detected"),o},y.remux=function(p,u,o,E,g,x,I,j){var G,V,M,F,$,ie,de=g,ge=g,Le=p.pid>-1,Ee=u.pid>-1,_e=u.samples.length,Se=p.samples.length>0,xe=_e>1,me=(!Le||Se)&&(!Ee||xe)||this.ISGenerated||I;if(me){this.ISGenerated||(M=this.generateIS(p,u,g));var z=this.isVideoContiguous,s=-1;if(xe&&(s=w(u.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,s>0){N.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+_e+" video samples due to a missing keyframe");var c=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(s),u.dropped+=s,ge+=(u.samples[0].pts-c)/(u.timescale||9e4)}else s===-1&&(N.logger.warn("[mp4-remuxer]: No keyframe found out of "+_e+" video samples"),ie=!1);if(this.ISGenerated){if(Se&&xe){var k=this.getVideoStartPts(u.samples),X=d(p.samples[0].pts,k)-k,B=X/u.inputTimeScale;de+=Math.max(0,B),ge+=Math.max(0,-B)}if(Se){if(p.samplerate||(N.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(p,u,g)),V=this.remuxAudio(p,de,this.isAudioContiguous,x,Ee||xe||j===R.PlaylistLevelType.AUDIO?ge:void 0),xe){var se=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(N.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(p,u,g)),G=this.remuxVideo(u,ge,z,se)}}else xe&&(G=this.remuxVideo(u,ge,z,0));G&&(G.firstKeyFrame=s,G.independent=s!==-1)}}return this.ISGenerated&&(o.samples.length&&($=this.remuxID3(o,g)),E.samples.length&&(F=this.remuxText(E,g))),{audio:V,video:G,initSegment:M,independent:ie,text:F,id3:$}},y.generateIS=function(p,u,o){var E=p.samples,g=u.samples,x=this.typeSupported,I={},j=!Object(Z.isFiniteNumber)(this._initPTS),G="audio/mp4",V,M,F;if(j&&(V=M=Infinity),p.config&&E.length&&(p.timescale=p.samplerate,p.isAAC||(x.mpeg?(G="audio/mpeg",p.codec=""):x.mp3&&(p.codec="mp3")),I.audio={id:"audio",container:G,codec:p.codec,initSegment:!p.isAAC&&x.mpeg?new Uint8Array(0):D.default.initSegment([p]),metadata:{channelCount:p.channelCount}},j&&(F=p.inputTimeScale,V=M=E[0].pts-Math.round(F*o))),u.sps&&u.pps&&g.length&&(u.timescale=u.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:D.default.initSegment([u]),metadata:{width:u.width,height:u.height}},j)){F=u.inputTimeScale;var $=this.getVideoStartPts(g),ie=Math.round(F*o);M=Math.min(M,d(g[0].dts,$)-ie),V=Math.min(V,$-ie)}if(Object.keys(I).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=M),{tracks:I,initPTS:V,timescale:F}},y.remuxVideo=function(p,u,o,E){var g=p.inputTimeScale,x=p.samples,I=[],j=x.length,G=this._initPTS,V=this.nextAvcDts,M=8,F,$,ie,de=Number.POSITIVE_INFINITY,ge=Number.NEGATIVE_INFINITY,Le=0,Ee=!1;if(!o||V===null){var _e=u*g,Se=x[0].pts-d(x[0].dts,x[0].pts);V=_e-Se}for(var xe=0;xe<j;xe++){var me=x[xe];if(me.pts=d(me.pts-G,V),me.dts=d(me.dts-G,V),me.dts>me.pts){var z=9e4*.2;Le=Math.max(Math.min(Le,me.pts-me.dts),-1*z)}me.dts<x[xe>0?xe-1:xe].dts&&(Ee=!0)}Ee&&x.sort(function(vt,st){var at=vt.dts-st.dts,wt=vt.pts-st.pts;return at||wt}),$=x[0].dts,ie=x[x.length-1].dts;var s=Math.round((ie-$)/(j-1));if(Le<0){if(Le<s*-2){N.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-s,!0)+" ms");for(var c=Le,k=0;k<j;k++)x[k].dts=c=Math.max(c,x[k].pts-s),x[k].pts=Math.max(c,x[k].pts)}else{N.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(Le,!0)+" ms to overcome this issue");for(var X=0;X<j;X++)x[X].dts=x[X].dts+Le}$=x[0].dts}if(o){var B=$-V,se=B>s,ve=B<-1;if(se||ve){se?N.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(B,!0)+" ms ("+B+"dts) hole between fragments detected, filling it"):N.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-B,!0)+" ms ("+B+"dts) overlapping between fragments detected"),$=V;var Te=x[0].pts-B;x[0].dts=$,x[0].pts=Te,N.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(Te,!0)+"/"+Object(b.toMsFromMpegTsClock)($,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(B,!0)+" ms")}}a&&($=Math.max(0,$));for(var Pe=0,Ae=0,De=0;De<j;De++){for(var ke=x[De],Fe=ke.units,je=Fe.length,Be=0,Ie=0;Ie<je;Ie++)Be+=Fe[Ie].data.length;Ae+=Be,Pe+=je,ke.length=Be,ke.dts=Math.max(ke.dts,$),ke.pts=Math.max(ke.pts,ke.dts,0),de=Math.min(ke.pts,de),ge=Math.max(ke.pts,ge)}ie=x[j-1].dts;var Ye=Ae+4*Pe+8,He;try{He=new Uint8Array(Ye)}catch(vt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ye,reason:"fail allocating video mdat "+Ye});return}var Xe=new DataView(He.buffer);Xe.setUint32(0,Ye),He.set(D.default.types.mdat,4);for(var Oe=0;Oe<j;Oe++){for(var tt=x[Oe],Qe=tt.units,le=0,q=0,ee=Qe.length;q<ee;q++){var ae=Qe[q],ue=ae.data,te=ae.data.byteLength;Xe.setUint32(M,te),M+=4,He.set(ue,M),M+=te,le+=4+te}if(Oe<j-1)F=x[Oe+1].dts-tt.dts;else{var ne=this.config,he=tt.dts-x[Oe>0?Oe-1:Oe].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var fe=Math.floor(ne.maxBufferHole*g),be=(E?de+E*g:this.nextAudioPts)-tt.pts;be>fe?(F=be-he,F<0&&(F=he),N.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=he}else F=he}var Ce=Math.round(tt.pts-tt.dts);I.push(new v(tt.key,F,le,Ce))}if(I.length&&C&&C<70){var Me=I[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ie+F,this.isVideoContiguous=!0;var Ve=D.default.moof(p.sequenceNumber++,$,_({},p,{samples:I})),et="video",it={data1:Ve,data2:He,startPTS:de/g,endPTS:(ge+F)/g,startDTS:$/g,endDTS:V/g,type:et,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(He.length,"MDAT length must not be zero"),it},y.remuxAudio=function(p,u,o,E,g){var x=p.inputTimeScale,I=p.samplerate?p.samplerate:x,j=x/I,G=p.isAAC?A:S,V=G*j,M=this._initPTS,F=!p.isAAC&&this.typeSupported.mpeg,$=[],ie=p.samples,de=F?0:8,ge=this.nextAudioPts||-1,Le=u*x;if(this.isAudioContiguous=o=o||ie.length&&ge>0&&(E&&Math.abs(Le-ge)<9e3||Math.abs(d(ie[0].pts-M,Le)-ge)<20*V),ie.forEach(function(ue){ue.pts=d(ue.pts-M,Le)}),!o||ge<0){if(ie=ie.filter(function(ue){return ue.pts>=0}),!ie.length)return;g===0?ge=0:E?ge=Math.max(0,Le):ge=ie[0].pts}if(p.isAAC)for(var Ee=g!==void 0,_e=this.config.maxAudioFramesDrift,Se=0,xe=ge;Se<ie.length;Se++){var me=ie[Se],z=me.pts,s=z-xe,c=Math.abs(1e3*s/x);if(s<=-_e*V&&Ee)Se===0&&(N.logger.warn("Audio frame @ "+(z/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*s/x)+" ms."),this.nextAudioPts=ge=xe=z);else if(s>=_e*V&&c<P&&Ee){var k=Math.round(s/V);xe=z-k*V,xe<0&&(k--,xe+=V),Se===0&&(this.nextAudioPts=ge=xe),N.logger.warn("[mp4-remuxer]: Injecting "+k+" audio frame @ "+(xe/x).toFixed(3)+"s due to "+Math.round(1e3*s/x)+" ms gap.");for(var X=0;X<k;X++){var B=Math.max(xe,0),se=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);se||(N.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),se=me.unit.subarray()),ie.splice(Se,0,{unit:se,pts:B}),xe+=V,Se++}}me.pts=xe,xe+=V}for(var ve=null,Te=null,Pe,Ae=0,De=ie.length;De--;)Ae+=ie[De].unit.byteLength;for(var ke=0,Fe=ie.length;ke<Fe;ke++){var je=ie[ke],Be=je.unit,Ie=je.pts;if(Te!==null){var Ye=$[ke-1];Ye.duration=Math.round((Ie-Te)/j)}else if(o&&p.isAAC&&(Ie=ge),ve=Ie,Ae>0){Ae+=de;try{Pe=new Uint8Array(Ae)}catch(ue){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ae,reason:"fail allocating audio mdat "+Ae});return}if(!F){var He=new DataView(Pe.buffer);He.setUint32(0,Ae),Pe.set(D.default.types.mdat,4)}}else return;Pe.set(Be,de);var Xe=Be.byteLength;de+=Xe,$.push(new v(!0,G,Xe,0)),Te=Ie}var Oe=$.length;if(!Oe)return;var tt=$[$.length-1];this.nextAudioPts=ge=Te+j*tt.duration;var Qe=F?new Uint8Array(0):D.default.moof(p.sequenceNumber++,ve/j,_({},p,{samples:$}));p.samples=[];var le=ve/x,q=ge/x,ee="audio",ae={data1:Qe,data2:Pe,startPTS:le,endPTS:q,startDTS:le,endDTS:q,type:ee,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),ae},y.remuxEmptyAudio=function(p,u,o,E){var g=p.inputTimeScale,x=p.samplerate?p.samplerate:g,I=g/x,j=this.nextAudioPts,G=(j!==null?j:E.startDTS*g)+this._initDTS,V=E.endDTS*g+this._initDTS,M=I*A,F=Math.ceil((V-G)/M),$=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(N.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){N.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],de=0;de<F;de++){var ge=G+de*M;ie.push({unit:$,pts:ge,dts:ge})}return p.samples=ie,this.remuxAudio(p,u,o,!1)},y.remuxID3=function(p,u){var o=p.samples.length;if(!o)return;for(var E=p.inputTimeScale,g=this._initPTS,x=this._initDTS,I=0;I<o;I++){var j=p.samples[I];j.pts=d(j.pts-g,u*E)/E,j.dts=d(j.dts-x,u*E)/E}var G=p.samples;return p.samples=[],{samples:G}},y.remuxText=function(p,u){var o=p.samples.length;if(!o)return;for(var E=p.inputTimeScale,g=this._initPTS,x=0;x<o;x++){var I=p.samples[x];I.pts=d(I.pts-g,u*E)/E}p.samples.sort(function(G,V){return G.pts-V.pts});var j=p.samples;return p.samples=[],{samples:j}},L}();function d(L,y){var f;if(y===null)return L;for(y<L?f=-8589934592:f=8589934592;Math.abs(L-y)>4294967296;)L+=f;return L}function w(L){for(var y=0;y<L.length;y++)if(L[y].key)return y;return-1}var v=function(y,f,p,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=p,this.cts=u,this.flags=new m(y)},m=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/mp4-tools.ts"),D=O("./src/loader/fragment.ts"),K=O("./src/utils/logger.ts"),H=function(){function b(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var _=b.prototype;return _.destroy=function(){},_.resetTimeStamp=function(A){this.initPTS=A,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(A,S,C){this.audioCodec=S,this.videoCodec=C,this.generateInitSegment(A),this.emitInitSegment=!0},_.generateInitSegment=function(A){var S=this.audioCodec,C=this.videoCodec;if(!A||!A.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(A);S||(S=R(h.audio,D.ElementaryStreamTypes.AUDIO)),C||(C=R(h.video,D.ElementaryStreamTypes.VIDEO));var a={};h.audio&&h.video?a.audiovideo={container:"video/mp4",codec:S+","+C,initSegment:A,id:"main"}:h.audio?a.audio={container:"audio/mp4",codec:S,initSegment:A,id:"audio"}:h.video?a.video={container:"video/mp4",codec:C,initSegment:A,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},_.remux=function(A,S,C,h,a){var l=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:h,id3:C,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=a||0);var v=S.samples;if(!v||!v.length)return w;var m={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(v),L=this.initData),!L||!L.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=N(L,v,d));var y=Object(U.getDuration)(v,L),f=d,p=y+f;Object(U.offsetStartDTS)(L,v,l),y>0?this.lastEndDTS=p:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,o=!!L.video,E="";u&&(E+="audio"),o&&(E+="video");var g={data1:v,startPTS:f,startDTS:f,endPTS:p,endDTS:p,type:E,hasAudio:u,hasVideo:o,nb:1,dropped:0};return w.audio=g.type==="audio"?g:void 0,w.video=g.type!=="audio"?g:void 0,w.text=h,w.id3=C,w.initSegment=m,w},b}(),N=function(_,P,A){return Object(U.getStartDTS)(_,P)-A};function R(b,_){var P=b==null?void 0:b.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||_===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=H},"./src/task-loop.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var D=U.prototype;return D.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},D.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},D.onHandlerDestroyed=function(){},D.hasInterval=function(){return!!this._tickInterval},D.hasNextTick=function(){return!!this._tickTimer},D.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},D.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},D.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},D.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},D.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},D.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"CMCDVersion",function(){return Z}),O.d(J,"CMCDObjectType",function(){return U}),O.d(J,"CMCDStreamingFormat",function(){return D}),O.d(J,"CMCDStreamType",function(){return K});var Z=1,U;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(U||(U={}));var D;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(D||(D={}));var K;(function(H){H.VOD="v",H.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"HlsSkip",function(){return D}),O.d(J,"getSkipValue",function(){return K}),O.d(J,"HlsUrlParameters",function(){return H}),O.d(J,"Level",function(){return N});function Z(R,b){for(var _=0;_<b.length;_++){var P=b[_];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(R,P.key,P)}}function U(R,b,_){return b&&Z(R.prototype,b),_&&Z(R,_),R}var D;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(D||(D={}));function K(R,b){var _=R.canSkipUntil,P=R.canSkipDateRanges,A=R.endSN,S=b!==void 0?b-A:0;return _&&S<_?P?D.v2:D.Yes:D.No}var H=function(){function R(_,P,A){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=P,this.skip=A}var b=R.prototype;return b.addDirectives=function(P){var A=new self.URL(P);return this.msn!==void 0&&A.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&A.searchParams.set("_HLS_part",this.part.toString()),this.skip&&A.searchParams.set("_HLS_skip",this.skip),A.toString()},R}(),N=function(){function R(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return U(R,[{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(_){var P=_%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),R}()},"./src/types/loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"PlaylistContextType",function(){return Z}),O.d(J,"PlaylistLevelType",function(){return U});var Z;(function(D){D.MANIFEST="manifest",D.LEVEL="level",D.AUDIO_TRACK="audioTrack",D.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var U;(function(D){D.MAIN="main",D.AUDIO="audio",D.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"ChunkMetadata",function(){return Z});var Z=function(K,H,N,R,b,_){R===void 0&&(R=0),b===void 0&&(b=-1),_===void 0&&(_=!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=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=K,this.sn=H,this.id=N,this.size=R,this.part=b,this.partial=_};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"AttrList",function(){return D});var Z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function K(N){typeof N=="string"&&(N=K.parseAttrList(N));for(var R in N)N.hasOwnProperty(R)&&(this[R]=N[R])}var H=K.prototype;return H.decimalInteger=function(R){var b=parseInt(this[R],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.hexadecimalInteger=function(R){if(this[R]){var b=(this[R]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var _=new Uint8Array(b.length/2),P=0;P<b.length/2;P++)_[P]=parseInt(b.slice(P*2,P*2+2),16);return _}else return null},H.hexadecimalIntegerAsNumber=function(R){var b=parseInt(this[R],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.decimalFloatingPoint=function(R){return parseFloat(this[R])},H.optionalFloat=function(R,b){var _=this[R];return _?parseFloat(_):b},H.enumeratedString=function(R){return this[R]},H.bool=function(R){return this[R]==="YES"},H.decimalResolution=function(R){var b=Z.exec(this[R]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},K.parseAttrList=function(R){var b,_={},P='"';for(U.lastIndex=0;(b=U.exec(R))!==null;){var A=b[2];A.indexOf(P)===0&&A.lastIndexOf(P)===A.length-1&&(A=A.slice(1,-1)),_[b[1]]=A}return _},K}()},"./src/utils/binary-search.ts":function(ce,J,O){"use strict";O.r(J);var Z={search:function(D,K){for(var H=0,N=D.length-1,R=null,b=null;H<=N;){R=(H+N)/2|0,b=D[R];var _=K(b);if(_>0)H=R+1;else if(_<0)N=R-1;else return b}return null}};J.default=Z},"./src/utils/buffer-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"BufferHelper",function(){return D});var Z=O("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function K(){}return K.isBuffered=function(N,R){try{if(N){for(var b=K.getBuffered(N),_=0;_<b.length;_++)if(R>=b.start(_)&&R<=b.end(_))return!0}}catch(P){}return!1},K.bufferInfo=function(N,R,b){try{if(N){var _=K.getBuffered(N),P=[],A;for(A=0;A<_.length;A++)P.push({start:_.start(A),end:_.end(A)});return this.bufferedInfo(P,R,b)}}catch(S){}return{len:0,start:R,end:R,nextStart:void 0}},K.bufferedInfo=function(N,R,b){R=Math.max(0,R),N.sort(function(m,L){var y=m.start-L.start;return y||L.end-m.end});var _=[];if(b)for(var P=0;P<N.length;P++){var A=_.length;if(A){var S=_[A-1].end;N[P].start-S<b?N[P].end>S&&(_[A-1].end=N[P].end):_.push(N[P])}else _.push(N[P])}else _=N;for(var C=0,h,a=R,l=R,d=0;d<_.length;d++){var w=_[d].start,v=_[d].end;if(R+b>=w&&R<v)a=w,l=v,C=l-R;else if(R+b<w){h=w;break}}return{len:C,start:a||0,end:l||0,nextStart:h}},K.getBuffered=function(N){try{return N.buffered}catch(R){return Z.logger.log("failed to get media.buffered",R),U}},K}()},"./src/utils/cea-608-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"Row",function(){return l}),O.d(J,"CaptionScreen",function(){return d});var Z=O("./src/utils/logger.ts"),U={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},D=function(p){var u=p;return U.hasOwnProperty(p)&&(u=U[p]),String.fromCharCode(u)},K=15,H=100,N={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],A;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(A||(A={}));var S=function(){function f(){this.time=null,this.verboseLevel=A.ERROR}var p=f.prototype;return p.log=function(o,E){this.verboseLevel>=o&&Z.logger.log(this.time+" ["+o+"] "+E)},f}(),C=function(p){for(var u=[],o=0;o<p.length;o++)u.push(p[o].toString(16));return u},h=function(){function f(u,o,E,g,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=o||!1,this.italics=E||!1,this.background=g||"black",this.flash=x||!1}var p=f.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(o){for(var E=["foreground","underline","italics","background","flash"],g=0;g<E.length;g++){var x=E[g];o.hasOwnProperty(x)&&(this[x]=o[x])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},p.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),a=function(){function f(u,o,E,g,x,I){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new h(o,E,g,x,I)}var p=f.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(o,E){this.uchar=o,this.penState.copy(E)},p.setPenState=function(o){this.penState.copy(o)},p.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},p.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),l=function(){function f(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<H;o++)this.chars.push(new a);this.logger=u,this.pos=0,this.currPenState=new h}var p=f.prototype;return p.equals=function(o){for(var E=!0,g=0;g<H;g++)if(!this.chars[g].equals(o.chars[g])){E=!1;break}return E},p.copy=function(o){for(var E=0;E<H;E++)this.chars[E].copy(o.chars[E])},p.isEmpty=function(){for(var o=!0,E=0;E<H;E++)if(!this.chars[E].isEmpty()){o=!1;break}return o},p.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(A.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(A.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},p.moveCursor=function(o){var E=this.pos+o;if(o>1)for(var g=this.pos+1;g<E+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(E)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(o){o>=144&&this.backSpace();var E=D(o);if(this.pos>=H){this.logger.log(A.ERROR,"Cannot insert "+o.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(o){var E;for(E=o;E<H;E++)this.chars[E].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var o=[],E=!0,g=0;g<H;g++){var x=this.chars[g].uchar;x!==" "&&(E=!1),o.push(x)}return E?"":o.join("")},p.setPenStyles=function(o){this.currPenState.setStyles(o);var E=this.chars[this.pos];E.setPenState(this.currPenState)},f}(),d=function(){function f(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<K;o++)this.rows.push(new l(u));this.logger=u,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=f.prototype;return p.reset=function(){for(var o=0;o<K;o++)this.rows[o].clear();this.currRow=K-1},p.equals=function(o){for(var E=!0,g=0;g<K;g++)if(!this.rows[g].equals(o.rows[g])){E=!1;break}return E},p.copy=function(o){for(var E=0;E<K;E++)this.rows[E].copy(o.rows[E])},p.isEmpty=function(){for(var o=!0,E=0;E<K;E++)if(!this.rows[E].isEmpty()){o=!1;break}return o},p.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},p.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},p.insertChar=function(o){var E=this.rows[this.currRow];E.insertChar(o)},p.setPen=function(o){var E=this.rows[this.currRow];E.setPenStyles(o)},p.moveCursor=function(o){var E=this.rows[this.currRow];E.moveCursor(o)},p.setCursor=function(o){this.logger.log(A.INFO,"setCursor: "+o);var E=this.rows[this.currRow];E.setCursor(o)},p.setPAC=function(o){this.logger.log(A.INFO,"pacData = "+JSON.stringify(o));var E=o.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var g=0;g<K;g++)this.rows[g].clear();var x=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var j=I.rows[x].cueStartTime,G=this.logger.time;if(j&&G!==null&&j<G)for(var V=0;V<this.nrRollUpRows;V++)this.rows[E-this.nrRollUpRows+V+1].copy(I.rows[x+V])}}this.currRow=E;var M=this.rows[this.currRow];if(o.indent!==null){var F=o.indent,$=Math.max(F-1,0);M.setCursor(o.indent),o.color=M.chars[$].penState.foreground}var ie={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(ie)},p.setBkgData=function(o){this.logger.log(A.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},p.setRollUpRows=function(o){this.nrRollUpRows=o},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(A.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(A.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(o,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(A.INFO,"Rolling up")},p.getDisplayText=function(o){o=o||!1;for(var E=[],g="",x=-1,I=0;I<K;I++){var j=this.rows[I].getTextString();j&&(x=I+1,o?E.push("Row "+x+": '"+j+"'"):E.push(j.trim()))}return E.length>0&&(o?g="["+E.join(" | ")+"]":g=E.join(`
`)),g},p.getTextAndFormat=function(){return this.rows},f}(),w=function(){function f(u,o,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new d(E),this.nonDisplayedMemory=new d(E),this.lastOutputScreen=new d(E),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var p=f.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(o){this.outputFilter=o},p.setPAC=function(o){this.writeScreen.setPAC(o)},p.setBkgData=function(o){this.writeScreen.setBkgData(o)},p.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(A.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},p.insertChars=function(o){for(var E=0;E<o.length;E++)this.writeScreen.insertChar(o[E]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(A.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(A.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(A.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(A.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(A.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(o){this.logger.log(A.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},p.ccFON=function(){this.logger.log(A.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(A.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(A.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(A.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(A.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(A.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(A.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(A.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(A.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(o){this.logger.log(A.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},p.ccMIDROW=function(o){var E={flash:!1};if(E.underline=o%2===1,E.italics=o>=46,E.italics)E.foreground="white";else{var g=Math.floor(o/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=x[g]}this.logger.log(A.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},p.outputDataUpdate=function(o){o===void 0&&(o=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},f}(),v=function(){function f(u,o,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new S;this.channels=[null,new w(u,o,g),new w(u+1,E,g)],this.cmdHistory=y(),this.logger=g}var p=f.prototype;return p.getHandler=function(o){return this.channels[o].getHandler()},p.setHandler=function(o,E){this.channels[o].setHandler(E)},p.addData=function(o,E){var g,x,I,j=!1;this.logger.time=o;for(var G=0;G<E.length;G+=2){if(x=E[G]&127,I=E[G+1]&127,x===0&&I===0)continue;if(this.logger.log(A.DATA,"["+C([E[G],E[G+1]])+"] -> ("+C([x,I])+")"),g=this.parseCmd(x,I),g||(g=this.parseMidrow(x,I)),g||(g=this.parsePAC(x,I)),g||(g=this.parseBackgroundAttributes(x,I)),!g&&(j=this.parseChars(x,I),j)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(j)}else this.logger.log(A.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!j&&this.logger.log(A.WARNING,"Couldn't parse cleaned data "+C([x,I])+" orig: "+C([E[G],E[G+1]]))}},p.parseCmd=function(o,E){var g=this.cmdHistory,x=(o===20||o===28||o===21||o===29)&&E>=32&&E<=47,I=(o===23||o===31)&&E>=33&&E<=35;if(!(x||I))return!1;if(L(o,E,g))return m(null,null,g),this.logger.log(A.DEBUG,"Repeated command ("+C([o,E])+") is dropped"),!0;var j=o===20||o===21||o===23?1:2,G=this.channels[j];return o===20||o===21||o===28||o===29?E===32?G.ccRCL():E===33?G.ccBS():E===34?G.ccAOF():E===35?G.ccAON():E===36?G.ccDER():E===37?G.ccRU(2):E===38?G.ccRU(3):E===39?G.ccRU(4):E===40?G.ccFON():E===41?G.ccRDC():E===42?G.ccTR():E===43?G.ccRTD():E===44?G.ccEDM():E===45?G.ccCR():E===46?G.ccENM():E===47&&G.ccEOC():G.ccTO(E-32),m(o,E,g),this.currentChannel=j,!0},p.parseMidrow=function(o,E){var g=0;if((o===17||o===25)&&E>=32&&E<=47){if(o===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(A.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[g];return x?(x.ccMIDROW(E),this.logger.log(A.DEBUG,"MIDROW ("+C([o,E])+")"),!0):!1}return!1},p.parsePAC=function(o,E){var g,x=this.cmdHistory,I=(o>=17&&o<=23||o>=25&&o<=31)&&E>=64&&E<=127,j=(o===16||o===24)&&E>=64&&E<=95;if(!(I||j))return!1;if(L(o,E,x))return m(null,null,x),!0;var G=o<=23?1:2;E>=64&&E<=95?g=G===1?N[o]:b[o]:g=G===1?R[o]:_[o];var V=this.channels[G];return V?(V.setPAC(this.interpretPAC(g,E)),m(o,E,x),this.currentChannel=G,!0):!1},p.interpretPAC=function(o,E){var g,x={color:null,italics:!1,indent:null,underline:!1,row:o};return E>95?g=E-96:g=E-64,x.underline=(g&1)===1,g<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((g-16)/2)*4,x},p.parseChars=function(o,E){var g,x=null,I=null;if(o>=25?(g=2,I=o-8):(g=1,I=o),I>=17&&I<=19){var j;I===17?j=E+80:I===18?j=E+112:j=E+144,this.logger.log(A.INFO,"Special char '"+D(j)+"' in channel "+g),x=[j]}else o>=32&&o<=127&&(x=E===0?[o]:[o,E]);if(x){var G=C(x);this.logger.log(A.DEBUG,"Char codes = "+G.join(",")),m(o,E,this.cmdHistory)}return x},p.parseBackgroundAttributes=function(o,E){var g=(o===16||o===24)&&E>=32&&E<=47,x=(o===23||o===31)&&E>=45&&E<=47;if(!(g||x))return!1;var I,j={};o===16||o===24?(I=Math.floor((E-32)/2),j.background=P[I],E%2===1&&(j.background=j.background+"_semi")):E===45?j.background="transparent":(j.foreground="black",E===47&&(j.underline=!0));var G=o<=23?1:2,V=this.channels[G];return V.setBkgData(j),m(o,E,this.cmdHistory),!0},p.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var E=this.channels[o];E&&E.reset()}this.cmdHistory=y()},p.cueSplitAtTime=function(o){for(var E=0;E<this.channels.length;E++){var g=this.channels[E];g&&g.cueSplitAtTime(o)}},f}();function m(f,p,u){u.a=f,u.b=p}function L(f,p,u){return u.a===f&&u.b===p}function y(){return{a:null,b:null}}J.default=v},"./src/utils/codecs.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"isCodecType",function(){return U}),O.d(J,"isCodecSupportedInMp4",function(){return D});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(K,H){var N=Z[H];return!!N&&N[K.slice(0,4)]===!0}function D(K,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/vttparser.ts"),U=O("./src/utils/webvtt-parser.ts"),D=O("./src/utils/texttrack-utils.ts"),K=/\s/,H={newCue:function(R,b,_,P){for(var A=[],S,C,h,a,l,d=self.VTTCue||self.TextTrackCue,w=0;w<P.rows.length;w++)if(S=P.rows[w],h=!0,a=0,l="",!S.isEmpty()){for(var v=0;v<S.chars.length;v++)K.test(S.chars[v].uchar)&&h?a++:(l+=S.chars[v].uchar,h=!1);S.cueStartTime=b,b===_&&(_+=1e-4),a>=16?a--:a++;var m=Object(Z.fixLineBreaks)(l.trim()),L=Object(U.generateCueId)(b,_,m);(!R||!R.cues||!R.cues.getCueById(L))&&(C=new d(b,_,m),C.id=L,C.line=w+1,C.align="left",C.position=10+Math.min(80,Math.floor(a*8/32)*10),A.push(C))}return R&&A.length&&(A.sort(function(y,f){return y.line==="auto"||f.line==="auto"?0:y.line>8&&f.line>8?f.line-y.line:y.line-f.line}),A.forEach(function(y){return Object(D.addCueToTrack)(R,y)})),A}};J.default=H},"./src/utils/discontinuities.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"findFirstFragWithCC",function(){return K}),O.d(J,"shouldAlignOnDiscontinuities",function(){return H}),O.d(J,"findDiscontinuousReferenceFrag",function(){return N}),O.d(J,"adjustSlidingStart",function(){return b}),O.d(J,"alignStream",function(){return _}),O.d(J,"alignPDT",function(){return A}),O.d(J,"alignFragmentByPDTDelta",function(){return S}),O.d(J,"alignMediaPlaylistByPDT",function(){return C});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts"),D=O("./src/controller/level-helper.ts");function K(h,a){for(var l=null,d=0,w=h.length;d<w;d++){var v=h[d];if(v&&v.cc===a){l=v;break}}return l}function H(h,a,l){return!!(a.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function N(h,a){var l=h.fragments,d=a.fragments;if(!d.length||!l.length){U.logger.log("No fragments to align");return}var w=K(l,d[0].cc);if(!w||w&&!w.startPTS){U.logger.log("No frag in previous level to align on");return}return w}function R(h,a){if(h){var l=h.start+a;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function b(h,a){for(var l=a.fragments,d=0,w=l.length;d<w;d++)R(l[d],h);a.fragmentHint&&R(a.fragmentHint,h),a.alignedSliding=!0}function _(h,a,l){if(!a)return;P(h,l,a),!l.alignedSliding&&a.details&&A(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(D.adjustSliding)(a.details,l)}function P(h,a,l){if(H(h,l,a)){var d=N(l.details,a);d&&Object(Z.isFiniteNumber)(d.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),b(d.start,a))}}function A(h,a){if(!a.fragments.length||!h.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,d=h.fragments[0].programDateTime,w=(d-l)/1e3+a.fragments[0].start;w&&Object(Z.isFiniteNumber)(w)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+w.toFixed(3)+" "+h.url+" "),b(w,h))}function S(h,a){var l=h.programDateTime;if(!l)return;var d=(l-a)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function C(h,a){if(!a.fragments.length||!h.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,d=a.fragments[0].start,w=l-d*1e3;h.fragments.forEach(function(v){S(v,w)}),h.fragmentHint&&S(h.fragmentHint,w),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/ewma.ts"),U=function(){function D(H,N,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(H),this.fast_=new Z.default(N)}var K=D.prototype;return K.update=function(N,R){var b=this.slow_,_=this.fast_;this.slow_.halfLife!==N&&(this.slow_=new Z.default(N,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Z.default(R,_.getEstimate(),_.getTotalWeight()))},K.sample=function(N,R){N=Math.max(N,this.minDelayMs_);var b=8*R,_=N/1e3,P=b/_;this.fast_.sample(_,P),this.slow_.sample(_,P)},K.canEstimate=function(){var N=this.fast_;return N&&N.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},D}();J.default=U},"./src/utils/ewma.ts":function(ce,J,O){"use strict";O.r(J);var Z=function(){function U(K,H,N){H===void 0&&(H=0),N===void 0&&(N=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=H,this.totalWeight_=N}var D=U.prototype;return D.sample=function(H,N){var R=Math.pow(this.alpha_,H);this.estimate_=N*(1-R)+R*this.estimate_,this.totalWeight_+=H},D.getTotalWeight=function(){return this.totalWeight_},D.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},U}();J.default=Z},"./src/utils/fetch-loader.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"fetchSupported",function(){return S});var Z=O("./src/polyfills/number.ts"),U=O("./src/loader/load-stats.ts"),D=O("./src/demux/chunk-cache.ts");function K(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,_(d,w)}function H(d){var w=typeof Map=="function"?new Map:void 0;return H=function(m){if(m===null||!b(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(m))return w.get(m);w.set(m,L)}function L(){return N(m,arguments,P(this).constructor)}return L.prototype=Object.create(m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),_(L,m)},H(d)}function N(d,w,v){return R()?N=Reflect.construct:N=function(L,y,f){var p=[null];p.push.apply(p,y);var u=Function.bind.apply(L,p),o=new u;return f&&_(o,f.prototype),o},N.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function b(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function _(d,w){return _=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},_(d,w)}function P(d){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(d)}function A(){return A=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var v=arguments[w];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(d[m]=v[m])}return d},A.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var C=function(){function d(v){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=v.fetchSetup||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(m,L,y){var f=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var u=h(m,this.controller.signal),o=y.onProgress,E=m.responseType==="arraybuffer",g=E?"byteLength":"length";this.context=m,this.config=L,this.callbacks=y,this.request=this.fetchSetup(m,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),y.onTimeout(p,m,f.response)},L.timeout),self.fetch(this.request).then(function(x){if(f.response=f.loader=x,!x.ok){var I=x.status,j=x.statusText;throw new l(j||"fetch, bad network response",I,x)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(x.headers.get("Content-Length")||"0"),o&&Object(Z.isFiniteNumber)(L.highWaterMark)?f.loadProgressively(x,p,m,L.highWaterMark,o):E?x.arrayBuffer():x.text()}).then(function(x){var I=f.response;self.clearTimeout(f.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=x[g];var j={url:I.url,data:x};o&&!Object(Z.isFiniteNumber)(L.highWaterMark)&&o(p,m,x,I),y.onSuccess(j,p,m,I)}).catch(function(x){if(self.clearTimeout(f.requestTimeout),p.aborted)return;var I=x.code||0;y.onError({code:I,text:x.message},m,x.details)})},w.getCacheAge=function(){var m=null;if(this.response){var L=this.response.headers.get("age");m=L?parseFloat(L):null}return m},w.loadProgressively=function(m,L,y,f,p){f===void 0&&(f=0);var u=new D.default,o=m.body.getReader(),E=function g(){return o.read().then(function(x){if(x.done)return u.dataLength&&p(L,y,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var I=x.value,j=I.length;return L.loaded+=j,j<f||u.dataLength?(u.push(I),u.dataLength>=f&&p(L,y,u.flush(),m)):p(L,y,I,m),g()}).catch(function(){return Promise.reject()})};return E()},d}();function h(d,w){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(A({},d.headers))};return d.rangeEnd&&v.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),v}function a(d,w){return new self.Request(d.url,w)}var l=function(d){K(w,d);function w(v,m,L){var y;return y=d.call(this,v)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=L,y}return w}(H(Error));J.default=C},"./src/utils/imsc1-ttml-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"IMSC1_CODEC",function(){return b}),O.d(J,"parseIMSC1",function(){return S});var Z=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/vttparser.ts"),D=O("./src/utils/vttcue.ts"),K=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),N=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(f){for(var p=1;p<arguments.length;p++){var u=arguments[p];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(f[o]=u[o])}return f},R.apply(this,arguments)}var b="stpp.ttml.im1t",_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,A={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(f,p,u,o,E){var g=Object(Z.findBox)(new Uint8Array(f),["mdat"]);if(g.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var x=g[0],I=Object(K.utf8ArrayToStr)(new Uint8Array(f,x.start,x.end-x.start)),j=Object(H.toTimescaleFromScale)(p,1,u);try{o(C(I,j))}catch(G){E(G)}}function C(f,p){var u=new DOMParser,o=u.parseFromString(f,"text/xml"),E=o.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(g).reduce(function(M,F){return M[F]=E.getAttribute("ttp:"+F)||g[F],M},{}),I=E.getAttribute("xml:space")!=="preserve",j=a(h(E,"styling","style")),G=a(h(E,"layout","region")),V=h(E,"body","[begin]");return[].map.call(V,function(M){var F=l(M,I);if(!F||!M.hasAttribute("begin"))return null;var $=m(M.getAttribute("begin"),x),ie=m(M.getAttribute("dur"),x),de=m(M.getAttribute("end"),x);if($===null)throw v(M);if(de===null){if(ie===null)throw v(M);de=$+ie}var ge=new D.default($-p,de-p,F);ge.id=Object(N.generateCueId)(ge.startTime,ge.endTime,ge.text);var Le=G[M.getAttribute("region")],Ee=j[M.getAttribute("style")];ge.position=10,ge.size=80;var _e=d(Le,Ee),Se=_e.textAlign;if(Se){var xe=A[Se];xe&&(ge.lineAlign=xe),ge.align=Se}return R(ge,_e),ge}).filter(function(M){return M!==null})}function h(f,p,u){var o=f.getElementsByTagName(p)[0];return o?[].slice.call(o.querySelectorAll(u)):[]}function a(f){return f.reduce(function(p,u){var o=u.getAttribute("xml:id");return o&&(p[o]=u),p},{})}function l(f,p){return[].slice.call(f.childNodes).reduce(function(u,o,E){var g;return o.nodeName==="br"&&E?u+`
`:(g=o.childNodes)!==null&&g!==void 0&&g.length?l(o,p):p?u+o.textContent.trim().replace(/\s+/g," "):u+o.textContent},"")}function d(f,p){var u="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(E,g){var x=w(p,u,g)||w(f,u,g);return x&&(E[g]=x),E},{})}function w(f,p,u){return f.hasAttributeNS(p,u)?f.getAttributeNS(p,u):null}function v(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,p){if(!f)return null;var u=Object(U.parseTimeStamp)(f);return u===null&&(_.test(f)?u=L(f,p):P.test(f)&&(u=y(f,p))),u}function L(f,p){var u=_.exec(f),o=(u[4]|0)+(u[5]|0)/p.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+o/p.frameRate}function y(f,p){var u=P.exec(f),o=Number(u[1]),E=u[2];switch(E){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/p.frameRate;case"t":return o/p.tickRate}return o}},"./src/utils/logger.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"enableLogs",function(){return N}),O.d(J,"logger",function(){return R});var Z=function(){},U={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},D=U;function K(b){var _=self.console[b];return _?_.bind(self.console,"["+b+"] >"):Z}function H(b){for(var _=arguments.length,P=new Array(_>1?_-1:0),A=1;A<_;A++)P[A-1]=arguments[A];P.forEach(function(S){D[S]=b[S]?b[S].bind(b):K(S)})}function N(b){if(self.console&&b===!0||typeof b=="object"){H(b,"debug","log","info","warn","error");try{D.log()}catch(_){D=U}}else D=U}var R=D},"./src/utils/mediakeys-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"KeySystems",function(){return Z}),O.d(J,"requestMediaKeySystemAccess",function(){return U});var Z;(function(D){D.WIDEVINE="com.widevine.alpha",D.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"bin2str",function(){return H}),O.d(J,"readUint16",function(){return N}),O.d(J,"readUint32",function(){return R}),O.d(J,"writeUint32",function(){return b}),O.d(J,"findBox",function(){return _}),O.d(J,"parseSegmentIndex",function(){return P}),O.d(J,"parseInitSegment",function(){return A}),O.d(J,"getStartDTS",function(){return S}),O.d(J,"getDuration",function(){return C}),O.d(J,"computeRawDurationFromSamples",function(){return h}),O.d(J,"offsetStartDTS",function(){return a}),O.d(J,"segmentValidRange",function(){return l}),O.d(J,"appendUint8Array",function(){return d});var Z=O("./src/utils/typed-array.ts"),U=O("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,K=[].push;function H(w){return String.fromCharCode.apply(null,w)}function N(w,v){"data"in w&&(v+=w.start,w=w.data);var m=w[v]<<8|w[v+1];return m<0?65536+m:m}function R(w,v){"data"in w&&(v+=w.start,w=w.data);var m=w[v]<<24|w[v+1]<<16|w[v+2]<<8|w[v+3];return m<0?4294967296+m:m}function b(w,v,m){"data"in w&&(v+=w.start,w=w.data),w[v]=m>>24,w[v+1]=m>>16&255,w[v+2]=m>>8&255,w[v+3]=m&255}function _(w,v){var m=[];if(!v.length)return m;var L,y,f;"data"in w?(L=w.data,y=w.start,f=w.end):(L=w,y=0,f=L.byteLength);for(var p=y;p<f;){var u=R(L,p),o=H(L.subarray(p+4,p+8)),E=u>1?p+u:f;if(o===v[0])if(v.length===1)m.push({data:L,start:p+8,end:E});else{var g=_({data:L,start:p+8,end:E},v.slice(1));g.length&&K.apply(m,g)}p=E}return m}function P(w){var v=_(w,["moov"]),m=v[0],L=m?m.end:null,y=_(w,["sidx"]);if(!y||!y[0])return null;var f=[],p=y[0],u=p.data[0],o=u===0?8:16,E=R(p,o);o+=4;var g=0,x=0;u===0?o+=8:o+=16,o+=2;var I=p.end+x,j=N(p,o);o+=2;for(var G=0;G<j;G++){var V=o,M=R(p,V);V+=4;var F=M&2147483647,$=(M&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=R(p,V);V+=4,f.push({referenceSize:F,subsegmentDuration:ie,info:{duration:ie/E,start:I,end:I+F-1}}),I+=F,V+=4,o=V}return{earliestPresentationTime:g,timescale:E,version:u,referencesCount:j,references:f,moovEndOffset:L}}function A(w){for(var v=[],m=_(w,["moov","trak"]),L=0;L<m.length;L++){var y=m[L],f=_(y,["tkhd"])[0];if(f){var p=f.data[f.start],u=p===0?12:20,o=R(f,u),E=_(y,["mdia","mdhd"])[0];if(E){p=E.data[E.start],u=p===0?12:20;var g=R(E,u),x=_(y,["mdia","hdlr"])[0];if(x){var I=H(x.data.subarray(x.start+8,x.start+12)),j={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[I];if(j){var G=_(y,["mdia","minf","stbl","stsd"])[0],V=void 0;G&&(V=H(G.data.subarray(G.start+12,G.start+16))),v[o]={timescale:g,type:j},v[j]={timescale:g,id:o,codec:V}}}}}}var M=_(w,["moov","mvex","trex"]);return M.forEach(function(F){var $=R(F,4),ie=v[$];ie&&(ie.default={duration:R(F,12),flags:R(F,20)})}),v}function S(w,v){return _(v,["moof","traf"]).reduce(function(m,L){var y=_(L,["tfdt"])[0],f=y.data[y.start],p=_(L,["tfhd"]).reduce(function(u,o){var E=R(o,4),g=w[E];if(g){var x=R(y,4);f===1&&(x*=Math.pow(2,32),x+=R(y,8));var I=g.timescale||9e4,j=x/I;if(isFinite(j)&&(u===null||j<u))return j}return u},null);return p!==null&&isFinite(p)&&(m===null||p<m)?p:m},null)||0}function C(w,v){for(var m=0,L=0,y=0,f=_(w,["moof","traf"]),p=0;p<f.length;p++){var u=f[p],o=_(u,["tfhd"])[0],E=R(o,4),g=v[E];if(!g)continue;var x=g.default,I=R(o,0)|(x==null?void 0:x.flags),j=x==null?void 0:x.duration;I&8&&(I&2?j=R(o,12):j=R(o,8));for(var G=g.timescale||9e4,V=_(u,["trun"]),M=0;M<V.length;M++){if(j){var F=R(V[M],4);m=j*F}else m=h(V[M]);g.type===U.ElementaryStreamTypes.VIDEO?L+=m/G:g.type===U.ElementaryStreamTypes.AUDIO&&(y+=m/G)}}if(L===0&&y===0){var $=P(w);if($!=null&&$.references)return $.references.reduce(function(ie,de){return ie+de.info.duration||0},0)}return L||y}function h(w){var v=R(w,0),m=8;v&1&&(m+=4),v&4&&(m+=4);for(var L=0,y=R(w,4),f=0;f<y;f++){if(v&256){var p=R(w,m);L+=p,m+=4}v&512&&(m+=4),v&1024&&(m+=4),v&2048&&(m+=4)}return L}function a(w,v,m){_(v,["moof","traf"]).forEach(function(L){_(L,["tfhd"]).forEach(function(y){var f=R(y,4),p=w[f];if(!p)return;var u=p.timescale||9e4;_(L,["tfdt"]).forEach(function(o){var E=o.data[o.start],g=R(o,4);if(E===0)b(o,4,g-m*u);else{g*=Math.pow(2,32),g+=R(o,8),g-=m*u,g=Math.max(g,0);var x=Math.floor(g/(D+1)),I=Math.floor(g%(D+1));b(o,4,x),b(o,8,I)}})})})}function l(w){var v={valid:null,remainder:null},m=_(w,["moof"]);if(m){if(m.length<2)return v.remainder=w,v}else return v;var L=m[m.length-1];return v.valid=Object(Z.sliceUint8)(w,0,L.start-8),v.remainder=Object(Z.sliceUint8)(w,L.start-8),v}function d(w,v){var m=new Uint8Array(w.length+v.length);return m.set(w),m.set(v,w.length),m}},"./src/utils/output-filter.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"default",function(){return Z});var Z=function(){function U(K,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=H}var D=U.prototype;return D.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},D.newCue=function(H,N,R){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=N,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"sendAddTrackEvent",function(){return U}),O.d(J,"addCueToTrack",function(){return D}),O.d(J,"clearCurrentCues",function(){return K}),O.d(J,"removeCuesInRange",function(){return H}),O.d(J,"getCuesInRange",function(){return R});var Z=O("./src/utils/logger.ts");function U(b,_){var P;try{P=new Event("addtrack")}catch(A){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=b,_.dispatchEvent(P)}function D(b,_){var P=b.mode;if(P==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(_.id))try{if(b.addCue(_),!b.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(S){Z.logger.debug("[texttrack-utils]: "+S);var A=new self.TextTrackCue(_.startTime,_.endTime,_.text);A.id=_.id,b.addCue(A)}P==="disabled"&&(b.mode=P)}function K(b){var _=b.mode;if(_==="disabled"&&(b.mode="hidden"),b.cues)for(var P=b.cues.length;P--;)b.removeCue(b.cues[P]);_==="disabled"&&(b.mode=_)}function H(b,_,P){var A=b.mode;if(A==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var S=R(b.cues,_,P),C=0;C<S.length;C++)b.removeCue(S[C]);A==="disabled"&&(b.mode=A)}function N(b,_){if(_<b[0].startTime)return 0;var P=b.length-1;if(_>b[P].endTime)return-1;for(var A=0,S=P;A<=S;){var C=Math.floor((S+A)/2);if(_<b[C].startTime)S=C-1;else if(_>b[C].startTime&&A<P)A=C+1;else return C}return b[A].startTime-_<_-b[S].startTime?A:S}function R(b,_,P){var A=[],S=N(b,_);if(S>-1)for(var C=S,h=b.length;C<h;C++){var a=b[C];if(a.startTime>=_&&a.endTime<=P)A.push(a);else if(a.startTime>P)return A}return A}},"./src/utils/time-ranges.ts":function(ce,J,O){"use strict";O.r(J);var Z={toString:function(D){for(var K="",H=D.length,N=0;N<H;N++)K+="["+D.start(N).toFixed(3)+","+D.end(N).toFixed(3)+"]";return K}};J.default=Z},"./src/utils/timescale-conversion.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"toTimescaleFromBase",function(){return U}),O.d(J,"toTimescaleFromScale",function(){return D}),O.d(J,"toMsFromMpegTsClock",function(){return K}),O.d(J,"toMpegTsClockFromTimescale",function(){return H});var Z=9e4;function U(N,R,b,_){b===void 0&&(b=1),_===void 0&&(_=!1);var P=N*R*b;return _?Math.round(P):P}function D(N,R,b,_){return b===void 0&&(b=1),_===void 0&&(_=!1),U(N,R,1/b,_)}function K(N,R){return R===void 0&&(R=!1),U(N,1e3,1/Z,R)}function H(N,R){return R===void 0&&(R=1),U(N,Z,1/R)}},"./src/utils/typed-array.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"sliceUint8",function(){return Z});function Z(U,D,K){return Uint8Array.prototype.slice?U.slice(D,K):new Uint8Array(Array.prototype.slice.call(U,D,K))}},"./src/utils/vttcue.ts":function(ce,J,O){"use strict";O.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],U=["start","middle","end","left","right"];function D(b,_){if(typeof _!="string")return!1;if(!Array.isArray(b))return!1;var P=_.toLowerCase();return~b.indexOf(P)?P:!1}function K(b){return D(Z,b)}function H(b){return D(U,b)}function N(b){for(var _=arguments.length,P=new Array(_>1?_-1:0),A=1;A<_;A++)P[A-1]=arguments[A];for(var S=1;S<arguments.length;S++){var C=arguments[S];for(var h in C)b[h]=C[h]}return b}function R(b,_,P){var A=this,S={enumerable:!0};A.hasBeenReset=!1;var C="",h=!1,a=b,l=_,d=P,w=null,v="",m=!0,L="auto",y="start",f=50,p="middle",u=50,o="middle";Object.defineProperty(A,"id",N({},S,{get:function(){return C},set:function(g){C=""+g}})),Object.defineProperty(A,"pauseOnExit",N({},S,{get:function(){return h},set:function(g){h=!!g}})),Object.defineProperty(A,"startTime",N({},S,{get:function(){return a},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");a=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"endTime",N({},S,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"text",N({},S,{get:function(){return d},set:function(g){d=""+g,this.hasBeenReset=!0}})),Object.defineProperty(A,"region",N({},S,{get:function(){return w},set:function(g){w=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"vertical",N({},S,{get:function(){return v},set:function(g){var x=K(g);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"snapToLines",N({},S,{get:function(){return m},set:function(g){m=!!g,this.hasBeenReset=!0}})),Object.defineProperty(A,"line",N({},S,{get:function(){return L},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"lineAlign",N({},S,{get:function(){return y},set:function(g){var x=H(g);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");y=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"position",N({},S,{get:function(){return f},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");f=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"positionAlign",N({},S,{get:function(){return p},set:function(g){var x=H(g);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");p=x,this.hasBeenReset=!0}})),Object.defineProperty(A,"size",N({},S,{get:function(){return u},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");u=g,this.hasBeenReset=!0}})),Object.defineProperty(A,"align",N({},S,{get:function(){return o},set:function(g){var x=H(g);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");o=x,this.hasBeenReset=!0}})),A.displayState=void 0}return R.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"parseTimeStamp",function(){return D}),O.d(J,"fixLineBreaks",function(){return _}),O.d(J,"VTTParser",function(){return P});var Z=O("./src/utils/vttcue.ts"),U=function(){function A(){}var S=A.prototype;return S.decode=function(h,a){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},A}();function D(A){function S(h,a,l,d){return(h|0)*3600+(a|0)*60+(l|0)+parseFloat(d||0)}var C=A.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?S(C[2],C[3],0,C[4]):S(C[1],C[2],C[3],C[4]):null}var K=function(){function A(){this.values=Object.create(null)}var S=A.prototype;return S.set=function(h,a){!this.get(h)&&a!==""&&(this.values[h]=a)},S.get=function(h,a,l){return l?this.has(h)?this.values[h]:a[l]:this.has(h)?this.values[h]:a},S.has=function(h){return h in this.values},S.alt=function(h,a,l){for(var d=0;d<l.length;++d)if(a===l[d]){this.set(h,a);break}},S.integer=function(h,a){/^-?\d+$/.test(a)&&this.set(h,parseInt(a,10))},S.percent=function(h,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},A}();function H(A,S,C,h){var a=h?A.split(h):[A];for(var l in a){if(typeof a[l]!="string")continue;var d=a[l].split(C);if(d.length!==2)continue;var w=d[0],v=d[1];S(w,v)}}var N=new Z.default(0,0,""),R=N.align==="middle"?"middle":"center";function b(A,S,C){var h=A;function a(){var w=D(A);if(w===null)throw new Error("Malformed timestamp: "+h);return A=A.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,v){var m=new K;H(w,function(f,p){var u;switch(f){case"region":for(var o=C.length-1;o>=0;o--)if(C[o].id===p){m.set(f,C[o].region);break}break;case"vertical":m.alt(f,p,["rl","lr"]);break;case"line":u=p.split(","),m.integer(f,u[0]),m.percent(f,u[0])&&m.set("snapToLines",!1),m.alt(f,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",R,"end"]);break;case"position":u=p.split(","),m.percent(f,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,p);break;case"align":m.alt(f,p,["start",R,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var L=m.get("line","auto");L==="auto"&&N.line===-1&&(L=-1),v.line=L,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",R);var y=m.get("position","auto");y==="auto"&&N.position===50&&(y=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=y}function d(){A=A.replace(/^\s+/,"")}if(d(),S.startTime=a(),d(),A.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);A=A.substr(3),d(),S.endTime=a(),d(),l(A,S)}function _(A){return A.replace(/<br(?: \/)?>/gi,`
`)}var P=function(){function A(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=A.prototype;return S.parse=function(h){var a=this;h&&(a.buffer+=a.decoder.decode(h,{stream:!0}));function l(){var y=a.buffer,f=0;for(y=_(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
`;)++f;var p=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
`&&++f,a.buffer=y.substr(f),p}function d(y){H(y,function(f,p){},/:/)}try{var w="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;w=l();var v=w.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var m=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;m?m=!1:w=l();switch(a.state){case"HEADER":/:/.test(w)?d(w):w||(a.state="ID");continue;case"NOTE":w||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){a.state="NOTE";break}if(!w)continue;if(a.cue=new Z.default(0,0,""),a.state="CUE",w.indexOf("-->")===-1){a.cue.id=w;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{b(w,a.cue,a.regionList)}catch(y){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(m=!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+=w}continue;case"BADCUE":w||(a.state="ID")}}}catch(y){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){h.onparsingerror&&h.onparsingerror(a)}return h.onflush&&h.onflush(),this},A}()},"./src/utils/webvtt-parser.ts":function(ce,J,O){"use strict";O.r(J),O.d(J,"generateCueId",function(){return P}),O.d(J,"parseWebVTT",function(){return S});var Z=O("./src/polyfills/number.ts"),U=O("./src/utils/vttparser.ts"),D=O("./src/demux/id3.ts"),K=O("./src/utils/timescale-conversion.ts"),H=O("./src/remux/mp4-remuxer.ts"),N=/\r\n|\n\r|\n|\r/g,R=function(h,a,l){return l===void 0&&(l=0),h.substr(l,a.length)===a},b=function(h){var a=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),w=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(a)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return a+=1e3*l,a+=60*1e3*d,a+=60*60*1e3*w,a},_=function(h){for(var a=5381,l=h.length;l;)a=a*33^h.charCodeAt(--l);return(a>>>0).toString()};function P(C,h,a){return _(C.toString())+_(h.toString())+_(a)}var A=function(h,a,l){var d=h[a],w=h[d.prevCC];if(!w||!w.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(v=w)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=d.start-w.start,d.new=!1,d=w,w=h[d.prevCC]}h.presentationOffset=l};function S(C,h,a,l,d,w,v,m){var L=new U.VTTParser,y=Object(D.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(N,`
`).split(`
`),f=[],p=Object(K.toMpegTsClockFromTimescale)(h,a),u="00:00.000",o=0,E=0,g,x=!0,I=!1;L.oncue=function(j){var G=l[d],V=l.ccOffset,M=(o-p)/9e4;if(G!=null&&G.new&&(E!==void 0?V=l.ccOffset=G.start:A(l,d,M)),M&&(V=M-l.presentationOffset),I){var F=j.endTime-j.startTime,$=Object(H.normalizePts)((j.startTime+V-E)*9e4,w*9e4)/9e4;j.startTime=$,j.endTime=$+F}var ie=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(ie)),j.id||(j.id=P(j.startTime,j.endTime,ie)),j.endTime>0&&f.push(j)},L.onparsingerror=function(j){g=j},L.onflush=function(){if(g){m(g);return}v(f)},y.forEach(function(j){if(x)if(R(j,"X-TIMESTAMP-MAP=")){x=!1,I=!0,j.substr(16).split(",").forEach(function(G){R(G,"LOCAL:")?u=G.substr(6):R(G,"MPEGTS:")&&(o=parseInt(G.substr(7)))});try{E=b(u)/1e3}catch(G){I=!1,g=G}return}else j===""&&(x=!1);L.parse(j+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(ce,J,O){"use strict";O.r(J);var Z=O("./src/utils/logger.ts"),U=O("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,K=function(){function H(R){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=R?R.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var N=H.prototype;return N.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},N.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},N.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},N.load=function(b,_,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=_,this.callbacks=P,this.retryDelay=_.retryDelay,this.loadInternal()},N.loadInternal=function(){var b=this.config,_=this.context;if(!b)return;var P=this.loader=new self.XMLHttpRequest,A=this.stats;A.loading.first=0,A.loaded=0;var S=this.xhrSetup;try{if(S)try{S(P,_.url)}catch(a){P.open("GET",_.url,!0),S(P,_.url)}P.readyState||P.open("GET",_.url,!0);var C=this.context.headers;if(C)for(var h in C)P.setRequestHeader(h,C[h])}catch(a){this.callbacks.onError({code:P.status,text:a.message},_,P);return}_.rangeEnd&&P.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),P.send()},N.readystatechange=function(){var b=this.context,_=this.loader,P=this.stats;if(!b||!_)return;var A=_.readyState,S=this.config;if(P.aborted)return;if(A>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),A===4){_.onreadystatechange=null,_.onprogress=null;var C=_.status;if(C>=200&&C<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,a;if(b.responseType==="arraybuffer"?(h=_.response,a=h.byteLength):(h=_.responseText,a=h.length),P.loaded=P.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(P,b,h,_),!this.callbacks)return;var d={url:_.responseURL,data:h};this.callbacks.onSuccess(d,P,b,_)}else P.retry>=S.maxRetry||C>=400&&C<499?(Z.logger.error(C+" while loading "+b.url),this.callbacks.onError({code:C,text:_.statusText},b,_)):(Z.logger.warn(C+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,S.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},N.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},N.loadprogress=function(b){var _=this.stats;_.loaded=b.loaded,b.lengthComputable&&(_.total=b.total)},N.getCacheAge=function(){var b=null;if(this.loader&&D.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");b=_?parseFloat(_):null}return b},H}();J.default=K}}).default})},vHTk:function(nt,ze,oe){nt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(nt,ze,oe){"use strict";oe.d(ze,"c",function(){return U}),oe.d(ze,"b",function(){return D}),oe.d(ze,"d",function(){return K}),oe.d(ze,"a",function(){return N}),oe.d(ze,"e",function(){return R});var ce=oe("9og8"),J=oe("WmNS"),O=oe.n(J),Z=oe("ErOA");function U(b){return Object(Z.c)("libraries/".concat(b,".json"))}function D(){return Object(Z.c)("library_tags.json")}function K(b){return H.apply(this,arguments)}function H(){return H=Object(ce.a)(O.a.mark(function b(_){var P;return O.a.wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,Object(Z.b)("attachments/".concat(_,".json"));case 2:return P=S.sent,S.abrupt("return",P.status===0);case 4:case"end":return S.stop()}},b)})),H.apply(this,arguments)}function N(b){return Object(Z.f)("libraries.json",b)}function R(b,_){return Object(Z.g)("libraries/".concat(b,".json"),_)}},y5JW:function(nt,ze,oe){"use strict";oe.d(ze,"c",function(){return C}),oe.d(ze,"a",function(){return h});var ce=oe("DZo9"),J=oe("8z0m"),O=oe("+L6B"),Z=oe("2/Rp"),U=oe("9og8"),D=oe("miYZ"),K=oe("tsqr"),H=oe("k1fw"),N=oe("oBTY"),R=oe("WmNS"),b=oe.n(R),_=oe("q1tI"),P=oe.n(_),A=oe("m3rI"),S=oe("wzkS"),C="\u3000\u3000";function h(a){var l=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var d=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,d)).toFixed(1)+" "+l[d]}ze.b=function(a){var l=a.value,d=l===void 0?[]:l,w=a.action,v=a.onChange,m=a.className,L=a.maxSize,y=L===void 0?150:L,f=a.title,p=f===void 0?"\u6587\u4EF6\u4E0A\u4F20":f,u=a.accept,o=u===void 0?null:u,E={multiple:!1,fileList:d,accept:o,withCredentials:!0,beforeUpload:function(I){var j=I.size/1024/1024;return!0},action:"".concat(A.a.API_SERVER,"/api/attachments.json"),onChange:function(I){var j,G,V=Object(N.a)(I.fileList);if(V=V.map(function($){return $.name.indexOf(C)===-1&&($.name="".concat($.name).concat(C).concat(h($.size))),Object(H.a)({},$)}),I.file.status==="done"&&((j=I.file)===null||j===void 0||((G=j.response)===null||G===void 0)?void 0:G.status)===-1){var M,F;K.b.error((M=I.file)===null||M===void 0||((F=M.response)===null||F===void 0)?void 0:F.message),v([]);return}v(V)},onRemove:function(){var x=Object(U.a)(b.a.mark(function j(G){var V,M,F;return b.a.wrap(function(ie){for(;;)switch(ie.prev=ie.next){case 0:if(V=G.size/1024/1024,!(G.status==="uploading")){ie.next=3;break}return ie.abrupt("return",!0);case 3:if(V<y){ie.next=7;break}return ie.abrupt("return",!0);case 7:if(M=G.response?G.response.id:G.uid,!M){ie.next=15;break}return ie.next=11,Object(S.d)(G.response?G.response.id:G.id);case 11:return F=ie.sent,ie.abrupt("return",F);case 15:return ie.abrupt("return",!0);case 16:case"end":return ie.stop()}},j)}));function I(j){return x.apply(this,arguments)}return I}()};function g(x){x.preventDefault(),x.stopPropagation()}return P.a.createElement("div",{className:"single-upload ".concat(m||"")},P.a.createElement(J.a,E,P.a.createElement(Z.a,{type:"primary",title:d.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:d.length>0,ghost:!0},p),P.a.createElement("span",{onClick:g,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",y,"M)"," ")))}},"yTi+":function(nt,ze,oe){nt.exports=oe.p+"static/AssistantCode3.fdd8db3c.jpeg"}}]);