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
957 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[306,6,7,15],{"+NIl":function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){"use strict";le.defineMode("stex",function($,R){"use strict";function Z(T,C){T.cmdState.push(C)}function B(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function P(T){var C=T.cmdState.pop();C&&C.closeBracket()}function K(T){for(var C=T.cmdState,E=C.length-1;E>=0;E--){var d=C[E];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(T,C,E){return function(){this.name=T,this.bracketNo=0,this.style=C,this.styles=E,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=U("importmodule","tag",["string","builtin"]),N.documentclass=U("documentclass","tag",["","atom"]),N.usepackage=U("usepackage","tag",["atom"]),N.begin=U("begin","tag",["atom"]),N.end=U("end","tag",["atom"]),N.label=U("label","tag",["atom"]),N.ref=U("ref","tag",["atom"]),N.eqref=U("eqref","tag",["atom"]),N.cite=U("cite","tag",["atom"]),N.bibitem=U("bibitem","tag",["atom"]),N.Bibitem=U("Bibitem","tag",["atom"]),N.RBibitem=U("RBibitem","tag",["atom"]),N.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(T,C){T.f=C}function b(T,C){var E;if(T.match(/^\\[a-zA-Z@]+/)){var d=T.current().slice(1);return E=N.hasOwnProperty(d)?N[d]:N.DEFAULT,E=new E,Z(C,E),D(C,k),E.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return D(C,function(l,h){return A(l,h,"\\]")}),"keyword";if(T.match("\\("))return D(C,function(l,h){return A(l,h,"\\)")}),"keyword";if(T.match("$$"))return D(C,function(l,h){return A(l,h,"$$")}),"keyword";if(T.match("$"))return D(C,function(l,h){return A(l,h,"$")}),"keyword";var a=T.next();if(a=="%")return T.skipToEnd(),"comment";if(a=="}"||a=="]"){if(E=B(C),E)E.closeBracket(a),D(C,k);else return"error";return"bracket"}else return a=="{"||a=="["?(E=N.DEFAULT,E=new E,Z(C,E),"bracket"):/\d/.test(a)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),E=K(C),E.name=="begin"&&(E.argument=T.current()),E.styleIdentifier())}function A(T,C,E){if(T.eatSpace())return null;if(E&&T.match(E))return D(C,b),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=T.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(T.skipToEnd(),"comment"):"error"}function k(T,C){var E=T.peek(),d;return E=="{"||E=="["?(d=B(C),d.openBracket(E),T.eat(E),D(C,b),"bracket"):/[ \t\r]/.test(E)?(T.eat(E),null):(D(C,b),P(C),b(T,C))}return{startState:function(){var T=R.inMathMode?function(C,E){return A(C,E)}:b;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,C){return C.f(T,C)},blankLine:function(T){T.f=b,T.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"19Vz":function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){le.defineOption("placeholder","",function(U,N,D){var b=D&&D!=le.Init;if(N&&!b)U.on("blur",B),U.on("change",P),U.on("swapDoc",P),le.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){Z(U)}),P(U);else if(!N&&b){U.off("blur",B),U.off("change",P),U.off("swapDoc",P),le.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),$(U);var A=U.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}N&&!U.hasFocus()&&B(U)});function $(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function R(U){$(U);var N=U.state.placeholder=document.createElement("pre");N.style.cssText="height: 0; overflow: visible",N.style.direction=U.getOption("direction"),N.className="CodeMirror-placeholder CodeMirror-line-like";var D=U.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),N.appendChild(D),U.display.lineSpace.insertBefore(N,U.display.lineSpace.firstChild)}function Z(U){setTimeout(function(){var N=!1,D=U.getInputField();D.nodeName=="TEXTAREA"?N=!D.value:U.lineCount()==1&&(N=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),N?R(U):$(U)},20)}function B(U){K(U)&&R(U)}function P(U){var N=U.getWrapperElement(),D=K(U);N.className=N.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?R(U):$(U)}function K(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function(Z,B){var P=Z.indentUnit,K={},U=B.htmlMode?$:R;for(var N in U)K[N]=U[N];for(var N in B)K[N]=B[N];var D,b;function A(o,x){function v(j){return x.tokenize=j,j(o,x)}var S=o.next();if(S=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?v(C("atom","]]>")):null:o.match("--")?v(C("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),v(E(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),x.tokenize=C("meta","?>"),"meta"):(D=o.eat("/")?"closeTag":"openTag",x.tokenize=k,"tag bracket");if(S=="&"){var M;return o.eat("#")?o.eat("x")?M=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):M=o.eatWhile(/[\d]/)&&o.eat(";"):M=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),M?"atom":"error"}else return o.eatWhile(/[^&<]/),null}A.isInText=!0;function k(o,x){var v=o.next();if(v==">"||v=="/"&&o.eat(">"))return x.tokenize=A,D=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return D="equals",null;if(v=="<"){x.tokenize=A,x.state=h,x.tagName=x.tagStart=null;var S=x.tokenize(o,x);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(v)?(x.tokenize=T(v),x.stringStartCol=o.column(),x.tokenize(o,x)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(o){var x=function(v,S){for(;!v.eol();)if(v.next()==o){S.tokenize=k;break}return"string"};return x.isInAttribute=!0,x}function C(o,x){return function(v,S){for(;!v.eol();){if(v.match(x)){S.tokenize=A;break}v.next()}return o}}function E(o){return function(x,v){for(var S;(S=x.next())!=null;){if(S=="<")return v.tokenize=E(o+1),v.tokenize(x,v);if(S==">")if(o==1){v.tokenize=A;break}else return v.tokenize=E(o-1),v.tokenize(x,v)}return"meta"}}function d(o,x,v){this.prev=o.context,this.tagName=x,this.indent=o.indented,this.startOfLine=v,(K.doNotIndent.hasOwnProperty(x)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,x){for(var v;;){if(!o.context)return;if(v=o.context.tagName,!K.contextGrabbers.hasOwnProperty(v)||!K.contextGrabbers[v].hasOwnProperty(x))return;a(o)}}function h(o,x,v){return o=="openTag"?(v.tagStart=x.column(),_):o=="closeTag"?g:h}function _(o,x,v){return o=="word"?(v.tagName=x.current(),b="tag",y):K.allowMissingTagName&&o=="endTag"?(b="tag bracket",y(o,x,v)):(b="error",_)}function g(o,x,v){if(o=="word"){var S=x.current();return v.context&&v.context.tagName!=S&&K.implicitlyClosed.hasOwnProperty(v.context.tagName)&&a(v),v.context&&v.context.tagName==S||K.matchClosing===!1?(b="tag",m):(b="tag error",L)}else return K.allowMissingTagName&&o=="endTag"?(b="tag bracket",m(o,x,v)):(b="error",L)}function m(o,x,v){return o!="endTag"?(b="error",m):(a(v),h)}function L(o,x,v){return b="error",m(o,x,v)}function y(o,x,v){if(o=="word")return b="attribute",c;if(o=="endTag"||o=="selfcloseTag"){var S=v.tagName,M=v.tagStart;return v.tagName=v.tagStart=null,o=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(S)?l(v,S):(l(v,S),v.context=new d(v,S,M==v.indented)),h}return b="error",y}function c(o,x,v){return o=="equals"?f:(K.allowMissing||(b="error"),y(o,x,v))}function f(o,x,v){return o=="string"?u:o=="word"&&K.allowUnquoted?(b="string",y):(b="error",y(o,x,v))}function u(o,x,v){return o=="string"?u:y(o,x,v)}return{startState:function(o){var x={tokenize:A,state:h,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(x.baseIndent=o),x},token:function(o,x){if(!x.tagName&&o.sol()&&(x.indented=o.indentation()),o.eatSpace())return null;D=null;var v=x.tokenize(o,x);return(v||D)&&v!="comment"&&(b=null,x.state=x.state(D||v,o,x),b&&(v=b=="error"?v+" error":b)),v},indent:function(o,x,v){var S=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(S&&S.noIndent)return le.Pass;if(o.tokenize!=k&&o.tokenize!=A)return v?v.match(/^(\s*)/)[0].length:0;if(o.tagName)return K.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var M=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(M&&M[1])for(;S;)if(S.tagName==M[2]){S=S.prev;break}else if(K.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(M)for(;S;){var j=K.contextGrabbers[S.tagName];if(j&&j.hasOwnProperty(M[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+P:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=y)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var x=[],v=o.context;v;v=v.prev)v.tagName&&x.push(v.tagName);return x.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3vs6":function(ht,Qe,re){"use strict";var le=re("+L6B"),$=re("2/Rp"),R=re("5Dmo"),Z=re("3S7+"),B=re("k1fw"),P=re("miYZ"),K=re("tsqr"),U=re("9og8"),N=re("2qtc"),D=re("kLXV"),b=re("tJVT"),A=re("WmNS"),k=re.n(A),T=re("q1tI"),C=re.n(T),E=re("ttuQ"),d=re.n(E),a=re("ErOA"),l=re("m3rI"),h=re("IE1O"),_=re("xKgJ"),g=re("NLgs"),m=re("Ty5D"),L=re("9kvl"),y=function(f){var u=f.virtualSpaces,o=f.user,x=f.dispatch,v=Object(T.useState)(!1),S=Object(b.a)(v,2),M=S[0],j=S[1],G=Object(m.i)(),V=u.virtualSpacesDetails;Object(T.useEffect)(function(){O()},[]);var O=function(){x({type:"virtualSpaces/getVirtualSpacesDetails",payload:{id:G==null?void 0:G.virtual_spacesId}})},I=function(){if(!Object(g.f)(x))return;D.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:C.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(U.a)(k.a.mark(function Te(){var ye;return k.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return se.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,"/apply_become_member.json"),{method:"post"});case 2:ye=se.sent,(ye==null?void 0:ye.status)!==-1&&(K.b.success(ye==null?void 0:ye.message),O());case 4:case"end":return se.stop()}},Te)}));function we(){return Ee.apply(this,arguments)}return we}()})},X=function(){D.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:C.a.createElement("div",{className:"font14"},C.a.createElement("p",null,"\u786E\u8BA4\u5411\u5E73\u53F0\u7533\u8BF7\u516C\u5F00\u865A\u62DF\u793E\u533A\u5417\uFF1F"),C.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"),C.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(U.a)(k.a.mark(function Te(){var ye;return k.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return se.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,"/apply_public.json"),{method:"post"});case 2:ye=se.sent,(ye==null?void 0:ye.status)!==-1&&(K.b.success(ye==null?void 0:ye.message),O());case 4:case"end":return se.stop()}},Te)}));function we(){return Ee.apply(this,arguments)}return we}()})},q=function(){var Le=Object(U.a)(k.a.mark(function Ee(we){var Te;return k.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Object(a.a)("/api/virtual_classrooms/".concat(G==null?void 0:G.virtual_spacesId,".json"),{method:"put",body:we});case 2:Te=fe.sent,(Te==null?void 0:Te.status)===0&&(O(),j(!1));case 4:case"end":return fe.stop()}},Ee)}));return function(we){return Le.apply(this,arguments)}}(),oe=function(){var Le=Object(U.a)(k.a.mark(function Ee(we){return k.a.wrap(function(ye){for(;;)switch(ye.prev=ye.next){case 0:j(Object(B.a)({},V));case 1:case"end":return ye.stop()}},Ee)}));return function(we){return Le.apply(this,arguments)}}(),ce=(V==null?void 0:V.is_member)||Object(_.v)();return C.a.createElement("div",{className:d.a.bg,style:{background:"url('".concat(l.a.IMG_SERVER+(V==null?void 0:V.backbground_image_url),"') no-repeat center center")}},C.a.createElement("aside",null,C.a.createElement("div",null,C.a.createElement("div",{className:d.a.member},C.a.createElement("div",null,C.a.createElement(Z.a,{title:"\u6210\u5458\u603B\u6570"},C.a.createElement("i",{style:{color:"#FF8B58",fontSize:24},className:"iconfont icon-a-chengyuan1"})),C.a.createElement(Z.a,{title:"\u6210\u5458\u603B\u6570"},C.a.createElement("span",null,V==null?void 0:V.members_count))),C.a.createElement("div",null,C.a.createElement(Z.a,{title:"\u8D44\u6E90\u603B\u6570"},C.a.createElement("i",{style:{color:"#07C160",marginLeft:100},className:"iconfont icon-a-ziyuanku1"})),C.a.createElement(Z.a,{title:"\u8D44\u6E90\u603B\u6570"},C.a.createElement("span",null,V==null?void 0:V.resources_count)))),ce&&C.a.createElement($.a,{disabled:(V==null?void 0:V.status)!==2,onClick:X,type:"primary"},C.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"),!ce&&C.a.createElement($.a,{onClick:I,type:"primary"},C.a.createElement("i",{className:"iconfont icon-shenqingjiaru2 mr5 font14"}),"\u7533\u8BF7\u52A0\u5165"))),C.a.createElement(h.b,{visible:M,title:"\u7F16\u8F91\u865A\u62DF\u793E\u533A",onCancel:function(){return j(!1)},onOk:q}))};Qe.a=Object(L.a)(function(c){var f=c.virtualSpaces,u=c.user;return{virtualSpaces:f,user:u}})(y)},"500L":function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return g});var le=re("+L6B"),$=re("2/Rp"),R=re("2qtc"),Z=re("kLXV"),B=re("9og8"),P=re("k1fw"),K=re("miYZ"),U=re("tsqr"),N=re("oBTY"),D=re("tJVT"),b=re("DZo9"),A=re("8z0m"),k=re("WmNS"),T=re.n(k),C=re("q1tI"),E=re.n(C),d=re("m3rI"),a=re("wzkS"),l=re("y5JW"),h=re("LtfV"),_=A.a.Dragger;function g(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}Qe.b=function(m){var L=m.value,y=m.onChange,c=m.action,f=m.className,u=m.maxSize,o=u===void 0?150:u,x=m.title,v=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,S=m.showRemoveModal,M=S===void 0?!1:S,j=m.accept,G=j===void 0?"":j,V=m.additionalText,O=m.isDragger,I=m.number,X=I===void 0?1e3:I,q=m.aloneClear,oe=q===void 0?!1:q,ce=Object(C.useState)(!1),Le=Object(D.a)(ce,2),Ee=Le[0],we=Le[1],Te=Object(C.useState)(L||[]),ye=Object(D.a)(Te,2),fe=ye[0],se=ye[1];Object(C.useEffect)(function(){L&&(se(Object(N.a)(L)),X===(L==null?void 0:L.length)&&we(!0))},[L]);var te=function(){setTimeout(function(){fe.pop(),se(Object(N.a)(fe))},500)},ue={multiple:!0,disabled:Ee,accept:G,withCredentials:!0,fileList:fe,beforeUpload:function(Re,xe){var ke=Re.size/1024/1024;return fe.concat(xe).length>X?(fe.pop(),se(Object(N.a)(fe)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(X,"\u4E2A\u6587\u4EF6")),oe?Promise.reject():(te(),!1)):!0},action:c||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Re){var xe,ke,Ne=Object(N.a)(Re.fileList);if(Re.file.status==="done"&&((xe=Re.file)===null||xe===void 0||((ke=xe.response)===null||ke===void 0)?void 0:ke.status)===-1){var He,Fe;U.b.error((He=Re.file)===null||He===void 0||((Fe=He.response)===null||Fe===void 0)?void 0:Fe.message);return}Ne.length>=X?we(!0):we(!1),se(Object(N.a)(Ne)),Ne=Ne.map(function(Me){var Oe;if(Me!=null&&(Oe=Me.response)!==null&&Oe!==void 0&&Oe.id){var Ye;Me.url="/api/attachments/".concat(Me==null||((Ye=Me.response)===null||Ye===void 0)?void 0:Ye.id)}return Me.name.indexOf(l.c)===-1&&(Me.name="".concat(Me.name).concat(l.c).concat(Object(l.a)(Me.size))),Object(P.a)({},Me)}),console.log("info:",Re),y(Ne)},onRemove:function(){var _e=Object(B.a)(T.a.mark(function xe(ke){var Ne;return T.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Ne=function(){var Me=Object(B.a)(T.a.mark(function Oe(){var Ye,Ze;return T.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Ye=ke.response?ke.response.id:ke.id,!Ye){je.next=8;break}return je.next=4,Object(a.d)(ke.response?ke.response.id:ke.uid);case 4:return Ze=je.sent,je.abrupt("return",Ze);case 8:return je.abrupt("return",!0);case 9:case"end":return je.stop()}},Oe)}));return function(){return Me.apply(this,arguments)}}(),!M){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(Me,Oe){Z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:E.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ye=Object(B.a)(T.a.mark(function Ve(){var je;return T.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Ne();case 2:je=Je.sent,U.b.success("\u5220\u9664\u6210\u529F"),Me(!0);case 5:case"end":return Je.stop()}},Ve)}));function Ze(){return Ye.apply(this,arguments)}return Ze}(),onCancel:function(){return Me(!1)}})}));case 5:return Fe.next=7,Ne();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},xe)}));function Re(xe){return _e.apply(this,arguments)}return Re}()};function ne(_e){_e.preventDefault(),_e.stopPropagation()}return E.a.createElement("div",{className:"multi-upload ".concat(f||"")},O&&E.a.createElement(_,ue,E.a.createElement("p",{className:"ant-upload-drag-icon"},E.a.createElement(h.a,null)),E.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",E.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB)"," "),V),!O&&E.a.createElement(A.a,ue,E.a.createElement($.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:E.a.createElement("i",{className:"iconfont icon-shangchuan3",style:{marginRight:"6px"}}),disabled:Ee},v),E.a.createElement("span",{onClick:ne,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB)"," ")))}},"7Cbv":function(ht,Qe,re){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function R(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le($)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B(k){return typeof k=="string"&&Z.test(k)}for(var P=B,K=[],U=0;U<256;++U)K.push((U+256).toString(16).substr(1));function N(k){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(K[k[T+0]]+K[k[T+1]]+K[k[T+2]]+K[k[T+3]]+"-"+K[k[T+4]]+K[k[T+5]]+"-"+K[k[T+6]]+K[k[T+7]]+"-"+K[k[T+8]]+K[k[T+9]]+"-"+K[k[T+10]]+K[k[T+11]]+K[k[T+12]]+K[k[T+13]]+K[k[T+14]]+K[k[T+15]]).toLowerCase();if(!P(C))throw TypeError("Stringified UUID is invalid");return C}var D=N;function b(k,T,C){k=k||{};var E=k.random||(k.rng||R)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,T){C=C||0;for(var d=0;d<16;++d)T[C+d]=E[d];return T}return D(E)}var A=Qe.a=b},"7ahc":function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return _});var le=re("k1fw"),$=re("0Owb"),R=re("+L6B"),Z=re("2/Rp"),B=re("y8nQ"),P=re("Vl3Y"),K=re("tJVT"),U=re("OaEy"),N=re("2fM7"),D=re("q1tI"),b=re.n(D),A=re("VrN/"),k=re.n(A),T=re("p77/"),C=re.n(T),E=re("c5Ni"),d=re.n(E),a=N.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};Qe.b=function(g){var m=g.callback,L=g.onCancel,y=Object(D.useState)("python"),c=Object(K.a)(y,2),f=c[0],u=c[1];function o(v){u(h[v][1])}function x(v){m(v)}return b.a.createElement(P.a,Object($.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(N.a,{onChange:o},Object.keys(h).map(function(v){return b.a.createElement(a,{key:v,value:v},h[v][0])}))),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(_,{mode:f})),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 _(g){var m=g.value,L=g.onChange,y=g.mode,c=g.options,f=c===void 0?{}:c,u=Object(D.useRef)(),o=Object(D.useState)(),x=Object(K.a)(o,2),v=x[0],S=x[1];return Object(D.useEffect)(function(){if(v){function M(j){var G=j.getValue();L&&L(G)}return v.on("change",M),function(){v.off("change",M)}}},[v,L]),Object(D.useEffect)(function(){v&&v.setOption("mode",y)},[v,y]),Object(D.useEffect)(function(){v&&((m!==v.getValue()||m==="")&&setTimeout(function(){v.setValue(m||" ")},300))},[v,m]),Object(D.useEffect)(function(){if(u.current&&!v){var M=k.a.fromTextArea(u.current,Object(le.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));S(M)}},[u.current,v]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:u}))}},"7ixt":function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return R});var le={adjustX:1,adjustY:1},$=[0,0],R={left:{points:["cr","cl"],overflow:le,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:le,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:le,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:le,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:le,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:le,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:le,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:le,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:le,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:le,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:le,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:le,offset:[-4,0],targetOffset:$}},Z=R},"8EBN":function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){"use strict";le.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$<le.modeInfo.length;$++){var R=le.modeInfo[$];R.mimes&&(R.mime=R.mimes[0])}le.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.mime==Z)return P;if(P.mimes){for(var K=0;K<P.mimes.length;K++)if(P.mimes[K]==Z)return P}}if(/\+xml$/.test(Z))return le.findModeByMIME("application/xml");if(/\+json$/.test(Z))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.ext){for(var K=0;K<P.ext.length;K++)if(P.ext[K]==Z)return P}}},le.findModeByFileName=function(Z){for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.file&&P.file.test(Z))return P}var K=Z.lastIndexOf("."),U=K>-1&&Z.substring(K+1,Z.length);if(U)return le.findModeByExtension(U)},le.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.name.toLowerCase()==Z)return P;if(P.alias){for(var K=0;K<P.alias.length;K++)if(P.alias[K].toLowerCase()==Z)return P}}}})},"8hTe":function(ht,Qe,re){ht.exports={button:"button___1wy9m"}},"9Bee":function(ht,Qe,re){"use strict";var le=re("DYRE"),$=re("zeV3"),R=re("+L6B"),Z=re("2/Rp"),B=re("k1fw"),P=re("9og8"),K=re("tJVT"),U=re("WmNS"),N=re.n(U),D=re("q1tI"),b=re.n(D),A=re("vg9a"),k=re("DlQD"),T=re.n(k),C=re("rUJ1");function E(z,s){var p=z.match(/^(\s+)(?:```)/);if(p===null)return s;var F=p[1];return s.split(`
`).map(function(Q){var H=Q.match(/^\s+/);if(H===null)return Q;var ge=Object(K.a)(H,1),We=ge[0];return We.length>=F.length?Q.slice(F.length):Q}).join(`
`)}var d=[],a=["<ul>"],l=new T.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function _(){d.length=0,a=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(z,s,p,F){if(s>=z.length||z[s].level<=p)return s;var Q=z[s];F.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),s++;var H=[];return s=m(z,s,Q.level,H),H.length>0&&(F.push("<ul>"),H.forEach(function(ge){F.push(ge)}),F.push("</ul>")),F.push("</li>"),s=m(z,s,p,F),s}function L(){return m(d,0,0,a),a.push("</ul>"),a.join("")}var y={heading:function(s){var p=h.exec(s);if(p)return{type:"heading",raw:p[0],depth:p[1].length,text:p[2]}},fences:function(s){var p=this.rules.block.fences.exec(s);if(p){var F=p[0],Q=E(F,p[3]||""),H=p[2]?p[2].trim():p[2];if(["latex","katex","math"].indexOf(H)>=0){var ge=u(),We=Q;Q=ge,o[ge]={type:"block",expression:We}}return{type:"code",raw:F,lang:H,text:Q}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,u=function(){return"__special_katext_id_".concat(f++,"__")},o={};function x(){return o}function v(){f=0,o={}}function S(z){return z=z.replace(c,function(s,p){var F=u();return o[F]={type:"inline",expression:p},F}),z}var M=l.listitem;l.listitem=function(z){return M(S(z))};var j=l.paragraph;l.paragraph=function(z){return j(S(z))};var G=l.tablecell;l.tablecell=function(z,s){return G(S(z),s)},l.code=function(z,s,p){var F=(s||"").match(/\S*/)[0];return F?["latex","katex","math"].indexOf(F)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(p?z:Object(C.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(p?z:Object(C.escape)(z,!0))+"</code></pre>"},l.heading=function(z,s,p){var F=this.options.headerPrefix+p.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:F,level:s,text:z}),"<h"+s+' id="'+F+'">'+z+"</h"+s+">"},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:y,renderer:l});var V=T.a,O=re("SJMd"),I=re("ulZh"),X=re.n(I),q=re("m3rI"),oe=re("Oy/b"),ce=re("p5ED"),Le=re("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ee=function(z,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,F){p.__proto__=F}||function(p,F){for(var Q in F)Object.prototype.hasOwnProperty.call(F,Q)&&(p[Q]=F[Q])})(z,s)};function we(z,s){function p(){this.constructor=z}Ee(z,s),z.prototype=s===null?Object.create(s):(p.prototype=s.prototype,new p)}function Te(z,s,p,F){return new(p||(p=Promise))(function(Q,H){function ge(ft){try{et(F.next(ft))}catch(Ge){H(Ge)}}function We(ft){try{et(F.throw(ft))}catch(Ge){H(Ge)}}function et(ft){var Ge;ft.done?Q(ft.value):(Ge=ft.value,Ge instanceof p?Ge:new p(function(yt){yt(Ge)})).then(ge,We)}et((F=F.apply(z,s||[])).next())})}function ye(z,s){var p,F,Q,H,ge={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return H={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function We(et){return function(ft){return function(Ge){if(p)throw new TypeError("Generator is already executing.");for(;ge;)try{if(p=1,F&&(Q=2&Ge[0]?F.return:Ge[0]?F.throw||((Q=F.return)&&Q.call(F),0):F.next)&&!(Q=Q.call(F,Ge[1])).done)return Q;switch(F=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ge.label++,{value:Ge[1],done:!1};case 5:ge.label++,F=Ge[1],Ge=[0];continue;case 7:Ge=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Q=ge.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ge=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ge.label=Ge[1];break}if(Ge[0]===6&&ge.label<Q[1]){ge.label=Q[1],Q=Ge;break}if(Q&&ge.label<Q[2]){ge.label=Q[2],ge.ops.push(Ge);break}Q[2]&&ge.ops.pop(),ge.trys.pop();continue}Ge=s.call(z,ge)}catch(yt){Ge=[6,yt],F=0}finally{p=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,ft])}}}function fe(){for(var z=0,s=0,p=arguments.length;s<p;s++)z+=arguments[s].length;var F=Array(z),Q=0;for(s=0;s<p;s++)for(var H=arguments[s],ge=0,We=H.length;ge<We;ge++,Q++)F[Q]=H[ge];return F}var se=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,p){for(var F=0,Q=p;F<Q.length;F++){var H=Q[F],ge=H[0],We=H[1];s.setAttribute(ge,We)}},z.createRect=function(s,p,F){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",s.toString()),Q.setAttribute("height",p.toString()),F&&z.setAttributes(Q,F),Q},z.createLine=function(s,p,F,Q,H){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",s.toString()),ge.setAttribute("y1",p.toString()),ge.setAttribute("x2",F.toString()),ge.setAttribute("y2",Q.toString()),H&&z.setAttributes(ge,H),ge},z.createPolygon=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",s),p&&z.setAttributes(F,p),F},z.createCircle=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(s/2).toString()),F.setAttribute("cy",(s/2).toString()),F.setAttribute("r",s.toString()),p&&z.setAttributes(F,p),F},z.createEllipse=function(s,p,F){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(s/2).toString()),Q.setAttribute("cy",(p/2).toString()),Q.setAttribute("rx",(s/2).toString()),Q.setAttribute("ry",(p/2).toString()),F&&z.setAttributes(Q,F),Q},z.createGroup=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(p,s),p},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,p,F,Q,H,ge,We){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(et,[["id",s],["orient",p],["markerWidth",F.toString()],["markerHeight",Q.toString()],["refX",H.toString()],["refY",ge.toString()]]),et.appendChild(We),et},z.createText=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","text");return p.setAttribute("x","0"),p.setAttribute("y","0"),s&&z.setAttributes(p,s),p},z.createTSpan=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=s,p&&z.setAttributes(F,p),F},z.createImage=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(p,s),p},z.createPoint=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=s,F.y=p,F},z.createPath=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",s),p&&z.setAttributes(F,p),F},z}(),te=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}(),ue=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,p,F){var Q=this;return new Promise(function(H){var ge=F!==void 0?F:document.createElement("canvas");s===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var We=document.createElementNS("http://www.w3.org/2000/svg","svg");We.setAttribute("xmlns","http://www.w3.org/2000/svg"),We.setAttribute("width",p.width.baseVal.valueAsString),We.setAttribute("height",p.height.baseVal.valueAsString),We.setAttribute("viewBox","0 0 "+p.viewBox.baseVal.width.toString()+" "+p.viewBox.baseVal.height.toString()),We.innerHTML=p.innerHTML,Q.naturalSize===!0?(We.width.baseVal.value=s.naturalWidth,We.height.baseVal.value=s.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(We.width.baseVal.value=Q.width,We.height.baseVal.value=Q.height),ge.width=We.width.baseVal.value,ge.height=We.height.baseVal.value;var et=We.outerHTML,ft=ge.getContext("2d");Q.markersOnly!==!0&&ft.drawImage(s,0,0,ge.width,ge.height);var Ge=window.URL,yt=new Image(ge.width,ge.height);yt.setAttribute("crossOrigin","anonymous");var Nt=new Blob([et],{type:"image/svg+xml"}),Kt=Ge.createObjectURL(Nt);yt.onload=function(){ft.drawImage(yt,0,0),Ge.revokeObjectURL(Kt);var kr=ge.toDataURL(Q.imageType,Q.imageQuality);H(kr)},yt.src=Kt})},z}(),ne=function(){},_e=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 Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},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}(),Re=function(z,s){this.selector=z,this.style=s},xe=function(z,s){this.localName=z,this.style=s},ke=function(){function z(s,p,F,Q,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=p,this.markerItems=F,this.uiStyleSettings=Q,this.styles=H,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 p=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 F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",this.uiContainer.appendChild(F),this.addActionButton(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(H){var ge=document.createElement("div");ge.className=""+p.toolbarButtonStyleClass.name,ge.setAttribute("data-type-name",H.typeName),ge.innerHTML=H.icon,ge.addEventListener("click",function(){p.markerToolbarButtonClicked(ge,H)}),p.buttons.push(ge),p.markerButtons.push(ge)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},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 p=0;p<this.markerButtons.length;p++)p<s||p===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[p]):(p===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[p]))}},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(p){p.className=p.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),p.className=p.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),p.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,p,F){var Q=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=p,H.setAttribute("data-action",F),H.addEventListener("click",function(){Q.actionToolbarButtonClicked(H,F)}),F){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(H),this.buttons.push(H)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("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 xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,p){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("marker",p)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,p){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("action",p)}),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 p=this.markerButtons.find(function(F){return F.getAttribute("data-type-name")===s});p&&this.setActiveButton(p)},z.prototype.setCurrentMarker=function(s){var p=this;this.currentMarker=s,this.buttons.filter(function(F){return/delete|notes/.test(F.getAttribute("data-action"))}).forEach(function(F){p.currentMarker===void 0?(F.style.fillOpacity="0.4",F.style.pointerEvents="none"):(F.style.fillOpacity="1",F.style.pointerEvents="all")})},z}(),Ne=function(){function z(s,p,F,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=p,this.uiStyleSettings=F,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new xe("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var p=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new xe("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
padding: `+p+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var p;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((p=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&p!==void 0?p:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var p,F,Q=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((p=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&p!==void 0?p:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ge;H.uiStyleSettings=Q.uiStyleSettings;var We=document.createElement("div");We.className=Q.toolboxButtonStyleClass.name+" "+((ge=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ge!==void 0?ge:Q.toolboxButtonStyleColorsClass.name),We.innerHTML=H.icon,We.title=H.title,We.addEventListener("click",function(){Q.panelButtonClick(H)}),Q.panelButtons.push(We),Q.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var p=this,F=-1;if(s!==this.activePanel){F=this.panels.indexOf(s),this.panelRow.innerHTML="";var Q=s.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){p.displayMode==="inline"?p.panelRow.style.display="none":p.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ge){var We,et;H.className=p.toolboxButtonStyleClass.name+" "+(ge===F?""+((We=p.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:p.toolboxActiveButtonStyleColorsClass.name):""+((et=p.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&et!==void 0?et:p.toolboxButtonStyleColorsClass.name))})},z}(),He=function(z,s){this.title=z,this.icon=s},Fe=function(z){function s(p,F,Q,H){var ge=z.call(this,p,H||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ge.colors=[],ge.addTransparent=!1,ge.colorBoxes=[],ge.colors=F,ge.currentColor=Q,ge.setCurrentColor=ge.setCurrentColor.bind(ge),ge.getColorBox=ge.getColorBox.bind(ge),ge}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var H=p.getColorBox(Q);F.appendChild(H),p.colorBoxes.push(H)}),F},s.prototype.getColorBox=function(p){var F=this,Q=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-Q,ge=document.createElement("div");ge.style.display="inline-block",ge.style.boxSizing="content-box",ge.style.width=H-2+"px",ge.style.height=H-2+"px",ge.style.padding="1px",ge.style.marginRight="2px",ge.style.marginBottom="2px",ge.style.borderWidth="2px",ge.style.borderStyle="solid",ge.style.borderRadius=(H+2)/2+"px",ge.style.borderColor=p===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ge.addEventListener("click",function(){F.setCurrentColor(p,ge)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=H-2+"px",We.style.height=H-2+"px",We.style.backgroundColor=p,We.style.borderRadius=H/2+"px",p==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.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>`),ge.appendChild(We),ge},s.prototype.setCurrentColor=function(p,F){var Q=this;this.currentColor=p,this.colorBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(p)},s}(He),Me=function(){function z(s,p,F){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=p,this.globalSettings=F,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,p){},z.prototype.dblClick=function(s,p){},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,p){},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}(),Oe=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}(),Ye=function(){function z(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.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}(),Ze=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,p){return s.a=p.a,s.b=p.b,s.c=p.c,s.d=p.d,s.e=p.e,s.f=p.f,s},z}(),Ve=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(se.createTransform()),H.setupControlBox(),H}return we(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(p){this._visual=p;var F=se.createTransform();this._visual.transform.baseVal.appendItem(F)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(p){return!!z.prototype.ownsTarget.call(this,p)||!!(this.controlGrips.findGripByVisual(p)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(p))},s.prototype.pointerDown=function(p,F){z.prototype.pointerDown.call(this,p,F),this.state==="new"&&(this.left=p.x,this.top=p.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(p);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(F),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ge=this.container.transform.baseVal.getItem(0);ge.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ge,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(p){var F=this.state;z.prototype.pointerUp.call(this,p),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(p),this._state="select",F==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(p){this.visual.style.transform="translate("+p.x+"px, "+p.y+"px)"},s.prototype.manipulate=function(p){var F=this.unrotatePoint(p);this.state==="creating"?this.resize(p):this.state==="move"?(this.left=this.manipulationStartLeft+(F.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(F.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(F):this.state==="rotate"&&this.rotate(p)},s.prototype.resize=function(p){var F=this.manipulationStartLeft,Q=this.manipulationStartWidth,H=this.manipulationStartTop,ge=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:F=this.manipulationStartLeft+p.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-F;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+p.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+p.y-this.manipulationStartY,ge=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ge=this.manipulationStartHeight+p.y-this.manipulationStartY}Q>=0?(this.left=F,this.width=Q):(this.left=F+Q,this.width=-Q),ge>=0?(this.top=H,this.height=ge):(this.top=H+ge,this.height=-ge),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(p){if(Math.abs(p.x-this.centerX)>.1){var F=Math.sign(p.x-this.centerX);this.rotationAngle=180*Math.atan((p.y-this.centerY)/(p.x-this.centerX))/Math.PI+90*F,this.applyRotation()}},s.prototype.applyRotation=function(){var p=this.container.transform.baseVal.getItem(0);p.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(p,0)},s.prototype.rotatePoint=function(p){if(this.rotationAngle===0)return p;var F=this.container.getCTM(),Q=se.createPoint(p.x,p.y);return{x:(Q=Q.matrixTransform(F)).x,y:Q.y}},s.prototype.unrotatePoint=function(p){if(this.rotationAngle===0)return p;var F=this.container.getCTM();F=F.inverse();var Q=se.createPoint(p.x,p.y);return{x:(Q=Q.matrixTransform(F)).x,y:Q.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=se.createGroup();var p=se.createTransform();p.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(p),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.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 Oe,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var p=this.controlBox.transform.baseVal.getItem(0);p.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(p,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 p=new Ye;return p.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(p.visual),p},s.prototype.positionGrips=function(){var p=this.controlGrips.topLeft.GRIP_SIZE,F=-p/2,Q=F,H=(this.width+this.CB_DISTANCE)/2-p/2,ge=(this.height+this.CB_DISTANCE)/2-p/2,We=this.height+this.CB_DISTANCE-p/2,et=this.width+this.CB_DISTANCE-p/2;this.positionGrip(this.controlGrips.topLeft.visual,F,Q),this.positionGrip(this.controlGrips.topCenter.visual,H,Q),this.positionGrip(this.controlGrips.topRight.visual,et,Q),this.positionGrip(this.controlGrips.centerLeft.visual,F,ge),this.positionGrip(this.controlGrips.centerRight.visual,et,ge),this.positionGrip(this.controlGrips.bottomLeft.visual,F,We),this.positionGrip(this.controlGrips.bottomCenter.visual,H,We),this.positionGrip(this.controlGrips.bottomRight.visual,et,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,Q-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(p,F,Q){var H=p.transform.baseVal.getItem(0);H.setTranslate(F,Q),p.transform.baseVal.replaceItem(H,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ze.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ze.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(p){z.prototype.restoreState.call(this,p);var F=p;this.left=F.left,this.top=F.top,this.width=F.width,this.height=F.height,this.rotationAngle=F.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,F.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ze.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,F.containerTransformMatrix))},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F);var Q=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:Q.x*p,y:Q.y*F});this.left=H.x,this.top=H.y,this.width=this.width*p,this.height=this.height*F,this.adjustControlBox()},s}(Me),je=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.visual)},s.prototype.createVisual=function(){this.visual=se.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(p,F){z.prototype.pointerDown.call(this,p,F),this.state==="new"&&(this.createVisual(),this.moveVisual(p),this._state="creating")},s.prototype.manipulate=function(p){z.prototype.manipulate.call(this,p)},s.prototype.resize=function(p){z.prototype.resize.call(this,p),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(p){z.prototype.pointerUp.call(this,p),this.setSize()},s.prototype.setStrokeColor=function(p){this.strokeColor=p,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(p),this.stateChanged()},s.prototype.setFillColor=function(p){this.fillColor=p,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(p){this.strokeWidth=p,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(p){this.strokeDasharray=p,this.visual&&se.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(p){var F=p;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),z.prototype.restoreState.call(this,p),this.setSize()},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),this.setSize()},s.title="Rectangle marker",s}(Ve),rt=function(z){function s(p,F,Q,H){var ge=z.call(this,p,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ge.widths=[],ge.widthBoxes=[],ge.widths=F,ge.currentWidth=Q,ge.setCurrentWidth=ge.setCurrentWidth.bind(ge),ge}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.widths.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=Q===p.currentWidth?p.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){p.setCurrentWidth(Q,H)}),F.appendChild(H);var ge=document.createElement("div");ge.innerText=Q.toString(),ge.style.marginRight="5px",H.appendChild(ge);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var et=document.createElement("hr");et.style.minWidth="20px",et.style.border="0px",et.style.borderTop=Q+"px solid "+p.uiStyleSettings.toolboxColor,et.style.flexGrow="2",We.appendChild(et),H.appendChild(We),p.widthBoxes.push(H)}),F},s.prototype.setCurrentWidth=function(p,F){var Q=this;this.currentWidth=p,this.widthBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(He),Je=function(z){function s(p,F,Q,H){var ge=z.call(this,p,H||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ge.styles=[],ge.styleBoxes=[],ge.styles=F,ge.currentStyle=Q,ge.setCurrentStyle=ge.setCurrentStyle.bind(ge),ge}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.styles.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/p.styles.length-5+"%",H.style.borderColor=Q===p.currentStyle?p.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){p.setCurrentStyle(Q,H)}),F.appendChild(H);var ge=document.createElement("div");ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.overflow="hidden";var We=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+p.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;ge.innerHTML=We,H.appendChild(ge),p.styleBoxes.push(H)}),F},s.prototype.setCurrentStyle=function(p,F){var Q=this;this.currentStyle=p,this.styleBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(He),tt=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new rt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Je("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return we(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 p=z.prototype.getState.call(this);return p.typeName=s.typeName,p},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(je),Pe=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},lt=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return we(s,z),s.prototype.ownsTarget=function(p){return!!z.prototype.ownsTarget.call(this,p)||!(!this.grip1.ownsTarget(p)&&!this.grip2.ownsTarget(p))},s.prototype.pointerDown=function(p,F){z.prototype.pointerDown.call(this,p,F),this.manipulationStartX=p.x,this.manipulationStartY=p.y,this.state==="new"&&(this.x1=p.x,this.y1=p.y,this.x2=p.x,this.y2=p.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(F)?this.activeGrip=this.grip1:this.grip2.ownsTarget(F)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(p){var F=this.state;z.prototype.pointerUp.call(this,p),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(p),this._state="select",F==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(p){this.state==="creating"?this.resize(p):this.state==="move"?(this.x1=this.manipulationStartX1+p.x-this.manipulationStartX,this.y1=this.manipulationStartY1+p.y-this.manipulationStartY,this.x2=this.manipulationStartX2+p.x-this.manipulationStartX,this.y2=this.manipulationStartY2+p.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(p)},s.prototype.resize=function(p){switch(this.activeGrip){case this.grip1:this.x1=p.x,this.y1=p.y;break;case this.grip2:case void 0:this.x2=p.x,this.y2=p.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=se.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 p=new Ye;return p.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(p.visual),p},s.prototype.positionGrips=function(){var p=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-p/2,this.y1-p/2),this.positionGrip(this.grip2.visual,this.x2-p/2,this.y2-p/2)},s.prototype.positionGrip=function(p,F,Q){var H=p.transform.baseVal.getItem(0);H.setTranslate(F,Q),p.transform.baseVal.replaceItem(H,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(p){z.prototype.restoreState.call(this,p);var F=p;this.x1=F.x1,this.y1=F.y1,this.x2=F.x2,this.y2=F.y2},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),this.x1=this.x1*p,this.y1=this.y1*F,this.x2=this.x2*p,this.y2=this.y2*F,this.adjustVisual(),this.adjustControlBox()},s}(Me),at=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new rt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Je("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.visual&&p!==this.selectorLine&&p!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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(p,F){z.prototype.pointerDown.call(this,p,F),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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(p){this.strokeColor=p,this.adjustVisual(),this.colorChanged(p)},s.prototype.setStrokeWidth=function(p){this.strokeWidth=p,this.adjustVisual()},s.prototype.setStrokeDasharray=function(p){this.strokeDasharray=p,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 p=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){z.prototype.restoreState.call(this,p);var F=p;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.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}(lt),Be=function(z){function s(p,F,Q,H){var ge=z.call(this,p,H||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ge.fonts=[],ge.fontBoxes=[],ge.fonts=F,ge.currentFont=Q,ge.setCurrentFont=ge.setCurrentFont.bind(ge),ge}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.flexGrow="2",this.fonts.forEach(function(Q){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/p.fonts.length-5+"%",H.style.borderColor=Q===p.currentFont?p.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){p.setCurrentFont(Q,H)}),F.appendChild(H);var ge=document.createElement("div");ge.style.display="flex",ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.fontFamily=Q,ge.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",ge.appendChild(We),H.appendChild(ge),p.fontBoxes.push(H)}),F},s.prototype.setCurrentFont=function(p,F){var Q=this;this.currentFont=p,this.fontBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(He),Xe=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=Q.defaultColor,H.fontFamily=Q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new Fe("Color",Q.defaultColorSet,Q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Be("Font",Q.defaultFontFamilies,Q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return we(s,z),s.prototype.ownsTarget=function(p){if(z.prototype.ownsTarget.call(this,p)||p===this.visual||p===this.textElement||p===this.bgRectangle)return!0;var F=!1;return this.textElement.childNodes.forEach(function(Q){Q===p&&(F=!0)}),F},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(p,F){z.prototype.pointerDown.call(this,p,F),this.isMoved=!1,this.pointerDownPoint=p,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(p),this._state="creating")},s.prototype.renderText=function(){var p=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(F){p.textElement.appendChild(se.createTSpan(F.trim()===""?" ":F.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var p=this.textElement.getBBox(),F=1;if(p.width>0&&p.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/p.width,H=(1*this.height-this.height*this.padding*2/100)/p.height;F=Math.min(Q,H)}return F},s.prototype.getTextPosition=function(p){var F=this.textElement.getBBox(),Q=0,H=0;return F.width>0&&F.height>0&&(Q=(this.width-F.width*p)/2,H=this.height/2-F.height*p/2),{x:Q,y:H}},s.prototype.sizeText=function(){var p=this.textElement.getBBox(),F=this.getTextScale(),Q=this.getTextPosition(F);Q.y-=p.y*F,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+F+", "+F+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(F,F))},s.prototype.manipulate=function(p){z.prototype.manipulate.call(this,p),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(p.x-this.pointerDownPoint.x)>5||Math.abs(p.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(p){z.prototype.resize.call(this,p),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(p){var F=this.state;F==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,p),this.setSize(),(F==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var p=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(F){F.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var F=Number.parseFloat(p.textEditor.style.fontSize);p.textEditor.clientWidth>=Number.parseInt(p.textEditor.style.maxWidth)&&F>.9;)F-=.1,p.textEditor.style.fontSize=Math.max(F,.9)+"em"}),this.textEditor.addEventListener("keyup",function(F){F.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(F){if(F.clipboardData){var Q=F.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(Q)),F.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){p.textEditDivClicked(p.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 p=this.getTextScale(),F=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),H={x:Q.width*p,y:Q.height*p};F.x-=H.x/2,F.y-=H.y/2,this.textEditor.style.top=F.y+"px",this.textEditor.style.left=F.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-F.x+"px",this.textEditor.style.fontSize=Math.max(16*p,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(p){this.text=p.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(p,F){z.prototype.dblClick.call(this,p,F),this.showTextEditor()},s.prototype.setColor=function(p){this.textElement&&se.setAttributes(this.textElement,[["fill",p]]),this.color=p,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(p)},s.prototype.setFont=function(p){this.textElement&&se.setAttributes(this.textElement,[["font-family",p]]),this.fontFamily=p,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 p=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){var F=p;this.color=F.color,this.fontFamily=F.fontFamily,this.padding=F.padding,this.text=F.text,this.createVisual(),z.prototype.restoreState.call(this,p),this.setSize()},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),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}(Ve),Ce=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=Q.defaultColor,H.lineWidth=Q.defaultStrokeWidth,H.pixelRatio=Q.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new Fe("Color",Q.defaultColorSet,Q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new rt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.visual&&p!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var p=se.createTransform();this.visual.transform.baseVal.appendItem(p),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(p,F){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(p.x,p.y),this.drawing=!0):z.prototype.pointerDown.call(this,p,F)},s.prototype.manipulate=function(p){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(p.x,p.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,p)},s.prototype.resize=function(p){z.prototype.resize.call(this,p),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(p){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,p)},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 p=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),F=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=F[0],H=F[1],ge=F[2],We=F[3],et=!1,ft=0;ft<this.canvasElement.height;ft++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)p.data[ft*this.canvasElement.width*4+4*Ge+3]>0&&(et=!0,ft<H&&(H=ft),Ge<Q&&(Q=Ge),ft>We&&(We=ft),Ge>ge&&(ge=Ge));if(et){this.left=Q/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ge-Q)/this.pixelRatio,this.height=(We-H)/this.pixelRatio;var yt=document.createElement("canvas");yt.width=ge-Q,yt.height=We-H,yt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,H,ge-Q,We-H),0,0),this.drawingImgUrl=yt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(p){this.color=p,this.colorChanged(p)},s.prototype.setLineWidth=function(p){this.lineWidth=p},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 p=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){this.createVisual(),z.prototype.restoreState.call(this,p),this.drawingImgUrl=p.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),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}(Ve),ve=function(z){function s(p,F,Q){var H=z.call(this,p,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=F,H.setCurrentType=H.setCurrentType.bind(H),H}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2";for(var Q=function(We){var et="both";switch(We){case 0:et="both";break;case 1:et="start";break;case 2:et="end";break;case 3:et="none"}var ft=document.createElement("div");if(ft.style.display="flex",ft.style.flexGrow="2",ft.style.alignItems="center",ft.style.justifyContent="space-between",ft.style.padding="5px",ft.style.borderWidth="2px",ft.style.borderStyle="solid",ft.style.borderColor=et===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",ft.addEventListener("click",function(){p.setCurrentType(et,ft)}),F.appendChild(ft),et==="both"||et==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",ft.appendChild(Ge)}var yt=document.createElement("div");yt.style.display="flex",yt.style.alignItems="center",yt.style.minHeight="20px",yt.style.flexGrow="2";var Nt=document.createElement("hr");if(Nt.style.minWidth="20px",Nt.style.border="0px",Nt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Nt.style.flexGrow="2",yt.appendChild(Nt),ft.appendChild(yt),et==="both"||et==="end"){var Kt=document.createElement("div");Kt.style.display="flex",Kt.style.alignItems="center",Kt.style.minHeight="20px",Kt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Kt.style.marginRight="5px",ft.appendChild(Kt)}H.typeBoxes.push(ft)},H=this,ge=0;ge<4;ge++)Q(ge);return F},s.prototype.setCurrentType=function(p,F){var Q=this;this.currentType=p,this.typeBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(He),be=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ve("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.arrow1&&p!==this.arrow2)},s.prototype.getArrowPoints=function(p,F){var Q=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return p-Q/2+","+(F+H/2)+" "+p+","+(F-H/2)+" "+(p+Q/2)+","+(F+H/2)},s.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(p,F){z.prototype.pointerDown.call(this,p,F),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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var p=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.arrow1.transform.baseVal.getItem(0);F.setRotate(p,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(F,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(p+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},s.prototype.setArrowType=function(p){this.arrowType=p,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 p=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){z.prototype.restoreState.call(this,p);var F=p;this.arrowType=F.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(at),ie=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.fillColor=Q.defaultFillColor,H.strokeWidth=0,H.fillPanel=new Fe("Color",Q.defaultColorSet,Q.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return we(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var p=z.prototype.getState.call(this);return p.typeName=s.typeName,p},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(je),ae=function(z){function s(p,F,Q,H){var ge=z.call(this,p,H||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ge.opacities=[],ge.opacityBoxes=[],ge.opacities=F,ge.currentOpacity=Q,ge.setCurrentOpacity=ge.setCurrentOpacity.bind(ge),ge}return we(s,z),s.prototype.getUi=function(){var p=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",F.style.justifyContent="space-between",this.opacities.forEach(function(Q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=Q===p.currentOpacity?p.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){p.setCurrentOpacity(Q,H)}),F.appendChild(H);var ge=document.createElement("div");ge.innerText=100*Q+"%",H.appendChild(ge),p.opacityBoxes.push(H)}),F},s.prototype.setCurrentOpacity=function(p,F){var Q=this;this.currentOpacity=p,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===F?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(He),de=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=Q.defaultHighlightColor,H.strokeWidth=0,H.opacity=Q.defaultHighlightOpacity,H.fillPanel=new Fe("Color",Q.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ae("Opacity",Q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return we(s,z),s.prototype.setOpacity=function(p){this.opacity=p,this.visual&&se.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 p=z.prototype.getState.call(this);return p.typeName=s.typeName,p},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}(ie),me='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Se=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=Q.defaultStrokeColor,H.bgColor=Q.defaultFillColor,H.fontFamily=Q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new Fe("Text color",Q.defaultColorSet,H.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new Fe("Fill color",Q.defaultColorSet,H.bgColor,me),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Be("Font",Q.defaultFontFamilies,Q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new Ye,H.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return we(s,z),s.prototype.ownsTarget=function(p){return z.prototype.ownsTarget.call(this,p)||this.tipGrip.ownsTarget(p)||this.tip===p},s.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(p,F){this.state==="new"&&z.prototype.pointerDown.call(this,p,F),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(F)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,p,F)},s.prototype.pointerUp=function(p){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,p);else{var F=this.state==="creating";z.prototype.pointerUp.call(this,p),this.setTipPoints(F),this.positionTip()}},s.prototype.manipulate=function(p){if(this.tipMoving){var F=this.unrotatePoint(p);this.tipPosition={x:F.x-this.manipulationStartLeft,y:F.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,p)},s.prototype.setBgColor=function(p){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",p]]),se.setAttributes(this.tip,[["fill",p]])),this.bgColor=p,this.fillColorChanged(p)},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(p){p===void 0&&(p=!1);var F=Math.min(this.height/2,15),Q=this.height/5;p&&(this.tipPosition={x:F+Q/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:0},this.tipBase2Position={x:F+Q,y:0}):(this.tipBase1Position={x:0,y:F},this.tipBase2Position={x:0,y:F+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-Q,y:0},this.tipBase2Position={x:this.width-F,y:0}):(this.tipBase1Position={x:this.width,y:F},this.tipBase2Position={x:this.width,y:F+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-Q,y:this.height},this.tipBase2Position={x:this.width-F,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-F-Q},this.tipBase2Position={x:this.width,y:this.height-F}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:this.height},this.tipBase2Position={x:F+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-F},this.tipBase2Position={x:0,y:this.height-F-Q})},s.prototype.resize=function(p){z.prototype.resize.call(this,p),this.positionTip()},s.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var p=this.tipGrip.visual.transform.baseVal.getItem(0);p.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(p,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 p=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){var F=p;this.bgColor=F.bgColor,this.tipPosition=F.tipPosition,z.prototype.restoreState.call(this,p),this.createTip(),this.setTipPoints()},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),this.tipPosition={x:this.tipPosition.x*p,y:this.tipPosition.y*F},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}(Xe),Ie=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.fillColor=Q.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new Fe("Line color",fe(Q.defaultColorSet,["transparent"]),Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new Fe("Fill color",fe(Q.defaultColorSet,["transparent"]),H.fillColor,me),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new rt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Je("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ae("Opacity",Q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.visual)},s.prototype.createVisual=function(){this.visual=se.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(p,F){z.prototype.pointerDown.call(this,p,F),this.state==="new"&&(this.createVisual(),this.moveVisual(p),this._state="creating")},s.prototype.manipulate=function(p){z.prototype.manipulate.call(this,p)},s.prototype.resize=function(p){z.prototype.resize.call(this,p),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),se.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(p){z.prototype.pointerUp.call(this,p),this.setSize()},s.prototype.setStrokeColor=function(p){this.strokeColor=p,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(p),this.stateChanged()},s.prototype.setFillColor=function(p){this.fillColor=p,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(p),this.stateChanged()},s.prototype.setStrokeWidth=function(p){this.strokeWidth=p,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(p){this.strokeDasharray=p,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(p){this.opacity=p,this.visual&&se.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 p=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){var F=p;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),z.prototype.restoreState.call(this,p),this.setSize()},s.prototype.scale=function(p,F){z.prototype.scale.call(this,p,F),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}(Ve),ze=function(z){function s(p,F,Q){return z.call(this,p,F,Q)||this}return we(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.tip1&&p!==this.tip2)},s.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(p,F){z.prototype.pointerDown.call(this,p,F),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.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 p=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.tip1.transform.baseVal.getItem(0);F.setRotate(p,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(F,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(p+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var p=z.prototype.getState.call(this);return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){z.prototype.restoreState.call(this,p),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(at),ot=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.strokePanel.colors=Q.defaultColorSet,H.fillColor="transparent",H}return we(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 p=z.prototype.getState.call(this);return p.typeName=s.typeName,p},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}(Ie),gt=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}(),pt=function(z){function s(p,F,Q){var H=z.call(this,p,F,Q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=Q.defaultColor,H.strokeWidth=Q.defaultStrokeWidth,H.strokeDasharray=Q.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new rt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Je("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return we(s,z),s.prototype.ownsTarget=function(p){return!(!z.prototype.ownsTarget.call(this,p)&&p!==this.visual&&p!==this.selectorCurve&&p!==this.visibleCurve&&!this.curveGrip.ownsTarget(p))},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=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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(p,F){z.prototype.pointerDown.call(this,p,F),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=p.x,this.curveY=p.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(F)&&(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()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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 p=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-p/2,this.curveY-p/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(p){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+p.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+p.y-this.manipulationStartY),z.prototype.manipulate.call(this,p)},s.prototype.resize=function(p){this.activeGrip===this.curveGrip&&(this.curveX=p.x,this.curveY=p.y),z.prototype.resize.call(this,p),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(p){this.strokeColor=p,this.adjustVisual(),this.colorChanged(p)},s.prototype.setStrokeWidth=function(p){this.strokeWidth=p,this.adjustVisual()},s.prototype.setStrokeDasharray=function(p){this.strokeDasharray=p,this.adjustVisual()},s.prototype.scale=function(p,F){this.curveX=this.curveX*p,this.curveY=this.curveY*F,z.prototype.scale.call(this,p,F)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var p=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return p.typeName=s.typeName,p},s.prototype.restoreState=function(p){z.prototype.restoreState.call(this,p);var F=p;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.curveX=F.curveX,this.curveY=F.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}(lt),wt=function(){function z(s,p){p===void 0&&(p=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=p}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Ct=function(z){function s(p,F,Q){var H=z.call(this,p,!1)||this;return H.dataUrl=F,H.state=Q,H}return we(s,z),s}(wt),dt=function(z){function s(p,F,Q){Q===void 0&&(Q=!1);var H=z.call(this,p,Q)||this;return H.marker=F,H}return we(s,z),s}(wt),Bt=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,p){this[s].push(p)},z.prototype.removeEventListener=function(s,p){var F=this[s].indexOf(p);F>-1&&this[s].splice(F,1)},z}(),Ot=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 Pe,this._isOpen=!1,this.undoRedoManager=new gt,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 Bt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new _e(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[tt,Ce,be,Xe,ot,Ie,de,Se,ze,ie,at,pt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[tt,Ce,be,Xe,Ie,de,Se]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[tt,Ce,be,Xe,de]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var p=this;this._availableMarkerTypes.splice(0),s.forEach(function(F){if(typeof F=="string"){var Q=p.ALL_MARKER_TYPES.find(function(H){return H.typeName===F});Q!==void 0&&p._availableMarkerTypes.push(Q)}else p._availableMarkerTypes.push(F)})},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(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(p){return p(new wt(s))})},z.prototype.render=function(){return Te(this,void 0,void 0,function(){var s;return ye(this,function(p){switch(p.label){case 0:return this.setCurrentMarker(),(s=new ue).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 p.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,p.sent()]}})})},z.prototype.close=function(s){var p=this;if(s===void 0&&(s=!1),this.isOpen){var F=!1;s||this.eventListeners.beforeclose.forEach(function(Q){var H=new wt(p,!0);Q(H),H.defaultPrevented&&(F=!0)}),F||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Q){return Q(new wt(p))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,p=[],F=0;F<arguments.length;F++)p[F]=arguments[F];(s=this._availableMarkerTypes).push.apply(s,p)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(p){s(p.dataUrl,p.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,p=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,F=p<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(p,F)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,p){this._isResizing=!0;var F=s/this.imageWidth,Q=p/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(p),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(F,Q),this._isResizing=!1},z.prototype.scaleMarkers=function(s,p){var F,Q=this;this._currentMarker&&this._currentMarker instanceof Xe?this._currentMarker.scale(s,p):(F=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==Q._currentMarker&&H.scale(s,p)}),F!==void 0&&this.setCurrentMarker(F)},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(),p=this.editorCanvas.getBoundingClientRect();this.left=s.left-p.left,this.top=s.top-p.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,p=[],F=0;F<arguments.length;F++)p[F]=arguments[F];this.defs=se.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,p)},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 ke(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ne(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},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,p){if(s==="marker"&&p!==void 0)this.createNewMarker(p);else if(s==="action")switch(p){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 p=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var H=new dt(s,s._currentMarker,!0);Q(H),H.defaultPrevented&&(p=!0)}),!p){var F=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Q){return Q(new dt(s,F))})}}},z.prototype.clear=function(){var s=this,p=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ge){var We=new dt(s,void 0,!0);ge(We),We.defaultPrevented&&(p=!0)}),!p)){this.setCurrentMarker();for(var F=function(ge){var We=Q.markers[ge];Q.setCurrentMarker(Q.markers[ge]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(et){return et(new dt(s,We))})},Q=this,H=this.markers.length-1;H>=0;H--)F(H);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 p=this.getState(),F=this.undoRedoManager.getLastUndoStep();if(!F||F.width===p.width&&F.height===p.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(p),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}else this.undoRedoManager.replaceLastUndoStep(p),this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,p=this.undoRedoManager.undo();p!==void 0&&(this.restoreState(p),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new wt(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,p=this.undoRedoManager.redo();p!==void 0&&(this.restoreState(p),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new wt(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 Te(this,void 0,void 0,function(){var s,p,F=this;return ye(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return s=Q.sent(),p=this.getState(),this.eventListeners.render.forEach(function(H){return H(new Ct(F,s,p))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var p={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(F){return p.markers.push(F.getState())}),p},z.prototype.restoreState=function(s){var p=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(F){var Q=p._availableMarkerTypes.find(function(ge){return ge.typeName===F.typeName});if(Q!==void 0){var H=p.addNewMarker(Q);H.restoreState(F),p.markers.push(H)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(F){return F(new wt(p))})},z.prototype.addNewMarker=function(s){var p=se.createGroup();return this.markerImage.appendChild(p),new s(p,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var p,F=this;(p=typeof s=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(p),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(p.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new dt(F,F._currentMarker))}))},z.prototype.markerCreated=function(s){var p=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(F){return F(new dt(p,p._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 p=this;this.eventListeners.markerchange.forEach(function(F){return F(new dt(p,s))})},z.prototype.setCurrentMarker=function(s){var p=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(F){return F(new dt(p,p._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(F){return F(new dt(p,p._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 p=this.markers.find(function(F){return F.ownsTarget(s.target)});p!==void 0?(this.setCurrentMarker(p),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 p=this.markers.find(function(F){return F.ownsTarget(s.target)});p!==void 0&&p!==this._currentMarker&&this.setCurrentMarker(p),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,p){var F=this.markerImage.getBoundingClientRect();return{x:(s-F.left)/this.zoomLevel,y:(p-F.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){te.addKey(s)},z.prototype.addEventListener=function(s,p){this.eventListeners.addEventListener(s,p)},z.prototype.removeEventListener=function(s,p){this.eventListeners.removeEventListener(s,p)},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(p){return p(new wt(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(p){return p(new wt(s))}))},z.instanceCounter=0,z}();/* **********************************
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 Zt=function(z,s){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,F){p.__proto__=F}||function(p,F){for(var Q in F)Object.prototype.hasOwnProperty.call(F,Q)&&(p[Q]=F[Q])})(z,s)};function Xt(z,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function p(){this.constructor=z}Zt(z,s),z.prototype=s===null?Object.create(s):(p.prototype=s.prototype,new p)}function kt(z,s,p,F){return new(p||(p=Promise))(function(Q,H){function ge(ft){try{et(F.next(ft))}catch(Ge){H(Ge)}}function We(ft){try{et(F.throw(ft))}catch(Ge){H(Ge)}}function et(ft){var Ge;ft.done?Q(ft.value):(Ge=ft.value,Ge instanceof p?Ge:new p(function(yt){yt(Ge)})).then(ge,We)}et((F=F.apply(z,s||[])).next())})}function Ir(z,s){var p,F,Q,H,ge={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return H={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function We(et){return function(ft){return function(Ge){if(p)throw new TypeError("Generator is already executing.");for(;ge;)try{if(p=1,F&&(Q=2&Ge[0]?F.return:Ge[0]?F.throw||((Q=F.return)&&Q.call(F),0):F.next)&&!(Q=Q.call(F,Ge[1])).done)return Q;switch(F=0,Q&&(Ge=[2&Ge[0],Q.value]),Ge[0]){case 0:case 1:Q=Ge;break;case 4:return ge.label++,{value:Ge[1],done:!1};case 5:ge.label++,F=Ge[1],Ge=[0];continue;case 7:Ge=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Q=ge.trys,(Q=Q.length>0&&Q[Q.length-1])||Ge[0]!==6&&Ge[0]!==2)){ge=0;continue}if(Ge[0]===3&&(!Q||Ge[1]>Q[0]&&Ge[1]<Q[3])){ge.label=Ge[1];break}if(Ge[0]===6&&ge.label<Q[1]){ge.label=Q[1],Q=Ge;break}if(Q&&ge.label<Q[2]){ge.label=Q[2],ge.ops.push(Ge);break}Q[2]&&ge.ops.pop(),ge.trys.pop();continue}Ge=s.call(z,ge)}catch(yt){Ge=[6,yt],F=0}finally{p=Q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([et,ft])}}}var Kr=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),Et=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,p){for(var F=0,Q=p;F<Q.length;F++){var H=Q[F],ge=H[0],We=H[1];s.setAttribute(ge,We)}},z.createRect=function(s,p,F){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",s.toString()),Q.setAttribute("height",p.toString()),F&&z.setAttributes(Q,F),Q},z.createLine=function(s,p,F,Q,H){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",s.toString()),ge.setAttribute("y1",p.toString()),ge.setAttribute("x2",F.toString()),ge.setAttribute("y2",Q.toString()),H&&z.setAttributes(ge,H),ge},z.createPolygon=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",s),p&&z.setAttributes(F,p),F},z.createCircle=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(s/2).toString()),F.setAttribute("cy",(s/2).toString()),F.setAttribute("r",s.toString()),p&&z.setAttributes(F,p),F},z.createEllipse=function(s,p,F){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(s/2).toString()),Q.setAttribute("cy",(p/2).toString()),Q.setAttribute("rx",(s/2).toString()),Q.setAttribute("ry",(p/2).toString()),F&&z.setAttributes(Q,F),Q},z.createGroup=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(p,s),p},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,p,F,Q,H,ge,We){var et=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(et,[["id",s],["orient",p],["markerWidth",F.toString()],["markerHeight",Q.toString()],["refX",H.toString()],["refY",ge.toString()]]),et.appendChild(We),et},z.createText=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","text");return p.setAttribute("x","0"),p.setAttribute("y","0"),s&&z.setAttributes(p,s),p},z.createTSpan=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=s,p&&z.setAttributes(F,p),F},z.createImage=function(s){var p=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(p,s),p},z.createPoint=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=s,F.y=p,F},z.createPath=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",s),p&&z.setAttributes(F,p),F},z.createElement=function(s,p){var F=document.createElementNS("http://www.w3.org/2000/svg",s);return p&&z.setAttributes(F,p),F},z.getHollowRectanglePath=function(s,p,F,Q,H,ge,We,et){return"M"+s+","+p+"V"+(p+Q)+"H"+(s+F)+"V"+p+"H"+H+"V"+ge+"H"+(H+We)+"V"+(ge+et)+"H"+H+"V"+p+"Z"},z}(),Nr=function(){function z(s){this._classNamePrefixBase="__cropro_",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:"#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(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 dr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new dr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new dr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new pr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new pr("_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}(),dr=function(z,s){this.selector=z,this.style=s},pr=function(z,s){this.localName=z,this.style=s},Fr=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},z.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},z.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(p){return s.appendChild(p.getUI())}),s},z}(),ci=function(){function z(){}return z.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},z}(),qr=function(z){function s(){var p=z!==null&&z.apply(this,arguments)||this;return p.buttons=[],p}return Xt(s,z),s.prototype.addButton=function(p){p.className=this.buttonClassName,p.colorsClassName=this.buttonColorsClassName,p.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(p)},s.prototype.getUI=function(){var p=z.prototype.getUI.call(this);return this.buttons.forEach(function(F){return p.appendChild(F.getUI())}),p},s}(ci),It=function(){function z(s,p){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=p,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var s=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),ct=function(z){function s(){var p=z!==null&&z.apply(this,arguments)||this;return p.elements=[],p}return Xt(s,z),s.prototype.addElement=function(p){this.elements.push(p)},s.prototype.getUI=function(){var p=z.prototype.getUI.call(this);return this.elements.forEach(function(F){return p.appendChild(F)}),p},s}(ci),Hr=function(){function z(s,p){this.horizontal=s,this.vertical=p}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(s){return s/this.ratio},z.prototype.getHorizontalLength=function(s){return s*this.ratio},z}(),ei=function(){function z(){}return z.getIcon=function(s,p){if(s>0&&p>0){var F=new Hr(s,p),Q=F.ratio>=1?20:F.getHorizontalLength(20),H=F.ratio<1?20:F.getVerticalLength(20),ge=document.createElementNS("http://www.w3.org/2000/svg","svg");ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),ge.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ge);var We=Et.createDefs();ge.appendChild(We);var et=Et.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(et);var ft=Et.createPath(Et.getHollowRectanglePath((24-Q)/2,(24-H)/2,Q,H,(24-Q)/2+2,(24-H)/2+2,Q-4,H-4));ge.appendChild(ft);var Ge=Et.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(Et.createTSpan(s+":"+p)),ge.appendChild(Ge);var yt=Ge.getBBox();Et.setAttributes(Ge,[["x",((24-yt.width)/2).toString()],["y",((24-yt.height)/2-yt.y).toString()]]);var Nt=Et.createPath(Et.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(yt.width))/2,(24-Math.ceil(yt.height))/2,Math.ceil(yt.width),Math.ceil(yt.height)));return et.appendChild(Nt),Et.setAttributes(ft,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ge),ge.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>'},z}(),mr=function(z){function s(p,F,Q){var H=z.call(this,p,F)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=Q,H}return Xt(s,z),s.prototype.setupDropdown=function(){var p=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(F){F.className=p.className,F.colorsClassName=p.colorsClassName,p.dropdownBlock.appendChild(F.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(It),Lt=function(){function z(s,p){this.GRIP_SIZE=10,this.color=s,this.fillColor=p,this.visual=Et.createGroup(),this.visual.appendChild(Et.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Et.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["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.prototype.setCenter=function(s,p){this.visual.childNodes.forEach(function(F){return Et.setAttributes(F,[["cx",s.toString()],["cy",p.toString()]])})},z}(),Br=function(){function z(s,p,F,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=p,this.margin=F,this.container=Q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&Et.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var s=this;this.cropShadeElement=Et.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Et.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var p=0;p<this.numberOfGridLines;p++)this.horizontalGridLines.push(Et.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Et.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(F){return s.gridContainer.appendChild(F)}),this.verticalGridLines.forEach(function(F){return s.gridContainer.appendChild(F)}),this.cropRectElement=Et.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(s){this.cropRect=s;var p=Object.assign({},this.cropRect);this.zoomFactor!==1&&(p.width=this.cropRect.width*this.zoomFactor,p.height=this.cropRect.height*this.zoomFactor,p.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-p.width/2,p.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-p.height/2),Et.setAttributes(this.cropRectElement,[["x",p.x.toString()],["y",p.y.toString()],["width",p.width.toString()],["height",p.height.toString()]]);var F=p.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ge){var We=p.y+F*(ge+1);Et.setAttributes(H,[["x1",""+p.x],["y1",""+We],["x2",""+(p.x+p.width)],["y2",""+We]])});var Q=p.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ge){var We=p.x+Q*(ge+1);Et.setAttributes(H,[["x1",""+We],["y1",""+p.y],["x2",""+We],["y2",""+(p.y+p.height)]])}),Et.setAttributes(this.cropShadeElement,[["d",Et.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,p.x,p.y,p.width,p.height)]]),this.topLeftGrip.setCenter(p.x,p.y),this.topRightGrip.setCenter(p.x+p.width,p.y),this.bottomLeftGrip.setCenter(p.x,p.y+p.height),this.bottomRightGrip.setCenter(p.x+p.width,p.y+p.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(s,p){var F=this.container.getBoundingClientRect();return{x:s-F.left+this.margin,y:p-F.top+this.margin}},z.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var p=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(p)}s.preventDefault()},z.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},z.prototype.move=function(s){var p=s.x-this.previousPoint.x,F=s.y-this.previousPoint.y;this.zoomFactor!==1&&(p=-p/this.zoomFactor,F=-F/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+p),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+F),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},z.prototype.resize=function(s){var p=Object.assign({},this.cropRect),F=s.x-this.previousPoint.x,Q=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:p.x+F<this.margin&&(F=this.margin-p.x),p.x+=F,p.width=this.cropRect.x+this.cropRect.width-p.x;break;case this.bottomRightGrip:case this.topRightGrip:p.width+F>this.canvasWidth*this.zoomFactor&&(F=this.canvasWidth*this.zoomFactor-p.width),p.width+=F}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(p.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(F),p.height=this.aspectRatio.getVerticalLength(p.width)):(p.y+=Q,p.height=this.cropRect.y+this.cropRect.height-p.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?p.height=this.aspectRatio.getVerticalLength(p.width):p.height+=Q}p.width<10&&(p.x=this.cropRect.x,p.width=10),p.height<10&&(p.y=this.cropRect.y,p.height=10),this.previousPoint=s,p.x>=this.margin&&p.y>=this.margin&&p.x-this.margin+p.width<=this.canvasWidth&&p.y-this.margin+p.height<=this.canvasHeight&&(this.cropRect=p,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,p=this.cropRect.y+this.cropRect.height/2,F=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);F/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=F:this.cropRect.height=Q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=s-this.cropRect.width/2,this.cropRect.y=p-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)}},z.prototype.getRescaledRect=function(s,p,F,Q,H,ge){var We=F/s,et=Q/p;return{x:(H.x-ge)*We+ge,y:(H.y-ge)*et+ge,width:H.width*We,height:H.height*et}},z.prototype.scaleCanvas=function(s,p){var F=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,p,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=p,this.onCropChange&&this.onCropChange(F),this.setCropRectangle(F)},z}(),Vr=function(){function z(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(z.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},z.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},z.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();Et.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},z.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var p="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,F=1;F<=this.width/5+10;F++){var Q=F%5==0?this.height/3:this.height/6;p+="h4v"+-Q+"h1v"+Q}p+="v1H0Z",this.scaleShape=Et.createPath(p);var H=Et.createTransform();this.scaleShape.transform.baseVal.appendItem(H),s.appendChild(this.scaleShape),this.angleLabelElement=Et.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Et.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ge=Et.createTSpan("");return ge.innerHTML="&deg;",this.angleLabelElement.appendChild(ge),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},z}(),fi=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(s,p,F,Q,H,ge,We){var et=this;return new Promise(function(ft){var Ge=document.createElement("canvas");Ge.width=s.width.baseVal.value-2*Q,Ge.height=s.height.baseVal.value-2*Q;var yt=1,Nt=1;et.naturalSize===!0?(yt=p.naturalWidth/(s.width.baseVal.value-2*Q)/ge,Nt=p.naturalHeight/(s.height.baseVal.value-2*Q)/We,Ge.width=p.naturalWidth/ge,Ge.height=p.naturalHeight/We):et.width!==void 0&&et.height!==void 0&&(yt=et.width/F.width,Nt=et.height/F.height,Ge.width*=yt,Ge.height*=Nt);var Kt=Ge.getContext("2d");Kt.translate(Ge.width/2,Ge.height/2),Kt.rotate(H*Math.PI/180),Kt.scale(ge,We),Kt.translate(-Ge.width/2,-Ge.height/2),Kt.drawImage(p,0,0,Ge.width,Ge.height);var kr=document.createElement("canvas");kr.width=F.width*yt,kr.height=F.height*Nt,kr.getContext("2d").putImageData(Kt.getImageData((F.x-Q)*yt,(F.y-Q)*Nt,F.width*yt,F.height*Nt),0,0),ft(kr.toDataURL(et.imageType,et.imageQuality))})},z}(),$e=function(){function z(s){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=z.instanceCounter++,this.styles=new Nr(this.instanceNo),this.target=s,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(p){return p()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},z.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},z.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},z.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},z.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,p=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,F=p+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(p,F)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",Et.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(s,p){this.imageWidth=Math.round(s),this.imageHeight=Math.round(p),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()},z.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var p=s.toDataURL();Et.setAttributes(this.editingTarget,[["href",p]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),p=this.editorCanvas.getBoundingClientRect();this.left=s.left-p.left-this.CANVAS_MARGIN,this.top=s.top-p.top-this.CANVAS_MARGIN},z.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=Et.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Et.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Et.createGroup(),this.editingTargetRotationScaleContainer=Et.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=Et.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var p=Et.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(p),this.editingTargetContainer=Et.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Et.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Br(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,p=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=s+"px "+p+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-p+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,p=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=p+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Fr,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 p=new qr;p.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(p);var F=[];this.aspectRatios.forEach(function(Nt){var Kt=new It(ei.getIcon(Nt.horizontal,Nt.vertical),Nt.horizontal===0&&Nt.vertical===0?"FREE":Nt.horizontal+":"+Nt.vertical);Kt.onClick=function(){return s.ratioButtonClicked(Nt)},F.push(Kt)}),this.aspectRatioButton=new mr(ei.getIcon(0,0),"Aspect ratio",F),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,p.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new It('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){s.isGridVisible=!s.isGridVisible,Q.isActive=s.isGridVisible},p.addButton(Q);var H=new It('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(H.isActive=this.zoomToCropEnabled,H.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,H.isActive=s.zoomToCropEnabled},p.addButton(H),!Kr.isLicensed){var ge=new ct;this.topToolbar.addElementBlock(ge);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var et=document.createElement("a");et.style.color="currentColor",et.href="https://markerjs.com/products/cropro",et.target="_blank",et.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',We.appendChild(et),ge.addElement(We)}var ft=new qr;ft.minWidth=3*this.toolbarHeight+"px",ft.contentAlign="end",this.topToolbar.addButtonBlock(ft);var Ge=new It('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,ft.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var yt=new It('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");yt.onClick=this.close,ft.addButton(yt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(yt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Fr,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 p=new qr;p.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(p);var F=new It('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");F.onClick=this.rotateLeftButtonClicked,p.addButton(F);var Q=new It('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Q.onClick=this.rotateRightButtonClicked,p.addButton(Q);var H=new ct;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new Vr("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(ft){s.rotateBy(ft),s.straightener.angle=s.rotationAngle},H.addElement(this.straightener.getUI());var ge=new qr;ge.minWidth=2*this.toolbarHeight+"px",ge.contentAlign="end",this.bottomToolbar.addButtonBlock(ge);var We=new It('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");We.onClick=this.flipHorizontallyButtonClicked,ge.addButton(We);var et=new It('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");et.onClick=this.flipVerticallyButtonClicked,ge.addButton(et)},z.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ei.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Hr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(s){if(s){var p=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(p),this.cropRectChanged(p),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(s,p){var F=this.cropImage.getBoundingClientRect();return{x:s-F.left,y:p-F.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},z.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},z.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},z.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var p=this.editingTargetRotationContainer.transform.baseVal.getItem(0);p.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(p,0);var F=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/F.width,this.imageHeight/F.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return kt(this,void 0,void 0,function(){var s,p;return Ir(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return s=F.sent(),p=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(s,p)}),this.close(!0),[2]}})})},z.prototype.render=function(){return kt(this,void 0,void 0,function(){var s;return Ir(this,function(p){switch(p.label){case 0:return(s=new fi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),Et.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return p.sent(),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,p.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new pr("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 pr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new pr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new pr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new dr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new dr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new pr("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 pr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new pr("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 pr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new pr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),St=re("8hTe"),pi=re.n(St),mi=/<pre[^>]*>/g;function gi(z){var s=document.createElement("div");return s.innerHTML=z,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var vi=Qe.a=function(z){var s=z.value,p=s===void 0?"":s,F=z.edit,Q=F===void 0?!1:F,H=z.className,ge=z.showTextOnly,We=z.showLines,et=z.replaces,ft=z.zoomImg,Ge=z.hasMask,yt=z.style,Nt=yt===void 0?{}:yt,Kt=z.stylesPrev,kr=Kt===void 0?{}:Kt,gr=String(p),vr=Object(D.useRef)(),Xr=Object(D.useRef)(),ki=Object(D.useState)(""),nr=Object(K.a)(ki,2),Ur=nr[0],oi=nr[1],si=Object(D.useState)("office"),Or=Object(K.a)(si,2),Oi=Or[0],yi=Or[1],Gi=function(){var Ft=new $e(Xr.current);Ft.displayMode="popup",Ft.addRenderEventListener(function(){var hr=Object(P.a)(N.a.mark(function Dt(qt){var Wt;return N.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return vr.current.style.display="none",ar.next=3,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt}});case 3:Wt=ar.sent,Wt!=null&&Wt.id&&et(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 5:case"end":return ar.stop()}},Dt)}));return function(Dt){return hr.apply(this,arguments)}}()),Ft.show()},Ki=function(){var Ft=new Ot(Xr.current);Ft.settings.displayMode="popup",Ft.addEventListener("render",function(){var hr=Object(P.a)(N.a.mark(function Dt(qt){var Wt;return N.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:if(vr.current.style.display="none",!Xr.current){ar.next=6;break}return ar.next=4,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt.dataUrl}});case 4:Wt=ar.sent,Wt!=null&&Wt.id&&et(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 6:case"end":return ar.stop()}},Dt)}));return function(Dt){return hr.apply(this,arguments)}}()),Ft.show(),window.markerArea=Ft},Yr=Object(D.useMemo)(function(){vr.current&&(vr.current.style.zIndex=-1);try{var Jt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ft=/\"\/api\/attachments\/|\"\/attachments\/download\//g,hr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;gr=gr.replace(Jt,"("+q.a.API_SERVER+"/api/attachments/").replace(Ft,'"'+q.a.API_SERVER+"/api/attachments/").replace(hr,'"'+q.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(ti){}var Dt=V(gr),qt=x();if(gr.match(/\[TOC\]/)&&(Dt=Dt.replace("<p>[TOC]</p>",L()),_()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ti,ar){var xr=qt[ar],Vi=xr.type,xi=xr.expression;return Object(oe.renderToString)(gi(xi)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),v(),ge){var Wt=document.createElement("div");return Wt.innerHTML=Dt,Wt.innerText}return setTimeout(function(){return hn()},500),Dt},[gr]),zr=Object(D.useRef)();g.WebkitLineClamp=We,We&&(Nt=Object(B.a)(Object(B.a)({},Nt),g));function bi(Jt){var Ft=Jt.target;if(Ft.tagName.toUpperCase()==="IMG"){if(ft){var hr=Ft.getAttribute("src");oi(hr),yi("image")}}else if(Ft.tagName.toUpperCase()==="A"){var Dt=Ft.getAttribute("href");if(Dt.indexOf("office")>-1)Jt.preventDefault(),oi(Dt),yi("office");else if(Dt.indexOf("application/pdf")>-1)Jt.preventDefault(),oi(Dt),yi("pdf");else if(Dt.indexOf("text/html")>-1)Jt.preventDefault(),oi(Dt),yi("html");else if(Dt.startsWith("#")){Jt.preventDefault();var qt=document.getElementById(Dt.replace("#",""));qt&&qt.scrollIntoView(!0)}}}var hn=function(){var Ft,hr=(Ft=zr.current)===null||Ft===void 0?void 0:Ft.querySelectorAll("video");hr==null||hr.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var qt=new X.a;qt.loadSource(Dt.src),qt.attachMedia(Dt)}}})};Object(D.useEffect)(function(){if(zr.current&&Yr&&(Yr.match(mi)&&window.PR.prettyPrint()),zr.current)return zr.current.addEventListener("click",bi),function(){zr.current.removeEventListener("click",bi),v(),_()}},[Yr,zr.current,bi]);var Ei=function(Ft){if(!Q)return;Ft.target.nodeName==="IMG"?(vr.current.style.zIndex=1,vr.current.style.display="flex",vr.current.style.width=Ft.target.clientWidth+"px",vr.current.style.height=Ft.target.clientHeight+"px",vr.current.style.top=Ft.target.offsetTop+"px",vr.current.style.left=Ft.target.offsetLeft+"px",Xr.current.src=Ft.target.getAttribute("src")):vr.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:zr,style:Object(B.a)({},Nt),className:"".concat(H||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:Ei,dangerouslySetInnerHTML:{__html:Yr}}),b.a.createElement("div",{ref:vr,className:pi.a.button},b.a.createElement($.a,null,b.a.createElement(Z.a,{onClick:function(){return Gi()}},"\u88C1\u526A"),b.a.createElement(Z.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(ce.a,{close:!0,data:Ur,type:Ur!=null&&Ur.length?Oi:"",style:Object(B.a)({},kr),onClose:function(){return oi("")}}))}},"9VGf":function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return R});var le=re("q1tI"),$=re.n(le);function R(Z,B){var P=Object(le.useRef)();Object(le.useEffect)(function(){P.current=Z}),Object(le.useEffect)(function(){function K(){P.current()}if(B!==null){var U=setInterval(K,B);return function(){return clearInterval(U)}}},[B])}},Bd2K:function(ht,Qe,re){(function(le){le(re("VrN/"),re("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(N,D,b){if(b!=le.Init&&b&&N.removeKeyMap("autoCloseTags"),!D)return;var A={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(A["'/'"]=function(k){return P(k)}),(typeof D!="object"||D.whenOpening!==!1)&&(A["'>'"]=function(k){return Z(k)}),N.addKeyMap(A)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["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 le.Pass;for(var D=N.listSelections(),b=[],A=N.getOption("autoCloseTags"),k=0;k<D.length;k++){if(!D[k].empty())return le.Pass;var T=D[k].head,C=N.getTokenAt(T),E=le.innerMode(N.getMode(),C.state),d=E.state,a=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(d),l=a&&a.name;if(!l)return le.Pass;var h=E.mode.configuration=="html",_=typeof A=="object"&&A.dontCloseTags||h&&$,g=typeof A=="object"&&A.indentTags||h&&R;C.end>T.ch&&(l=l.slice(0,l.length-C.end+T.ch));var m=l.toLowerCase();if(!l||C.type=="string"&&(C.end!=T.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&a.close||C.string.indexOf("/")==T.ch-C.start-1||_&&K(_,m)>-1||U(N,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(d)||[],l,T,!0))return le.Pass;var L=typeof A=="object"&&A.emptyTags;if(L&&K(L,l)>-1){b[k]={text:"/>",newPos:le.Pos(T.line,T.ch+2)};continue}var y=g&&K(g,m)>-1;b[k]={indent:y,text:">"+(y?`
`:"")+"</"+l+">",newPos:y?le.Pos(T.line+1,0):le.Pos(T.line,T.ch+1)}}for(var c=typeof A=="object"&&A.dontIndentOnAutoClose,k=D.length-1;k>=0;k--){var f=b[k];N.replaceRange(f.text,D[k].head,D[k].anchor,"+insert");var u=N.listSelections().slice(0);u[k]={head:f.newPos,anchor:f.newPos},N.setSelections(u),!c&&f.indent&&(N.indentLine(f.newPos.line,null,!0),N.indentLine(f.newPos.line+1,null,!0))}}function B(N,D){for(var b=N.listSelections(),A=[],k=D?"/":"</",T=N.getOption("autoCloseTags"),C=typeof T=="object"&&T.dontIndentOnSlash,E=0;E<b.length;E++){if(!b[E].empty())return le.Pass;var d=b[E].head,a=N.getTokenAt(d),l=le.innerMode(N.getMode(),a.state),h=l.state;if(D&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return le.Pass;var _,g=l.mode.name!="xml"&&N.getMode().name=="htmlmixed";if(g&&l.mode.name=="javascript")_=k+"script";else if(g&&l.mode.name=="css")_=k+"style";else{var m=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!m||m.length&&U(N,m,m[m.length-1],d))return le.Pass;_=k+m[m.length-1]}N.getLine(d.line).charAt(a.end)!=">"&&(_+=">"),A[E]=_}if(N.replaceSelections(A),b=N.listSelections(),!C)for(var E=0;E<b.length;E++)(E==b.length-1||b[E].head.line<b[E+1].head.line)&&N.indentLine(b[E].head.line)}function P(N){return N.getOption("disableInput")?le.Pass:B(N,!0)}le.commands.closeTag=function(N){return B(N)};function K(N,D){if(N.indexOf)return N.indexOf(D);for(var b=0,A=N.length;b<A;++b)if(N[b]==D)return b;return-1}function U(N,D,b,A,k){if(!le.scanForClosingTag)return!1;var T=Math.min(N.lastLine()+1,A.line+500),C=le.scanForClosingTag(N,A,null,T);if(!C||C.tag!=b)return!1;for(var E=k?1:0,d=D.length-1;d>=0&&D[d]==b;d--)++E;A=C.to;for(var d=1;d<E;d++){var a=le.scanForClosingTag(N,A,null,T);if(!a||a.tag!=b)return!1;A=a.to}return!0}})},BjJ7:function(ht,Qe,re){"use strict";re.d(Qe,"d",function(){return $}),re.d(Qe,"c",function(){return R}),re.d(Qe,"e",function(){return Z}),re.d(Qe,"b",function(){return B}),re.d(Qe,"a",function(){return K});var le=re("m3rI");function $(U){var N=!0;if(U.length>0){for(var D=0;D<U.length;D++)if(U[D].compile_success==0||!U[D].compile_success){N=!1;break}}else N=!1;return N}function R(U){for(var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],b=0;b<U.length;b++){var A=U[b],k=N?"".concat(N,"/").concat(A.name):"".concat(A.name);D.push({title:A.name,isLeaf:!(A.type==="tree"),key:k})}return D}function Z(U,N,D){for(var b=0;b<U.length;b++){var A=U[b];if(A.key===N){A.children=D;break}A.children&&Z(A.children,N,D)}return U}function B(U,N,D){var b;return function(){var A=this,k=arguments,T=function(){b=null,D||U.apply(A,k)},C=D&&!b;clearTimeout(b),b=setTimeout(T,N),C&&U.apply(A,k)}}var P=!0,K=le.a.API_SERVER},"C+DQ":function(ht,Qe,re){},DlQD:function(ht,Qe,re){(function(le,$){ht.exports=$()})(this,function(){"use strict";function le(Ce,ve){for(var be=0;be<ve.length;be++){var ie=ve[be];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(Ce,ie.key,ie)}}function $(Ce,ve,be){return ve&&le(Ce.prototype,ve),be&&le(Ce,be),Ce}function R(Ce,ve){if(!Ce)return;if(typeof Ce=="string")return Z(Ce,ve);var be=Object.prototype.toString.call(Ce).slice(8,-1);if(be==="Object"&&Ce.constructor&&(be=Ce.constructor.name),be==="Map"||be==="Set")return Array.from(Ce);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Z(Ce,ve)}function Z(Ce,ve){(ve==null||ve>Ce.length)&&(ve=Ce.length);for(var be=0,ie=new Array(ve);be<ve;be++)ie[be]=Ce[be];return ie}function B(Ce,ve){var be;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(be=R(Ce))||ve&&Ce&&typeof Ce.length=="number"){be&&(Ce=be);var ie=0;return function(){return ie>=Ce.length?{done:!0}:{done:!1,value:Ce[ie++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return be=Ce[Symbol.iterator](),be.next.bind(be)}function P(Ce,ve){return ve={exports:{}},Ce(ve,ve.exports),ve.exports}var K=P(function(Ce){function ve(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function be(ie){Ce.exports.defaults=ie}Ce.exports={defaults:ve(),getDefaults:ve,changeDefaults:be}}),U=K.defaults,N=K.getDefaults,D=K.changeDefaults,b=/[&<>"']/,A=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,C={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=function(ve){return C[ve]};function d(Ce,ve){if(ve){if(b.test(Ce))return Ce.replace(A,E)}else if(k.test(Ce))return Ce.replace(T,E);return Ce}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(Ce){return Ce.replace(a,function(ve,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var h=/(^|[^\[])\^/g;function _(Ce,ve){Ce=Ce.source||Ce,ve=ve||"";var be={replace:function(ae,de){return de=de.source||de,de=de.replace(h,"$1"),Ce=Ce.replace(ae,de),be},getRegex:function(){return new RegExp(Ce,ve)}};return be}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(Ce,ve,be){if(Ce){var ie;try{ie=decodeURIComponent(l(be)).replace(g,"").toLowerCase()}catch(ae){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}ve&&!m.test(be)&&(be=o(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ae){return null}return be}var y={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Ce,ve){y[" "+Ce]||(c.test(Ce)?y[" "+Ce]=Ce+"/":y[" "+Ce]=M(Ce,"/",!0)),Ce=y[" "+Ce];var be=Ce.indexOf(":")===-1;return ve.substring(0,2)==="//"?be?ve:Ce.replace(f,"$1")+ve:ve.charAt(0)==="/"?be?ve:Ce.replace(u,"$1")+ve:Ce+ve}var x={exec:function(){}};function v(Ce){for(var ve=1,be,ie;ve<arguments.length;ve++){be=arguments[ve];for(ie in be)Object.prototype.hasOwnProperty.call(be,ie)&&(Ce[ie]=be[ie])}return Ce}function S(Ce,ve){var be=Ce.replace(/\|/g,function(de,me,Se){for(var Ie=!1,ze=me;--ze>=0&&Se[ze]==="\\";)Ie=!Ie;return Ie?"|":" |"}),ie=be.split(/ \|/),ae=0;if(ie.length>ve)ie.splice(ve);else for(;ie.length<ve;)ie.push("");for(;ae<ie.length;ae++)ie[ae]=ie[ae].trim().replace(/\\\|/g,"|");return ie}function M(Ce,ve,be){var ie=Ce.length;if(ie===0)return"";for(var ae=0;ae<ie;){var de=Ce.charAt(ie-ae-1);if(de===ve&&!be)ae++;else if(de!==ve&&be)ae++;else break}return Ce.substr(0,ie-ae)}function j(Ce,ve){if(Ce.indexOf(ve[1])===-1)return-1;for(var be=Ce.length,ie=0,ae=0;ae<be;ae++)if(Ce[ae]==="\\")ae++;else if(Ce[ae]===ve[0])ie++;else if(Ce[ae]===ve[1]&&(ie--,ie<0))return ae;return-1}function G(Ce){Ce&&Ce.sanitize&&!Ce.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:d,unescape:l,edit:_,cleanUrl:L,resolveUrl:o,noopTest:x,merge:v,splitCells:S,rtrim:M,findClosingBracket:j,checkSanitizeDeprecation:G},O=K.defaults,I=V.rtrim,X=V.splitCells,q=V.escape,oe=V.findClosingBracket;function ce(Ce,ve,be){var ie=ve.href,ae=ve.title?q(ve.title):null,de=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:be,href:ie,title:ae,text:de}:{type:"image",raw:be,href:ie,title:ae,text:q(de)}}function Le(Ce,ve){var be=Ce.match(/^(\s+)(?:```)/);if(be===null)return ve;var ie=be[1];return ve.split(`
`).map(function(ae){var de=ae.match(/^\s+/);if(de===null)return ae;var me=de[0];return me.length>=ie.length?ae.slice(ie.length):ae}).join(`
`)}var Ee=function(){function Ce(be){this.options=be||O}var ve=Ce.prototype;return ve.space=function(ie){var ae=this.rules.block.newline.exec(ie);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
`}},ve.code=function(ie,ae){var de=this.rules.block.code.exec(ie);if(de){var me=ae[ae.length-1];if(me&&me.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var Se=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?Se:I(Se,`
`)}}},ve.fences=function(ie){var ae=this.rules.block.fences.exec(ie);if(ae){var de=ae[0],me=Le(de,ae[3]||"");return{type:"code",raw:de,lang:ae[2]?ae[2].trim():ae[2],text:me}}},ve.heading=function(ie){var ae=this.rules.block.heading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},ve.nptable=function(ie){var ae=this.rules.block.nptable.exec(ie);if(ae){var de={type:"table",header:X(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[],raw:ae[0]};if(de.header.length===de.align.length){var me=de.align.length,Se;for(Se=0;Se<me;Se++)/^ *-+: *$/.test(de.align[Se])?de.align[Se]="right":/^ *:-+: *$/.test(de.align[Se])?de.align[Se]="center":/^ *:-+ *$/.test(de.align[Se])?de.align[Se]="left":de.align[Se]=null;for(me=de.cells.length,Se=0;Se<me;Se++)de.cells[Se]=X(de.cells[Se],de.header.length);return de}}},ve.hr=function(ie){var ae=this.rules.block.hr.exec(ie);if(ae)return{type:"hr",raw:ae[0]}},ve.blockquote=function(ie){var ae=this.rules.block.blockquote.exec(ie);if(ae){var de=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:de}}},ve.list=function(ie){var ae=this.rules.block.list.exec(ie);if(ae){for(var de=ae[0],me=ae[2],Se=me.length>1,Ie=me[me.length-1]===")",ze={type:"list",raw:de,ordered:Se,start:Se?+me.slice(0,-1):"",loose:!1,items:[]},ot=ae[0].match(this.rules.block.item),gt=!1,pt,wt,Ct,dt,Bt,Ot,Zt,Xt=ot.length,kt=0;kt<Xt;kt++)pt=ot[kt],de=pt,wt=pt.length,pt=pt.replace(/^ *([*+-]|\d+[.)]) */,""),~pt.indexOf(`
`)&&(wt-=pt.length,pt=this.options.pedantic?pt.replace(/^ {1,4}/gm,""):pt.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),kt!==Xt-1&&(Ct=this.rules.block.bullet.exec(ot[kt+1])[0],(Se?Ct.length===1||!Ie&&Ct[Ct.length-1]===")":Ct.length>1||this.options.smartLists&&Ct!==me)&&(dt=ot.slice(kt+1).join(`
`),ze.raw=ze.raw.substring(0,ze.raw.length-dt.length),kt=Xt-1)),Bt=gt||/\n\n(?!\s*$)/.test(pt),kt!==Xt-1&&(gt=pt.charAt(pt.length-1)===`
`,Bt||(Bt=gt)),Bt&&(ze.loose=!0),Ot=/^\[[ xX]\] /.test(pt),Zt=void 0,Ot&&(Zt=pt[1]!==" ",pt=pt.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:de,task:Ot,checked:Zt,loose:Bt,text:pt});return ze}},ve.html=function(ie){var ae=this.rules.block.html.exec(ie);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):q(ae[0]):ae[0]}},ve.def=function(ie){var ae=this.rules.block.def.exec(ie);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var de=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ae[0],href:ae[2],title:ae[3]}}},ve.table=function(ie){var ae=this.rules.block.table.exec(ie);if(ae){var de={type:"table",header:X(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=ae[0];var me=de.align.length,Se;for(Se=0;Se<me;Se++)/^ *-+: *$/.test(de.align[Se])?de.align[Se]="right":/^ *:-+: *$/.test(de.align[Se])?de.align[Se]="center":/^ *:-+ *$/.test(de.align[Se])?de.align[Se]="left":de.align[Se]=null;for(me=de.cells.length,Se=0;Se<me;Se++)de.cells[Se]=X(de.cells[Se].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ve.lheading=function(ie){var ae=this.rules.block.lheading.exec(ie);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},ve.paragraph=function(ie){var ae=this.rules.block.paragraph.exec(ie);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
`?ae[1].slice(0,-1):ae[1]}},ve.text=function(ie,ae){var de=this.rules.block.text.exec(ie);if(de){var me=ae[ae.length-1];return me&&me.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ve.escape=function(ie){var ae=this.rules.inline.escape.exec(ie);if(ae)return{type:"escape",raw:ae[0],text:q(ae[1])}},ve.tag=function(ie,ae,de){var me=this.rules.inline.tag.exec(ie);if(me)return!ae&&/^<a /i.test(me[0])?ae=!0:ae&&/^<\/a>/i.test(me[0])&&(ae=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:ae,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):q(me[0]):me[0]}},ve.link=function(ie){var ae=this.rules.inline.link.exec(ie);if(ae){var de=oe(ae[2],"()");if(de>-1){var me=ae[0].indexOf("!")===0?5:4,Se=me+ae[1].length+de;ae[2]=ae[2].substring(0,de),ae[0]=ae[0].substring(0,Se).trim(),ae[3]=""}var Ie=ae[2],ze="";if(this.options.pedantic){var ot=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ie);ot?(Ie=ot[1],ze=ot[3]):ze=""}else ze=ae[3]?ae[3].slice(1,-1):"";Ie=Ie.trim().replace(/^<([\s\S]*)>$/,"$1");var gt=ce(ae,{href:Ie&&Ie.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},ae[0]);return gt}},ve.reflink=function(ie,ae){var de;if((de=this.rules.inline.reflink.exec(ie))||(de=this.rules.inline.nolink.exec(ie))){var me=(de[2]||de[1]).replace(/\s+/g," ");if(me=ae[me.toLowerCase()],!me||!me.href){var Se=de[0].charAt(0);return{type:"text",raw:Se,text:Se}}var Ie=ce(de,me,de[0]);return Ie}},ve.strong=function(ie,ae,de){de===void 0&&(de="");var me=this.rules.inline.strong.start.exec(ie);if(me&&(!me[1]||me[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ae=ae.slice(-1*ie.length);var Se=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Se.lastIndex=0;for(var Ie;(me=Se.exec(ae))!=null;)if(Ie=this.rules.inline.strong.middle.exec(ae.slice(0,me.index+3)),Ie)return{type:"strong",raw:ie.slice(0,Ie[0].length),text:ie.slice(2,Ie[0].length-2)}}},ve.em=function(ie,ae,de){de===void 0&&(de="");var me=this.rules.inline.em.start.exec(ie);if(me&&(!me[1]||me[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ae=ae.slice(-1*ie.length);var Se=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Se.lastIndex=0;for(var Ie;(me=Se.exec(ae))!=null;)if(Ie=this.rules.inline.em.middle.exec(ae.slice(0,me.index+2)),Ie)return{type:"em",raw:ie.slice(0,Ie[0].length),text:ie.slice(1,Ie[0].length-1)}}},ve.codespan=function(ie){var ae=this.rules.inline.code.exec(ie);if(ae){var de=ae[2].replace(/\n/g," "),me=/[^ ]/.test(de),Se=de.startsWith(" ")&&de.endsWith(" ");return me&&Se&&(de=de.substring(1,de.length-1)),de=q(de,!0),{type:"codespan",raw:ae[0],text:de}}},ve.br=function(ie){var ae=this.rules.inline.br.exec(ie);if(ae)return{type:"br",raw:ae[0]}},ve.del=function(ie){var ae=this.rules.inline.del.exec(ie);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},ve.autolink=function(ie,ae){var de=this.rules.inline.autolink.exec(ie);if(de){var me,Se;return de[2]==="@"?(me=q(this.options.mangle?ae(de[1]):de[1]),Se="mailto:"+me):(me=q(de[1]),Se=me),{type:"link",raw:de[0],text:me,href:Se,tokens:[{type:"text",raw:me,text:me}]}}},ve.url=function(ie,ae){var de;if(de=this.rules.inline.url.exec(ie)){var me,Se;if(de[2]==="@")me=q(this.options.mangle?ae(de[0]):de[0]),Se="mailto:"+me;else{var Ie;do Ie=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Ie!==de[0]);me=q(de[0]),de[1]==="www."?Se="http://"+me:Se=me}return{type:"link",raw:de[0],text:me,href:Se,tokens:[{type:"text",raw:me,text:me}]}}},ve.inlineText=function(ie,ae,de){var me=this.rules.inline.text.exec(ie);if(me){var Se;return ae?Se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):q(me[0]):me[0]:Se=q(this.options.smartypants?de(me[0]):me[0]),{type:"text",raw:me[0],text:Se}}},Ce}(),we=V.noopTest,Te=V.edit,ye=V.merge,fe={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:we,table:we,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Te(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Te(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Te(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=/<!--(?!-?>)[\s\S]*?-->/,fe.html=Te(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Te(fe._paragraph).replace("hr",fe.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",fe._tag).getRegex(),fe.blockquote=Te(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=ye({},fe),fe.gfm=ye({},fe.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*|$)"}),fe.gfm.nptable=Te(fe.gfm.nptable).replace("hr",fe.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",fe._tag).getRegex(),fe.gfm.table=Te(fe.gfm.table).replace("hr",fe.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",fe._tag).getRegex(),fe.pedantic=ye({},fe.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:we,paragraph:Te(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:we,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:we,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Te(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Te(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Te(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Te(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Te(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Te(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Te(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Te(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Te(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Te(se._blockSkip,"g").getRegex(),se.overlapSkip=Te(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=Te(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Te(se.tag).replace("comment",fe._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Te(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Te(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Te(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=ye({},se),se.pedantic=ye({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=ye({},se.normal,{escape:Te(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Te(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=ye({},se.gfm,{br:Te(se.br).replace("{2,}","*").getRegex(),text:Te(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:fe,inline:se},ue=K.defaults,ne=te.block,_e=te.inline;function Re(Ce){return Ce.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function xe(Ce){var ve="",be,ie,ae=Ce.length;for(be=0;be<ae;be++)ie=Ce.charCodeAt(be),Math.random()>.5&&(ie="x"+ie.toString(16)),ve+="&#"+ie+";";return ve}var ke=function(){function Ce(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||ue,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:ne.normal,inline:_e.normal};this.options.pedantic?(ie.block=ne.pedantic,ie.inline=_e.pedantic):this.options.gfm&&(ie.block=ne.gfm,this.options.breaks?ie.inline=_e.breaks:ie.inline=_e.gfm),this.tokenizer.rules=ie}Ce.lex=function(ie,ae){var de=new Ce(ae);return de.lex(ie)};var ve=Ce.prototype;return ve.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(ie,ae,de){ae===void 0&&(ae=[]),de===void 0&&(de=!0),ie=ie.replace(/^ +$/gm,"");for(var me,Se,Ie,ze;ie;){if(me=this.tokenizer.space(ie)){ie=ie.substring(me.raw.length),me.type&&ae.push(me);continue}if(me=this.tokenizer.code(ie,ae)){ie=ie.substring(me.raw.length),me.type?ae.push(me):(ze=ae[ae.length-1],ze.raw+=`
`+me.raw,ze.text+=`
`+me.text);continue}if(me=this.tokenizer.fences(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.heading(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.nptable(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.hr(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.blockquote(ie)){ie=ie.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],de),ae.push(me);continue}if(me=this.tokenizer.list(ie)){for(ie=ie.substring(me.raw.length),Ie=me.items.length,Se=0;Se<Ie;Se++)me.items[Se].tokens=this.blockTokens(me.items[Se].text,[],!1);ae.push(me);continue}if(me=this.tokenizer.html(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(de&&(me=this.tokenizer.def(ie))){ie=ie.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.lheading(ie)){ie=ie.substring(me.raw.length),ae.push(me);continue}if(de&&(me=this.tokenizer.paragraph(ie))){ie=ie.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.text(ie,ae)){ie=ie.substring(me.raw.length),me.type?ae.push(me):(ze=ae[ae.length-1],ze.raw+=`
`+me.raw,ze.text+=`
`+me.text);continue}if(ie){var ot="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return ae},ve.inline=function(ie){var ae,de,me,Se,Ie,ze,ot=ie.length;for(ae=0;ae<ot;ae++){ze=ie[ae];switch(ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},Se=ze.header.length,de=0;de<Se;de++)ze.tokens.header[de]=[],this.inlineTokens(ze.header[de],ze.tokens.header[de]);for(Se=ze.cells.length,de=0;de<Se;de++)for(Ie=ze.cells[de],ze.tokens.cells[de]=[],me=0;me<Ie.length;me++)ze.tokens.cells[de][me]=[],this.inlineTokens(Ie[me],ze.tokens.cells[de][me]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Se=ze.items.length,de=0;de<Se;de++)this.inline(ze.items[de].tokens);break}}}return ie},ve.inlineTokens=function(ie,ae,de,me,Se){ae===void 0&&(ae=[]),de===void 0&&(de=!1),me===void 0&&(me=!1),Se===void 0&&(Se="");var Ie,ze=ie,ot;if(this.tokens.links){var gt=Object.keys(this.tokens.links);if(gt.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)gt.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,ot.index)+"["+"a".repeat(ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Ie=this.tokenizer.escape(ie)){ie=ie.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.tag(ie,de,me)){ie=ie.substring(Ie.raw.length),de=Ie.inLink,me=Ie.inRawBlock,ae.push(Ie);continue}if(Ie=this.tokenizer.link(ie)){ie=ie.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,me)),ae.push(Ie);continue}if(Ie=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,me)),ae.push(Ie);continue}if(Ie=this.tokenizer.strong(ie,ze,Se)){ie=ie.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],de,me),ae.push(Ie);continue}if(Ie=this.tokenizer.em(ie,ze,Se)){ie=ie.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],de,me),ae.push(Ie);continue}if(Ie=this.tokenizer.codespan(ie)){ie=ie.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.br(ie)){ie=ie.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.del(ie)){ie=ie.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],de,me),ae.push(Ie);continue}if(Ie=this.tokenizer.autolink(ie,xe)){ie=ie.substring(Ie.raw.length),ae.push(Ie);continue}if(!de&&(Ie=this.tokenizer.url(ie,xe))){ie=ie.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.inlineText(ie,me,Re)){ie=ie.substring(Ie.raw.length),Se=Ie.raw.slice(-1),ae.push(Ie);continue}if(ie){var pt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return ae},$(Ce,null,[{key:"rules",get:function(){return{block:ne,inline:_e}}}]),Ce}(),Ne=K.defaults,He=V.cleanUrl,Fe=V.escape,Me=function(){function Ce(be){this.options=be||Ne}var ve=Ce.prototype;return ve.code=function(ie,ae,de){var me=(ae||"").match(/\S*/)[0];if(this.options.highlight){var Se=this.options.highlight(ie,me);Se!=null&&Se!==ie&&(de=!0,ie=Se)}return me?'<pre><code class="'+this.options.langPrefix+Fe(me,!0)+'">'+(de?ie:Fe(ie,!0))+`</code></pre>
`:"<pre><code>"+(de?ie:Fe(ie,!0))+`</code></pre>
`},ve.blockquote=function(ie){return`<blockquote>
`+ie+`</blockquote>
`},ve.html=function(ie){return ie},ve.heading=function(ie,ae,de,me){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+me.slug(de)+'">'+ie+"</h"+ae+`>
`:"<h"+ae+">"+ie+"</h"+ae+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(ie,ae,de){var me=ae?"ol":"ul",Se=ae&&de!==1?' start="'+de+'"':"";return"<"+me+Se+`>
`+ie+"</"+me+`>
`},ve.listitem=function(ie){return"<li>"+ie+`</li>
`},ve.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(ie){return"<p>"+ie+`</p>
`},ve.table=function(ie,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
<thead>
`+ie+`</thead>
`+ae+`</table>
`},ve.tablerow=function(ie){return`<tr>
`+ie+`</tr>
`},ve.tablecell=function(ie,ae){var de=ae.header?"th":"td",me=ae.align?"<"+de+' align="'+ae.align+'">':"<"+de+">";return me+ie+"</"+de+`>
`},ve.strong=function(ie){return"<strong>"+ie+"</strong>"},ve.em=function(ie){return"<em>"+ie+"</em>"},ve.codespan=function(ie){return"<code>"+ie+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(ie){return"<del>"+ie+"</del>"},ve.link=function(ie,ae,de){if(ie=He(this.options.sanitize,this.options.baseUrl,ie),ie===null)return de;var me='<a href="'+Fe(ie)+'"';return ae&&(me+=' title="'+ae+'"'),me+=">"+de+"</a>",me},ve.image=function(ie,ae,de){if(ie=He(this.options.sanitize,this.options.baseUrl,ie),ie===null)return de;var me='<img src="'+ie+'" alt="'+de+'"';return ae&&(me+=' title="'+ae+'"'),me+=this.options.xhtml?"/>":">",me},ve.text=function(ie){return ie},Ce}(),Oe=function(){function Ce(){}var ve=Ce.prototype;return ve.strong=function(ie){return ie},ve.em=function(ie){return ie},ve.codespan=function(ie){return ie},ve.del=function(ie){return ie},ve.html=function(ie){return ie},ve.text=function(ie){return ie},ve.link=function(ie,ae,de){return""+de},ve.image=function(ie,ae,de){return""+de},ve.br=function(){return""},Ce}(),Ye=function(){function Ce(){this.seen={}}var ve=Ce.prototype;return ve.slug=function(ie){var ae=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var de=ae;do this.seen[de]++,ae=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},Ce}(),Ze=K.defaults,Ve=V.unescape,je=function(){function Ce(be){this.options=be||Ze,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new Ye}Ce.parse=function(ie,ae){var de=new Ce(ae);return de.parse(ie)};var ve=Ce.prototype;return ve.parse=function(ie,ae){ae===void 0&&(ae=!0);var de="",me,Se,Ie,ze,ot,gt,pt,wt,Ct,dt,Bt,Ot,Zt,Xt,kt,Ir,Kr,Et,Nr=ie.length;for(me=0;me<Nr;me++){dt=ie[me];switch(dt.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(dt.tokens),dt.depth,Ve(this.parseInline(dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(dt.text,dt.lang,dt.escaped);continue}case"table":{for(wt="",pt="",ze=dt.header.length,Se=0;Se<ze;Se++)pt+=this.renderer.tablecell(this.parseInline(dt.tokens.header[Se]),{header:!0,align:dt.align[Se]});for(wt+=this.renderer.tablerow(pt),Ct="",ze=dt.cells.length,Se=0;Se<ze;Se++){for(gt=dt.tokens.cells[Se],pt="",ot=gt.length,Ie=0;Ie<ot;Ie++)pt+=this.renderer.tablecell(this.parseInline(gt[Ie]),{header:!1,align:dt.align[Ie]});Ct+=this.renderer.tablerow(pt)}de+=this.renderer.table(wt,Ct);continue}case"blockquote":{Ct=this.parse(dt.tokens),de+=this.renderer.blockquote(Ct);continue}case"list":{for(Bt=dt.ordered,Ot=dt.start,Zt=dt.loose,ze=dt.items.length,Ct="",Se=0;Se<ze;Se++)kt=dt.items[Se],Ir=kt.checked,Kr=kt.task,Xt="",kt.task&&(Et=this.renderer.checkbox(Ir),Zt?kt.tokens.length>0&&kt.tokens[0].type==="text"?(kt.tokens[0].text=Et+" "+kt.tokens[0].text,kt.tokens[0].tokens&&kt.tokens[0].tokens.length>0&&kt.tokens[0].tokens[0].type==="text"&&(kt.tokens[0].tokens[0].text=Et+" "+kt.tokens[0].tokens[0].text)):kt.tokens.unshift({type:"text",text:Et}):Xt+=Et),Xt+=this.parse(kt.tokens,Zt),Ct+=this.renderer.listitem(Xt,Kr,Ir);de+=this.renderer.list(Ct,Bt,Ot);continue}case"html":{de+=this.renderer.html(dt.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(dt.tokens));continue}case"text":{for(Ct=dt.tokens?this.parseInline(dt.tokens):dt.text;me+1<Nr&&ie[me+1].type==="text";)dt=ie[++me],Ct+=`
`+(dt.tokens?this.parseInline(dt.tokens):dt.text);de+=ae?this.renderer.paragraph(Ct):Ct;continue}default:{var dr='Token with "'+dt.type+'" type was not found.';if(this.options.silent){console.error(dr);return}else throw new Error(dr)}}}return de},ve.parseInline=function(ie,ae){ae=ae||this.renderer;var de="",me,Se,Ie=ie.length;for(me=0;me<Ie;me++){Se=ie[me];switch(Se.type){case"escape":{de+=ae.text(Se.text);break}case"html":{de+=ae.html(Se.text);break}case"link":{de+=ae.link(Se.href,Se.title,this.parseInline(Se.tokens,ae));break}case"image":{de+=ae.image(Se.href,Se.title,Se.text);break}case"strong":{de+=ae.strong(this.parseInline(Se.tokens,ae));break}case"em":{de+=ae.em(this.parseInline(Se.tokens,ae));break}case"codespan":{de+=ae.codespan(Se.text);break}case"br":{de+=ae.br();break}case"del":{de+=ae.del(this.parseInline(Se.tokens,ae));break}case"text":{de+=ae.text(Se.text);break}default:{var ze='Token with "'+Se.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return de},Ce}(),rt=V.merge,Je=V.checkSanitizeDeprecation,tt=V.escape,Pe=K.getDefaults,lt=K.changeDefaults,at=K.defaults;function Be(Ce,ve,be){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof ve=="function"&&(be=ve,ve=null),ve=rt({},Be.defaults,ve||{}),Je(ve),be){var ie=ve.highlight,ae;try{ae=ke.lex(Ce,ve)}catch(Ie){return be(Ie)}var de=function(ze){var ot;if(!ze)try{ot=je.parse(ae,ve)}catch(gt){ze=gt}return ve.highlight=ie,ze?be(ze):be(null,ot)};if(!ie||ie.length<3)return de();if(delete ve.highlight,!ae.length)return de();var me=0;Be.walkTokens(ae,function(Ie){Ie.type==="code"&&(me++,setTimeout(function(){ie(Ie.text,Ie.lang,function(ze,ot){if(ze)return de(ze);ot!=null&&ot!==Ie.text&&(Ie.text=ot,Ie.escaped=!0),me--,me===0&&de()})},0))}),me===0&&de();return}try{var Se=ke.lex(Ce,ve);return ve.walkTokens&&Be.walkTokens(Se,ve.walkTokens),je.parse(Se,ve)}catch(Ie){if(Ie.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+tt(Ie.message+"",!0)+"</pre>";throw Ie}}Be.options=Be.setOptions=function(Ce){return rt(Be.defaults,Ce),lt(Be.defaults),Be},Be.getDefaults=Pe,Be.defaults=at,Be.use=function(Ce){var ve=rt({},Ce);if(Ce.renderer&&function(){var ie=Be.defaults.renderer||new Me,ae=function(Se){var Ie=ie[Se];ie[Se]=function(){for(var ze=arguments.length,ot=new Array(ze),gt=0;gt<ze;gt++)ot[gt]=arguments[gt];var pt=Ce.renderer[Se].apply(ie,ot);return pt===!1&&(pt=Ie.apply(ie,ot)),pt}};for(var de in Ce.renderer)ae(de);ve.renderer=ie}(),Ce.tokenizer&&function(){var ie=Be.defaults.tokenizer||new Ee,ae=function(Se){var Ie=ie[Se];ie[Se]=function(){for(var ze=arguments.length,ot=new Array(ze),gt=0;gt<ze;gt++)ot[gt]=arguments[gt];var pt=Ce.tokenizer[Se].apply(ie,ot);return pt===!1&&(pt=Ie.apply(ie,ot)),pt}};for(var de in Ce.tokenizer)ae(de);ve.tokenizer=ie}(),Ce.walkTokens){var be=Be.defaults.walkTokens;ve.walkTokens=function(ie){Ce.walkTokens(ie),be&&be(ie)}}Be.setOptions(ve)},Be.walkTokens=function(Ce,ve){for(var be=B(Ce),ie;!(ie=be()).done;){var ae=ie.value;ve(ae);switch(ae.type){case"table":{for(var de=B(ae.tokens.header),me;!(me=de()).done;){var Se=me.value;Be.walkTokens(Se,ve)}for(var Ie=B(ae.tokens.cells),ze;!(ze=Ie()).done;)for(var ot=ze.value,gt=B(ot),pt;!(pt=gt()).done;){var wt=pt.value;Be.walkTokens(wt,ve)}break}case"list":{Be.walkTokens(ae.items,ve);break}default:ae.tokens&&Be.walkTokens(ae.tokens,ve)}}},Be.Parser=je,Be.parser=je.parse,Be.Renderer=Me,Be.TextRenderer=Oe,Be.Lexer=ke,Be.lexer=ke.lex,Be.Tokenizer=Ee,Be.Slugger=Ye,Be.parse=Be;var Xe=Be;return Xe})},ELLl:function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=le.Pos;le.defineOption("autoCloseBrackets",!1,function(C,E,d){d&&d!=le.Init&&(C.removeKeyMap(B),C.state.closeBrackets=null),E&&(P(Z(E,"pairs")),C.state.closeBrackets=E,C.addKeyMap(B))});function Z(C,E){return E=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[E]!=null?C[E]:$[E]}var B={Backspace:N,Enter:D};function P(C){for(var E=0;E<C.length;E++){var d=C.charAt(E),a="'"+d+"'";B[a]||(B[a]=K(d))}}P($.pairs+"`");function K(C){return function(E){return A(E,C)}}function U(C){var E=C.state.closeBrackets;if(!E||E.override)return E;var d=C.getModeAt(C.getCursor());return d.closeBrackets||E}function N(C){var E=U(C);if(!E||C.getOption("disableInput"))return le.Pass;for(var d=Z(E,"pairs"),a=C.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return le.Pass;var h=k(C,a[l].head);if(!h||d.indexOf(h)%2!=0)return le.Pass}for(var l=a.length-1;l>=0;l--){var _=a[l].head;C.replaceRange("",R(_.line,_.ch-1),R(_.line,_.ch+1),"+delete")}}function D(C){var E=U(C),d=E&&Z(E,"explode");if(!d||C.getOption("disableInput"))return le.Pass;for(var a=C.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return le.Pass;var h=k(C,a[l].head);if(!h||d.indexOf(h)%2!=0)return le.Pass}C.operation(function(){var _=C.lineSeparator()||`
`;C.replaceSelection(_+_,null),C.execCommand("goCharLeft"),a=C.listSelections();for(var g=0;g<a.length;g++){var m=a[g].head.line;C.indentLine(m,null,!0),C.indentLine(m+1,null,!0)}})}function b(C){var E=le.cmpPos(C.anchor,C.head)>0;return{anchor:new R(C.anchor.line,C.anchor.ch+(E?-1:1)),head:new R(C.head.line,C.head.ch+(E?1:-1))}}function A(C,E){var d=U(C);if(!d||C.getOption("disableInput"))return le.Pass;var a=Z(d,"pairs"),l=a.indexOf(E);if(l==-1)return le.Pass;for(var h=Z(d,"closeBefore"),_=Z(d,"triples"),g=a.charAt(l+1)==E,m=C.listSelections(),L=l%2==0,y,c=0;c<m.length;c++){var f=m[c],u=f.head,o,x=C.getRange(u,R(u.line,u.ch+1));if(L&&!f.empty())o="surround";else if((g||!L)&&x==E)g&&T(C,u)?o="both":_.indexOf(E)>=0&&C.getRange(u,R(u.line,u.ch+3))==E+E+E?o="skipThree":o="skip";else if(g&&u.ch>1&&_.indexOf(E)>=0&&C.getRange(R(u.line,u.ch-2),u)==E+E){if(u.ch>2&&/\bstring/.test(C.getTokenTypeAt(R(u.line,u.ch-2))))return le.Pass;o="addFour"}else if(g){var v=u.ch==0?" ":C.getRange(R(u.line,u.ch-1),u);if(!le.isWordChar(x)&&v!=E&&!le.isWordChar(v))o="both";else return le.Pass}else if(L&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))o="both";else return le.Pass;if(!y)y=o;else if(y!=o)return le.Pass}var S=l%2?a.charAt(l-1):E,M=l%2?E:a.charAt(l+1);C.operation(function(){if(y=="skip")C.execCommand("goCharRight");else if(y=="skipThree")for(var j=0;j<3;j++)C.execCommand("goCharRight");else if(y=="surround"){for(var G=C.getSelections(),j=0;j<G.length;j++)G[j]=S+G[j]+M;C.replaceSelections(G,"around"),G=C.listSelections().slice();for(var j=0;j<G.length;j++)G[j]=b(G[j]);C.setSelections(G)}else y=="both"?(C.replaceSelection(S+M,null),C.triggerElectric(S+M),C.execCommand("goCharLeft")):y=="addFour"&&(C.replaceSelection(S+S+S+S,"before"),C.execCommand("goCharRight"))})}function k(C,E){var d=C.getRange(R(E.line,E.ch-1),R(E.line,E.ch+1));return d.length==2?d:null}function T(C,E){var d=C.getTokenAt(R(E.line,E.ch+1));return/\bstring/.test(d.type)&&d.start==E.ch&&(E.ch==0||!/\bstring/.test(C.getTokenTypeAt(E)))}})},Fhpe:function(ht,Qe,re){ht.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(ht,Qe,re){"use strict";var le=re("q1tI"),$=re.n(le),R=re("TSYQ"),Z=re.n(R);function B(V,O){var I="cannot "+V.method+" "+V.action+" "+O.status+"'",X=new Error(I);return X.status=O.status,X.method=V.method,X.url=V.action,X}function P(V){var O=V.responseText||V.response;if(!O)return O;try{return JSON.parse(O)}catch(I){return O}}function K(V){var O=new XMLHttpRequest;V.onProgress&&O.upload&&(O.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(q){var oe=V.data[q];if(Array.isArray(oe)){oe.forEach(function(ce){I.append(q+"[]",ce)});return}I.append(q,V.data[q])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),O.onerror=function(oe){V.onError(oe)},O.onload=function(){return O.status<200||O.status>=300?V.onError(B(V,O),P(O)):V.onSuccess(P(O),O)},O.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var X=V.headers||{};return X["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(q){X[q]!==null&&O.setRequestHeader(q,X[q])}),O.send(I),{abort:function(){O.abort()}}}var U=+new Date,N=0;function D(){return"rc-upload-"+U+"-"+ ++N}function b(V,O){return V.indexOf(O,V.length-O.length)!==-1}var A=function(V,O){if(V&&O){var I=Array.isArray(O)?O:O.split(","),X=V.name||"",q=V.type||"",oe=q.replace(/\/.*$/,"");return I.some(function(ce){var Le=ce.trim();return Le.charAt(0)==="."?b(X.toLowerCase(),Le.toLowerCase()):/\/\*$/.test(Le)?oe===Le.replace(/\/.*$/,""):q===Le})}return!0};function k(V,O){var I=V.createReader(),X=[];function q(){I.readEntries(function(oe){var ce=Array.prototype.slice.apply(oe);X=X.concat(ce);var Le=!ce.length;Le?O(X):q()})}q()}var T=function(O,I,X){var q=function oe(ce,Le){Le=Le||"",ce.isFile?ce.file(function(Ee){X(Ee)&&(ce.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=ce.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),I([Ee]))}):ce.isDirectory&&k(ce,function(Ee){Ee.forEach(function(we){oe(we,""+Le+ce.name+"/")})})};O.forEach(function(oe){q(oe.webkitGetAsEntry())})},C=T,E=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var I=arguments[O];for(var X in I)Object.prototype.hasOwnProperty.call(I,X)&&(V[X]=I[X])}return V},d=function(){function V(O,I){var X=[],q=!0,oe=!1,ce=void 0;try{for(var Le=O[Symbol.iterator](),Ee;!(q=(Ee=Le.next()).done)&&!(X.push(Ee.value),I&&X.length===I);q=!0);}catch(we){oe=!0,ce=we}finally{try{!q&&Le.return&&Le.return()}finally{if(oe)throw ce}}return X}return function(O,I){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return V(O,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function V(O,I){for(var X=0;X<I.length;X++){var q=I[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(O,q.key,q)}}return function(O,I,X){return I&&V(O.prototype,I),X&&V(O,X),O}}();function l(V,O,I){return O in V?Object.defineProperty(V,O,{value:I,enumerable:!0,configurable:!0,writable:!0}):V[O]=I,V}function h(V,O){var I={};for(var X in V){if(O.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;I[X]=V[X]}return I}function _(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function g(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function m(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}var L=function(O){return Object.keys(O).reduce(function(I,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(I[X]=O[X]),I},{})},y=function(V){m(O,V);function O(){var I,X,q,oe;_(this,O);for(var ce=arguments.length,Le=Array(ce),Ee=0;Ee<ce;Ee++)Le[Ee]=arguments[Ee];return oe=(X=(q=g(this,(I=O.__proto__||Object.getPrototypeOf(O)).call.apply(I,[this].concat(Le))),q),q.state={uid:D()},q.reqs={},q.onChange=function(we){var Te=we.target.files;q.uploadFiles(Te),q.reset()},q.onClick=function(we){var Te=q.fileInput;if(!Te)return;var ye=q.props,fe=ye.children,se=ye.onClick;fe&&fe.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),se&&se(we)},q.onKeyDown=function(we){we.key==="Enter"&&q.onClick()},q.onFileDrop=function(we){var Te=q.props.multiple;if(we.preventDefault(),we.type==="dragover")return;if(q.props.directory)C(Array.prototype.slice.call(we.dataTransfer.items),q.uploadFiles,function(fe){return A(fe,q.props.accept)});else{var ye=Array.prototype.slice.call(we.dataTransfer.files).filter(function(fe){return A(fe,q.props.accept)});Te===!1&&(ye=ye.slice(0,1)),q.uploadFiles(ye)}},q.uploadFiles=function(we){var Te=Array.prototype.slice.call(we);Te.map(function(ye){return ye.uid=D(),ye}).forEach(function(ye){q.upload(ye,Te)})},q.saveFileInput=function(we){q.fileInput=we},X),g(q,oe)}return a(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,q){var oe=this,ce=this.props;if(!ce.beforeUpload)return setTimeout(function(){return oe.post(X)},0);var Le=ce.beforeUpload(X,q);Le&&Le.then?Le.then(function(Ee){var we=Object.prototype.toString.call(Ee);return we==="[object File]"||we==="[object Blob]"?oe.post(Ee):oe.post(X)}).catch(function(Ee){console.log(Ee)}):Le!==!1&&setTimeout(function(){return oe.post(X)},0);return}},{key:"post",value:function(X){var q=this;if(!this._isMounted)return;var oe=this.props,ce=oe.onStart,Le=oe.onProgress,Ee=oe.transformFile,we=Ee===void 0?function(Te){return Te}:Ee;new Promise(function(Te){var ye=oe.action;return typeof ye=="function"&&(ye=ye(X)),Te(ye)}).then(function(Te){var ye=X.uid,fe=oe.customRequest||K,se=Promise.resolve(we(X)).then(function(te){var ue=oe.data;return typeof ue=="function"&&(ue=ue(te)),Promise.all([te,ue])}).catch(function(te){console.error(te)});se.then(function(te){var ue=d(te,2),ne=ue[0],_e=ue[1],Re={action:Te,filename:oe.name,data:_e,file:ne,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Le?function(xe){Le(xe,X)}:null,onSuccess:function(ke,Ne){delete q.reqs[ye],oe.onSuccess(ke,X,Ne)},onError:function(ke,Ne){delete q.reqs[ye],oe.onError(ke,Ne,X)}};ce(X),q.reqs[ye]=fe(Re)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(X){var q=this.reqs;if(X){var oe=X;X&&X.uid&&(oe=X.uid),q[oe]&&q[oe].abort&&q[oe].abort(),delete q[oe]}else Object.keys(q).forEach(function(ce){q[ce]&&q[ce].abort&&q[ce].abort(),delete q[ce]})}},{key:"render",value:function(){var X,q=this.props,oe=q.component,ce=q.prefixCls,Le=q.className,Ee=q.disabled,we=q.id,Te=q.style,ye=q.multiple,fe=q.accept,se=q.children,te=q.directory,ue=q.openFileDialogOnClick,ne=q.onMouseEnter,_e=q.onMouseLeave,Re=h(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=Z()((X={},l(X,ce,!0),l(X,ce+"-disabled",Ee),l(X,Le,Le),X)),ke=Ee?{}:{onClick:ue?this.onClick:function(){},onKeyDown:ue?this.onKeyDown:function(){},onMouseEnter:ne,onMouseLeave:_e,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(oe,E({},ke,{className:xe,role:"button",style:Te}),$.a.createElement("input",E({},L(Re),{id:we,type:"file",ref:this.saveFileInput,onClick:function(He){return He.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:fe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:ye,onChange:this.onChange})),se)}}]),O}(le.Component),c=y,f=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var I=arguments[O];for(var X in I)Object.prototype.hasOwnProperty.call(I,X)&&(V[X]=I[X])}return V},u=function(){function V(O,I){for(var X=0;X<I.length;X++){var q=I[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(O,q.key,q)}}return function(O,I,X){return I&&V(O.prototype,I),X&&V(O,X),O}}();function o(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function x(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function v(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}function S(){}var M=function(V){v(O,V);function O(){var I,X,q,oe;o(this,O);for(var ce=arguments.length,Le=Array(ce),Ee=0;Ee<ce;Ee++)Le[Ee]=arguments[Ee];return oe=(X=(q=x(this,(I=O.__proto__||Object.getPrototypeOf(O)).call.apply(I,[this].concat(Le))),q),q.saveUploader=function(we){q.uploader=we},X),x(q,oe)}return u(O,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(c,f({},this.props,{ref:this.saveUploader}))}}]),O}(le.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:S,onError:S,onSuccess:S,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=M,G=Qe.a=j},Gytx:function(ht,Qe){ht.exports=function(le,$,R,Z){var B=R?R.call(Z,le,$):void 0;if(B!==void 0)return!!B;if(le===$)return!0;if(typeof le!="object"||!le||typeof $!="object"||!$)return!1;var P=Object.keys(le),K=Object.keys($);if(P.length!==K.length)return!1;for(var U=Object.prototype.hasOwnProperty.bind($),N=0;N<P.length;N++){var D=P[N];if(!U(D))return!1;var b=le[D],A=$[D];if(B=R?R.call(Z,b,A,D):void 0,B===!1||B===void 0&&b!==A)return!1}return!0}},HmJG:function(ht,Qe,re){},IE1O:function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return c});var le=re("+L6B"),$=re("2/Rp"),R=re("2qtc"),Z=re("kLXV"),B=re("DZo9"),P=re("8z0m"),K=re("5NDa"),U=re("5rEg"),N=re("miYZ"),D=re("tsqr"),b=re("9og8"),A=re("y8nQ"),k=re("Vl3Y"),T=re("tJVT"),C=re("WmNS"),E=re.n(C),d=re("q1tI"),a=re.n(d),l=re("KeLC"),h=re.n(l),_=re("Fhpe"),g=re.n(_),m=re("m3rI"),L=re("jN4g"),y=function(u){var o,x,v,S,M=u.visible,j=u.onOk,G=u.onCancel,V=u.title,O=V===void 0?"\u9009\u62E9\u8BA4\u8BC1\u56E2\u961F\u6559\u5E08":V,I=k.a.useForm(),X=Object(T.a)(I,1),q=X[0],oe=Object(d.useState)(!1),ce=Object(T.a)(oe,2),Le=ce[0],Ee=ce[1],we=Object(d.useState)([]),Te=Object(T.a)(we,2),ye=Te[0],fe=Te[1],se=Object(d.useState)([]),te=Object(T.a)(se,2),ue=te[0],ne=te[1],_e=Object(d.useState)(!1),Re=Object(T.a)(_e,2),xe=Re[0],ke=Re[1];Object(d.useEffect)(function(){if(M!=null&&M.name){var Ve,je,rt,Je;q.setFieldsValue({name:M==null?void 0:M.name});var tt=M!=null&&(Ve=M.cover_url)!==null&&Ve!==void 0&&Ve.includes("attachments")?[{response:{id:M==null||((je=M.cover_url)===null||je===void 0)?void 0:je.split("/")[3]}}]:[],Pe=M!=null&&(rt=M.backbground_image_url)!==null&&rt!==void 0&&rt.includes("attachments")?[{response:{id:M==null||((Je=M.backbground_image_url)===null||Je===void 0)?void 0:Je.split("/")[3]}}]:[];fe(tt),ne(Pe)}},[M]);var Ne=function(){q.submit()},He=function(){G()},Fe=function(){var Ve=Object(b.a)(E.a.mark(function je(rt){var Je,tt,Pe,lt,at;return E.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:Ee(!0),console.log(ye,ue,3333),at={name:rt==null?void 0:rt.name,cover_id:(ye==null||((Je=ye[0])===null||Je===void 0||((tt=Je.response)===null||tt===void 0))?void 0:tt.id)||"",backbground_image_id:(ue==null||((Pe=ue[0])===null||Pe===void 0||((lt=Pe.response)===null||lt===void 0))?void 0:lt.id)||""},j(at);case 4:case"end":return Xe.stop()}},je)}));return function(rt){return Ve.apply(this,arguments)}}(),Me=function(je,rt){var Je=["uploading","done","removed"];Je.includes(je.file.status)&&(je.file.status==="uploading"&&ke(!0),je.file.status==="done"&&ke(!1),rt===1?fe(je.fileList):ne(je.fileList))},Oe=function(je,rt){rt===1?fe([]):ne([])},Ye=function(je,rt){var Je=je.type==="image/jpeg"||je.type==="image/png";if(!Je)return D.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var tt=je.size/1024/1024>2;return tt?(D.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(rt===1?fe([]):ne([]),!0)},Ze=function(je){var rt,Je,tt,Pe;return a.a.createElement("div",{className:h.a.img},a.a.createElement("img",{src:m.a.API_SERVER+"/api/attachments/"+(je===1?ye==null||((rt=ye[0])===null||rt===void 0||((Je=rt.response)===null||Je===void 0))?void 0:Je.id:ue==null||((tt=ue[0])===null||tt===void 0||((Pe=tt.response)===null||Pe===void 0))?void 0:Pe.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(L.a,{onClick:function(){je===1?fe([]):ne([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(Z.a,{title:O,visible:M,onOk:Ne,centered:!0,onCancel:He,confirmLoading:Le,okButtonProps:{disabled:xe},width:686,afterClose:function(){Ee(!1),fe([]),ne([]),q.resetFields()},okText:M!=null&&M.name?"\u786E\u8BA4":"\u786E\u8BA4\u65B0\u5EFA",cancelText:"\u53D6\u6D88",wrapClassName:g.a.CustomCss},a.a.createElement(k.a,{form:q,colon:!1,onFinish:Fe,className:h.a.form},a.a.createElement(k.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(U.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(k.a.Item,{name:"cover_id",label:"\u4E0A\u4F20\u5C01\u9762\u56FE",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:h.a.upload},ye!=null&&(o=ye[0])!==null&&o!==void 0&&(x=o.response)!==null&&x!==void 0&&x.id?Ze(1):a.a.createElement(P.a,{fileList:ye,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(je){return Me(je,1)},onRemove:function(je){return Oe(je,1)},beforeUpload:function(je){return Ye(je,1)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:h.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(k.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList",className:"mt30"},a.a.createElement("div",{className:h.a.upload},ue!=null&&(v=ue[0])!==null&&v!==void 0&&(S=v.response)!==null&&S!==void 0&&S.id?Ze(2):a.a.createElement(P.a,{fileList:ue,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(je){return Me(je,2)},onRemove:function(je){return Oe(je,2)},beforeUpload:function(je){return Ye(je,2)},withCredentials:!0,accept:"image/*"},a.a.createElement("div",{className:h.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")))},c=function(u){var o,x,v,S,M=u.data,j=u.onOk,G=k.a.useForm(),V=Object(T.a)(G,1),O=V[0],I=Object(d.useState)(!1),X=Object(T.a)(I,2),q=X[0],oe=X[1],ce=Object(d.useState)([]),Le=Object(T.a)(ce,2),Ee=Le[0],we=Le[1],Te=Object(d.useState)([]),ye=Object(T.a)(Te,2),fe=ye[0],se=ye[1],te=Object(d.useState)(!1),ue=Object(T.a)(te,2),ne=ue[0],_e=ue[1];Object(d.useEffect)(function(){if(M!=null&&M.name){var Me,Oe,Ye,Ze;O.setFieldsValue({name:M==null?void 0:M.name});var Ve=M!=null&&(Me=M.cover_url)!==null&&Me!==void 0&&Me.includes("attachments")?[{response:{id:M==null||((Oe=M.cover_url)===null||Oe===void 0)?void 0:Oe.split("/")[3]}}]:[],je=M!=null&&(Ye=M.backbground_image_url)!==null&&Ye!==void 0&&Ye.includes("attachments")?[{response:{id:M==null||((Ze=M.backbground_image_url)===null||Ze===void 0)?void 0:Ze.split("/")[3]}}]:[];we(Ve),se(je)}},[M]);var Re=function(){O.submit()},xe=function(){var Me=Object(b.a)(E.a.mark(function Oe(Ye){var Ze,Ve,je,rt,Je;return E.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:oe(!0),Je={name:Ye==null?void 0:Ye.name,cover_id:(Ee==null||((Ze=Ee[0])===null||Ze===void 0||((Ve=Ze.response)===null||Ve===void 0))?void 0:Ve.id)||"",backbground_image_id:(fe==null||((je=fe[0])===null||je===void 0||((rt=je.response)===null||rt===void 0))?void 0:rt.id)||""},j(Je,function(){oe(!1)});case 3:case"end":return Pe.stop()}},Oe)}));return function(Ye){return Me.apply(this,arguments)}}(),ke=function(Oe,Ye){var Ze=["uploading","done","removed"];Ze.includes(Oe.file.status)&&(Oe.file.status==="uploading"&&_e(!0),Oe.file.status==="done"&&_e(!1),Ye===1?we(Oe.fileList):se(Oe.fileList))},Ne=function(Oe,Ye){Ye===1?we([]):se([])},He=function(Oe,Ye){var Ze=Oe.type==="image/jpeg"||Oe.type==="image/png";if(!Ze)return D.b.error("\u8BF7\u4E0A\u4F20jpg\u6216png\u7684\u56FE\u7247!"),!1;var Ve=Oe.size/1024/1024>2;return Ve?(D.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E2MB"),!1):(Ye===1?we([]):se([]),!0)},Fe=function(Oe){var Ye,Ze,Ve,je;return a.a.createElement("div",{className:h.a.img},a.a.createElement("img",{src:m.a.API_SERVER+"/api/attachments/"+(Oe===1?Ee==null||((Ye=Ee[0])===null||Ye===void 0||((Ze=Ye.response)===null||Ze===void 0))?void 0:Ze.id:fe==null||((Ve=fe[0])===null||Ve===void 0||((je=Ve.response)===null||je===void 0))?void 0:je.id),alt:"avatar",style:{width:"100%"}}),a.a.createElement("div",null,a.a.createElement(L.a,{onClick:function(){Oe===1?we([]):se([])},style:{fontSize:"16px",color:"red"}})))};return a.a.createElement(k.a,{form:O,colon:!1,onFinish:xe,labelCol:{span:3},wrapperCol:{span:19},className:h.a.form},a.a.createElement(k.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(U.a,{maxLength:60,placeholder:"\u8BF7\u8F93\u5165\u793E\u533A\u540D\u79F0"})),a.a.createElement(k.a.Item,{name:"cover_id",label:"\u5C01\u9762\u56FE",valuePropName:"fileList"},a.a.createElement("div",{className:h.a.upload},Ee!=null&&(o=Ee[0])!==null&&o!==void 0&&(x=o.response)!==null&&x!==void 0&&x.id?Fe(1):a.a.createElement(P.a,{fileList:Ee,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(Oe){return ke(Oe,1)},onRemove:function(Oe){return Ne(Oe,1)},beforeUpload:function(Oe){return He(Oe,1)},withCredentials:!0,accept:"image/*"},a.a.createElement($.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(k.a.Item,{name:"backbground_image_id",label:"\u8BE6\u60C5\u9876\u90E8\u80CC\u666F",valuePropName:"fileList"},a.a.createElement("div",{className:h.a.upload},fe!=null&&(v=fe[0])!==null&&v!==void 0&&(S=v.response)!==null&&S!==void 0&&S.id?Fe(2):a.a.createElement(P.a,{fileList:fe,action:"".concat(m.a.API_SERVER,"/api/attachments.json"),onChange:function(Oe){return ke(Oe,2)},onRemove:function(Oe){return Ne(Oe,2)},beforeUpload:function(Oe){return He(Oe,2)},withCredentials:!0,accept:"image/*"},a.a.createElement($.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($.a,{disabled:ne,loading:q,type:"primary",onClick:Re,style:{marginLeft:120}},"\u786E\u8BA4"))};Qe.b=y},KeLC:function(ht,Qe,re){ht.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(ht,Qe,re){"use strict";re.d(Qe,"b",function(){return h}),re.d(Qe,"a",function(){return g});var le=re("1OyB"),$=re("vuIU"),R=re("Ji7U"),Z=re("LK+K"),B=re("q1tI"),P=re("rePB"),K=re("Ff2n"),U=re("ODXe"),N=re("4IlW"),D=re("bX4T"),b=re("YrtM"),A=re("TSYQ"),k=re.n(A),T=re("+nKL"),C=re("8OUc"),E=function(X,q){var oe=X.prefixCls,ce=X.id,Le=X.flattenOptions,Ee=X.childrenAsData,we=X.values,Te=X.searchValue,ye=X.multiple,fe=X.defaultActiveFirstOption,se=X.height,te=X.itemHeight,ue=X.notFoundContent,ne=X.open,_e=X.menuItemSelectedIcon,Re=X.virtual,xe=X.onSelect,ke=X.onToggleOpen,Ne=X.onActiveValue,He=X.onScroll,Fe=X.onMouseEnter,Me="".concat(oe,"-item"),Oe=Object(b.a)(function(){return Le},[ne,Le],function(Xe,Ce){return Ce[0]&&Xe[1]!==Ce[1]}),Ye=B.useRef(null),Ze=function(Ce){Ce.preventDefault()},Ve=function(Ce){Ye.current&&Ye.current.scrollTo({index:Ce})},je=function(Ce){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Oe.length,ie=0;ie<be;ie+=1){var ae=(Ce+ie*ve+be)%be,de=Oe[ae],me=de.group,Se=de.data;if(!me&&!Se.disabled)return ae}return-1},rt=B.useState(function(){return je(0)}),Je=Object(U.a)(rt,2),tt=Je[0],Pe=Je[1],lt=function(Ce){Pe(Ce);var ve=Oe[Ce];if(!ve){Ne(null,-1);return}Ne(ve.data.value,Ce)};B.useEffect(function(){lt(fe!==!1?je(0):-1)},[Oe.length,Te]),B.useEffect(function(){var Xe=setTimeout(function(){if(!ye&&ne&&we.size===1){var Ce=Array.from(we)[0],ve=Oe.findIndex(function(be){var ie=be.data;return ie.value===Ce});lt(ve),Ve(ve)}});return function(){return clearTimeout(Xe)}},[ne]);var at=function(Ce){Ce!==void 0&&xe(Ce,{selected:!we.has(Ce)}),ye||ke(!1)};if(B.useImperativeHandle(q,function(){return{onKeyDown:function(Ce){var ve=Ce.which;switch(ve){case N.a.UP:case N.a.DOWN:{var be=0;if(ve===N.a.UP?be=-1:ve===N.a.DOWN&&(be=1),be!==0){var ie=je(tt+be,be);Ve(ie),lt(ie)}break}case N.a.ENTER:{var ae=Oe[tt];ae&&!ae.data.disabled?at(ae.data.value):at(void 0),ne&&Ce.preventDefault();break}case N.a.ESC:ke(!1)}},onKeyUp:function(){},scrollTo:function(Ce){Ve(Ce)}}}),Oe.length===0)return B.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),className:"".concat(Me,"-empty"),onMouseDown:Ze},ue);function Be(Xe){var Ce=Oe[Xe];if(!Ce)return null;var ve=Ce.data||{},be=ve.value,ie=ve.label,ae=ve.children,de=Object(D.a)(ve,!0),me=Ee?ae:ie;return Ce?B.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},de,{key:Xe,role:"option",id:"".concat(ce,"_list_").concat(Xe),"aria-selected":we.has(be)}),be):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(tt-1),Be(tt),Be(tt+1)),B.createElement(T.a,{itemKey:"key",ref:Ye,data:Oe,height:se,itemHeight:te,fullHeight:!1,onMouseDown:Ze,onScroll:He,virtual:Re,onMouseEnter:Fe},function(Xe,Ce){var ve,be=Xe.group,ie=Xe.groupOption,ae=Xe.data,de=ae.label,me=ae.key;if(be)return B.createElement("div",{className:k()(Me,"".concat(Me,"-group"))},de!==void 0?de:me);var Se=ae.disabled,Ie=ae.value,ze=ae.title,ot=ae.children,gt=ae.style,pt=ae.className,wt=Object(K.a)(ae,["disabled","value","title","children","style","className"]),Ct=we.has(Ie),dt="".concat(Me,"-option"),Bt=k()(Me,dt,pt,(ve={},Object(P.a)(ve,"".concat(dt,"-grouped"),ie),Object(P.a)(ve,"".concat(dt,"-active"),tt===Ce&&!Se),Object(P.a)(ve,"".concat(dt,"-disabled"),Se),Object(P.a)(ve,"".concat(dt,"-selected"),Ct),ve)),Ot=Ee?ot:de,Zt=!_e||typeof _e=="function"||Ct;return B.createElement("div",Object.assign({},wt,{"aria-selected":Ct,className:Bt,title:ze,onMouseMove:function(){if(tt===Ce||Se)return;lt(Ce)},onClick:function(){Se||at(Ie)},style:gt}),B.createElement("div",{className:"".concat(dt,"-content")},Ot||Ie),B.isValidElement(_e)||Ct,Zt&&B.createElement(C.a,{className:"".concat(Me,"-option-state"),customizeIcon:_e,customizeIconProps:{isSelected:Ct}},Ct?"\u2713":null))}))},d=B.forwardRef(E);d.displayName="OptionList";var a=d,l=function(){return null};l.isSelectOption=!0;var h=l,_=function(){return null};_.isSelectOptGroup=!0;var g=_,m=re("VTBJ"),L=re("Zm9Q");function y(I){var X=I.key,q=I.props,oe=q.children,ce=q.value,Le=Object(K.a)(q,["children","value"]);return Object(m.a)({key:X,value:ce!==void 0?ce:X,children:oe},Le)}function c(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(I).map(function(q,oe){if(!B.isValidElement(q)||!q.type)return null;var ce=q.type.isSelectOptGroup,Le=q.key,Ee=q.props,we=Ee.children,Te=Object(K.a)(Ee,["children"]);return X||!ce?y(q):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Le===null?oe:Le,"__"),label:Le},Te),{},{options:c(we)})}).filter(function(q){return q})}var f=re("2Qr1"),u=re("qNPg"),o=re("U8pU"),x=re("Kwbf"),v=re("WKfj");function S(I){var X=I.mode,q=I.options,oe=I.children,ce=I.backfill,Le=I.allowClear,Ee=I.placeholder,we=I.getInputElement,Te=I.showSearch,ye=I.onSearch,fe=I.defaultOpen,se=I.autoFocus,te=I.labelInValue,ue=I.value,ne=I.inputValue,_e=I.optionLabelProp,Re=X==="multiple"||X==="tags",xe=Te!==void 0?Te:Re||X==="combobox",ke=q||c(oe);if(Object(x.a)(X!=="tags"||ke.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ne=ke.some(function(Me){return Me.options?Me.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(x.a)(!Ne,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(X!=="combobox"||!_e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(X==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(x.a)(X==="combobox"||!we,"`getInputElement` only work with `combobox` mode."),Object(x.b)(X!=="combobox"||!we||!Le||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ye&&!xe&&X!=="combobox"&&X!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!fe||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ue!=null){var He=Object(v.d)(ue);Object(x.a)(!te||He.every(function(Me){return Object(o.a)(Me)==="object"&&("key"in Me||"value"in Me)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Re||Array.isArray(ue),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var Fe=null;Object(L.a)(oe).some(function(Me){if(!B.isValidElement(Me)||!Me.type)return!1;var Oe=Me.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var Ye=Object(L.a)(Me.props.children).every(function(Ze){return!B.isValidElement(Ze)||!Me.type||Ze.type.isSelectOption?!0:(Fe=Ze.type,!1)});return!Ye}return Fe=Oe,!0}),Fe&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(x.a)(ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=S,j=Object(u.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:M,fillOptionsWithMissingValue:f.a}),G=function(I){Object(R.a)(q,I);var X=Object(Z.a)(q);function q(){var oe;return Object(le.a)(this,q),oe=X.apply(this,arguments),oe.selectRef=B.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object($.a)(q,[{key:"render",value:function(){return B.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),q}(B.Component);G.Option=h,G.OptGroup=g;var V=G,O=Qe.c=V},M8RZ:function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return N});var le=re("fWQN"),$=re("mtLc"),R=re("yKVA"),Z=re("879j"),B=re("q1tI"),P=re.n(B),K=re("i8i4"),U=re.n(K),N=function(D){Object(R.a)(A,D);var b=Object(Z.a)(A);function A(k){var T;Object(le.a)(this,A),T=b.call(this,k);var C=window.document;return T.node=C.createElement("div"),C.body.appendChild(T.node),T}return Object($.a)(A,[{key:"render",value:function(){var T=this.props.children;return Object(K.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},NLgs:function(ht,Qe,re){"use strict";re.d(Qe,"e",function(){return d}),re.d(Qe,"f",function(){return a}),re.d(Qe,"d",function(){return h}),re.d(Qe,"c",function(){return _}),re.d(Qe,"a",function(){return g}),re.d(Qe,"b",function(){return m});var le=re("miYZ"),$=re("tsqr"),R=re("9og8"),Z=re("2qtc"),B=re("kLXV"),P=re("WmNS"),K=re.n(P),U=re("q1tI"),N=re.n(U),D=re("9kvl"),b=re("xKgJ"),A=re("1vsH"),k=re("RCxd"),T=re("yTi+"),C=re.n(T),E=re("m3rI"),d=function(y){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(a(y)&&l(c))},a=function(y){return Object(b.p)()?!0:(y({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},l=function(){var y,c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,f=Object(D.c)()._store.getState(),u=f.user;return(y=u.userInfo)!==null&&y!==void 0&&y.profile_completed?!0:(B.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:c?"\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(){D.d.push("/account/profile/edit")}}),!1)},h=function(){var y,c=Object(D.c)()._store.getState(),f=c.user;return(y=f.userInfo)!==null&&y!==void 0&&y.professional_certification?!0:(B.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(A.S)("/account/certification")}}),!1)},_=function(){var y;if(Object(b.a)())return!0;var c=Object(D.c)()._store.getState(),f=c.user,u=c.globalSetting;return B.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:E.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},g=function(y,c){var f;if(y)return!0;var u=Object(D.c)()._store.getState(),o=u.user,x=u.globalSetting;return B.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:N.a.createElement("div",null,N.a.createElement("p",null,c||"\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:E.a.IMG_SERVER+(x==null||((f=x.setting)===null||f===void 0)?void 0:f.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(A.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1},m=function(y){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",f=Object(D.c)()._store.getState(),u=f.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?(B.a.info({centered:!0,icon:N.a.createElement(k.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",c,"\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:C.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(u==null?void 0:u.shixun_status)===2?(B.a.confirm({centered:!0,icon:N.a.createElement(k.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",c,"\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(){B.a.confirm({width:440,centered:!0,icon:N.a.createElement(k.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 x=Object(R.a)(K.a.mark(function S(){var M;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:M=G.sent,M.status!==401&&($.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()}},S)}));function v(){return x.apply(this,arguments)}return v}()})}}),!0):!1}},OLES:function(ht,Qe,re){"use strict";var le=re("U8pU"),$=re("VTBJ"),R=re("Ff2n"),Z=re("q1tI"),B=re("uciX"),P=re("7ixt"),K=function(k){var T=k.overlay,C=k.prefixCls,E=k.id,d=k.overlayInnerStyle;return Z.createElement("div",{className:"".concat(C,"-inner"),id:E,role:"tooltip",style:d},typeof T=="function"?T():T)},U=K,N=function(k,T){var C=k.overlayClassName,E=k.trigger,d=E===void 0?["hover"]:E,a=k.mouseEnterDelay,l=a===void 0?0:a,h=k.mouseLeaveDelay,_=h===void 0?.1:h,g=k.overlayStyle,m=k.prefixCls,L=m===void 0?"rc-tooltip":m,y=k.children,c=k.onVisibleChange,f=k.afterVisibleChange,u=k.transitionName,o=k.animation,x=k.placement,v=x===void 0?"right":x,S=k.align,M=S===void 0?{}:S,j=k.destroyTooltipOnHide,G=j===void 0?!1:j,V=k.defaultVisible,O=k.getTooltipContainer,I=k.overlayInnerStyle,X=Object(R.a)(k,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),q=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(T,function(){return q.current});var oe=Object($.a)({},X);"visible"in k&&(oe.popupVisible=k.visible);var ce=function(){var ye=k.arrowContent,fe=ye===void 0?null:ye,se=k.overlay,te=k.id;return[Z.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},fe),Z.createElement(U,{key:"content",prefixCls:L,id:te,overlay:se,overlayInnerStyle:I})]},Le=!1,Ee=!1;if(typeof G=="boolean")Le=G;else if(G&&Object(le.a)(G)==="object"){var we=G.keepParent;Le=we===!0,Ee=we===!1}return Z.createElement(B.a,Object.assign({popupClassName:C,prefixCls:L,popup:ce,action:d,builtinPlacements:P.a,popupPlacement:v,ref:q,popupAlign:M,getPopupContainer:O,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:u,popupAnimation:o,defaultPopupVisible:V,destroyPopupOnHide:Le,autoDestroy:Ee,mouseLeaveDelay:_,popupStyle:g,mouseEnterDelay:l},oe),y)},D=Object(Z.forwardRef)(N),b=Qe.a=D},Ot1p:function(ht,Qe,re){"use strict";var le=re("2qtc"),$=re("kLXV"),R=re("rAM+"),Z=re("miYZ"),B=re("tsqr"),P=re("9og8"),K=re("tJVT"),U=re("jrin"),N=re("WmNS"),D=re.n(N),b=re("q1tI"),A=re.n(b),k=re("VrN/"),T=re.n(k),C=re("bdgK"),E=re("p77/"),d=re("Bd2K"),a=re("ELLl"),l=re("19Vz"),h=re("lZu9"),_=re("+NIl"),g=re("kSUc"),m=re("9Bee"),L=function(Se){var Ie=Se.value,ze=Ie===void 0?"":Ie,ot=Se.className,gt=Se.showTextOnly,pt=Se.showLines,wt=Se.style,Ct=wt===void 0?{}:wt,dt=Object(b.useMemo)(function(){return""},[ze]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:dt}}))},y=re("0Owb"),c=re("dejd"),f=re("C+DQ"),u=re("1vsH"),o=re("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(Se){var Ie=Se.onActionCallback,ze=Se.title,ot=Se.icon,gt=Se.actionName,pt=Se.className,wt=pt===void 0?"":pt,Ct=Se.children;function dt(){Ie(gt)}return A.a.createElement("a",{title:ze,className:wt,onClick:dt},A.a.createElement("i",{className:"md-iconfont ".concat(ot)}),Ct)}var S=function(Se){var Ie=Se.watch,ze=Se.showNullButton,ot=Se.onActionCallback,gt=Se.fullScreen,pt=Se.insertTemp,wt=Se.hidetoolBar,Ct=Se.uuid,dt=Se.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(Ct,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var Bt=[].concat(x,[{title:"".concat(Ie?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ie?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!wt&&Bt.map(function(Ot,Zt){return A.a.createElement("li",{key:Zt},Ot.actionName?A.a.createElement(v,Object(y.a)({},Ot,{onActionCallback:ot})):A.a.createElement("span",{className:"v-line"}))}),ze?A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ot},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,pt&&A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(pt),onActionCallback:ot},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(v,{icon:"".concat(gt?"icon-shrink":"icon-enlarge"),title:gt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ot})))},M=re("M8RZ"),j=re("+L6B"),G=re("2/Rp"),V=re("y8nQ"),O=re("Vl3Y"),I=re("5NDa"),X=re("5rEg"),q={labelCol:{span:4},wrapperCol:{span:20}},oe=function(Se){var Ie=Se.callback,ze=Se.onCancel;function ot(gt){Ie(gt)}return A.a.createElement(O.a,Object(y.a)({},q,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ot}),A.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(X.a,null)),A.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(X.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(G.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))},ce=re("7ahc"),Le=re("HmJG"),Ee=re("BjJ7"),we=O.a.useForm,Te={width:280,marginRight:10},ye={labelCol:{span:5},wrapperCol:{span:19}},fe=function(Se){var Ie=Se.callback,ze=Se.onCancel,ot=we(),gt=Object(K.a)(ot,1),pt=gt[0];function wt(Bt){Ie(Bt)}function Ct(Bt,Ot){if(Bt.status===-1){B.b.error(Bt.message);return}pt.setFieldsValue({src:"/api/attachments/".concat(Bt.id),type:Ot.type})}function dt(Bt){var Ot=Bt.target.files[0];te(Ot,Ct)}return A.a.createElement(O.a,Object(y.a)({form:pt},ye,{className:"upload-image-panel",onFinish:wt}),A.a.createElement(O.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(X.a,{style:Te})),A.a.createElement(se,{onFileChange:dt}))),A.a.createElement(O.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(X.a,{style:{width:264}})),A.a.createElement(O.a.Item,{style:{textAlign:"right"}},A.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(G.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))};function se(Se){var Ie=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ie}))}function te(Se,Ie){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var ze=new FormData;ze.append("editormd-image-file",Se),ze.append("file_param_name","editormd-image-file"),ze.append("byxhr","true");var ot=new window.XMLHttpRequest;ot.withCredentials=!0,ot.addEventListener("load",function(gt){Ie(JSON.parse(gt.target.responseText),Se)},!1),ot.addEventListener("error",function(gt){console.error(gt)},!1),ot.open("POST","".concat(Ee.a,"/api/attachments.json")),ot.send(ze)}var ue=re("giR+"),ne=re("fyUT"),_e=re("7Kak"),Re=re("9yH6"),xe=Re.a.Group,ke={margin:"0 8px"},Ne=function(Se){var Ie=Se.callback,ze=Se.onCancel;function ot(gt){Ie(gt)}return A.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ot},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:ke},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:ke},"\u884C\u6570"),A.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ne.a,null)),A.a.createElement("span",{style:ke},"\u5217\u6570"),A.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ne.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:ke},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(O.a.Item,{name:"align"},A.a.createElement(xe,null,A.a.createElement(Re.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Re.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Re.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Re.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(G.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))},He=re("ErOA"),Fe=re("7Cbv"),Me="link",Oe="upload-image",Ye="code-block",Ze="add-table",Ve="------------",je={default:Ve,left:":".concat(Ve),center:":".concat(Ve,":"),right:"".concat(Ve,":")},rt=re("9VGf"),Je,tt;function Pe(){}var lt=0,at=1e4,Be="\u2581",Xe=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ce(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=ve?"Cmd":"Ctrl",ie=["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"],ae=(Je={},Object(U.a)(Je,be+"-B","bold"),Object(U.a)(Je,be+"-I","italic"),Je),de=(tt={},Object(U.a)(tt,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(tt,Ye,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(tt,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(tt,Ze,"\u6DFB\u52A0\u8868\u683C"),tt),me=Qe.a=function(Se){var Ie=Se.defaultValue,ze=Ie===void 0?"":Ie,ot=Se.onChange,gt=Se.width,pt=gt===void 0?"100%":gt,wt=Se.height,Ct=wt===void 0?400:wt,dt=Se.miniToolbar,Bt=dt===void 0?!1:dt,Ot=Se.isFocus,Zt=Ot===void 0?!1:Ot,Xt=Se.watch,kt=Se.insertTemp,Ir=Se.mode,Kr=Ir===void 0?"markdown":Ir,Et=Se.id,Nr=Et===void 0?"markdown-editor-id":Et,dr=Se.showResizeBar,pr=dr===void 0?!1:dr,Fr=Se.noStorage,ci=Fr===void 0?!1:Fr,qr=Se.showNullButton,It=qr===void 0?!1:qr,ct=Se.hidetoolBar,Hr=ct===void 0?!1:ct,ei=Se.fullScreen,mr=ei===void 0?!1:ei,Lt=Se.onBlur,Br=Se.onCMBeforeChange,Vr=Se.onFullScreen,fi=Se.className,$e=fi===void 0?"":fi,St=Se.disablePaste,pi=St===void 0?!1:St,mi=Se.placeholder,gi=mi===void 0?"":mi,vi=Se.values,z=vi===void 0?"":vi,s=Object(b.useState)(null),p=Object(K.a)(s,2),F=p[0],Q=p[1],H=Object(b.useState)(ze),ge=Object(K.a)(H,2),We=ge[0],et=ge[1],ft=Object(b.useState)(Xt),Ge=Object(K.a)(ft,2),yt=Ge[0],Nt=Ge[1],Kt=Object(b.useState)(mr),kr=Object(K.a)(Kt,2),gr=kr[0],vr=kr[1],Xr=Object(b.useState)(""),ki=Object(K.a)(Xr,2),nr=ki[0],Ur=ki[1],oi=Object(b.useState)(0),si=Object(K.a)(oi,2),Or=si[0],Oi=si[1],yi=Object(b.useState)(Ct),Gi=Object(K.a)(yi,2),Ki=Gi[0],Yr=Gi[1],zr=Object(b.useState)(!1),bi=Object(K.a)(zr,2),hn=bi[0],Ei=bi[1],Jt=Object(b.useRef)(Object(Fe.a)()),Ft=Object(b.useRef)(!1),hr=Object(b.useRef)(),Dt=Object(b.useRef)(),qt=Object(b.useRef)(),Wt=Object(b.useRef)(),ti=Object(b.useRef)(),ar=function(){var mt=Object(P.a)(D.a.mark(function Tt(){var bt,At;return D.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Object(He.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Jt.current}});case 2:At=zt.sent,At!=null&&(bt=At.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",F,Dt),At.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?F.replaceSelection("![,](/api/attachments/".concat(Pt.id,"?type=").concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?F.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?F.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):F.replaceSelection("[".concat(Pt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return zt.stop()}},Tt)}));return function(){return mt.apply(this,arguments)}}();Object(b.useEffect)(function(){et(z),F==null||F.setValue(z)},[z]),Object(b.useEffect)(function(){Vr==null||Vr(gr)},[gr]),Object(b.useEffect)(function(){if(Dt.current){var mt=T.a.fromTextArea(Dt.current,{mode:Kr,lineNumbers:!Bt,lineWrapping:!0,value:ze,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&mt.focus();function Tt(bt,At){if(pi){At.preventDefault();return}var Mt=At.clipboardData;if(Mt){var zt=Mt.types.toString(),Pt=Mt.items;if(zt==="Files"||Mt.types.indexOf("Files")>-1){if(At.preventDefault(),Kr=="stex")return;try{var rr,Tr=Pt[1];((rr=Pt[0])===null||rr===void 0?void 0:rr.kind)==="file"&&(Tr=Pt[0]);var Rt=Tr.getAsFile(),li=Rt.name.split(".").pop();te(Rt,function(Ut){if(Ut.id){var wr,yr,Gr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Gr=Rt.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ie.includes(li)?mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",Tt),mt.on("dragleave",function(bt,At){qt.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(bt,At){qt.current.classList.add("mouse-hover-md")}),mt.on("drop",function(bt,At){qt.current.classList.add("mouse-hover-md");var Mt;if(Mt=At.dataTransfer.files,Mt.length>0){At.preventDefault(),At.stopPropagation();for(var zt=function(Tr){var Rt=Mt[Tr],li=Rt.name.split(".").pop();te(Rt,function(Ut){if(Ut.id){var wr,yr,Gr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Gr=Rt.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ie.includes(li)?mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Mt.length;Pt++)zt(Pt)}}),Q(mt),function(){mt.off("paste",Tt)}}},[]);var xr=Object(b.useCallback)(function(){if(qt.current)try{}catch(mt){console.log(mt,"---- to set md editor body height")}},[Ki,qt,gr]);Object(b.useEffect)(function(){function mt(){var bt=new C.default(function(At){var Mt=Object(R.a)(At),zt;try{for(Mt.s();!(zt=Mt.n()).done;){var Pt=zt.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(xr(),F.setSize("100%","100%"),F.refresh())}}catch(rr){Mt.e(rr)}finally{Mt.f()}});return bt.observe(Dt.current.parentElement),bt}if(F){var Tt=mt();return function(){Tt.unobserve(Dt.current.parentElement)}}},[F,xr]),Object(b.useEffect)(function(){if(F){for(var mt=[],Tt=function(){var Pt=At[bt];Mt=Object(K.a)(Pt,2);var rr=Mt[0],Tr=Mt[1],Rt=Object(U.a)({},rr,function(){Vi(Tr)});mt.push(Rt),F.addKeyMap(Rt)},bt=0,At=Object.entries(ae);bt<At.length;bt++){var Mt;Tt()}return hr.current=setInterval(function(){Ft.current&&ar()},4e3),function(){clearInterval(hr.current);var zt=Object(R.a)(mt),Pt;try{for(zt.s();!(Pt=zt.n()).done;){var rr=Pt.value;F.removeKeyMap(rr)}}catch(Tr){zt.e(Tr)}finally{zt.f()}}}},[F]),Object(b.useEffect)(function(){mr!==gr&&vr(mr)},[mr]),Object(rt.a)(function(){if(!ci&&Or>0){var mt=new Date().getTime(),Tt=window.sessionStorage.getItem(Nr);mt>=Or+at&&(!Tt||Tt!==We)&&(window.sessionStorage.setItem(Nr,We),Ei(!0))}},at),Object(b.useEffect)(function(){Nt(Xt)},[F,Xt]),Object(b.useEffect)(function(){F&&(Zt&&F.focus())},[F,Zt]),Object(b.useEffect)(function(){if(yt&&F){var mt=F.getScrollerElement();function Tt(bt){var At=bt.target;if(ti.current){var Mt=At.scrollTop/At.scrollHeight;ti.current.scrollTop=ti.current.scrollHeight*Mt}}return mt.addEventListener("scroll",Tt),function(){mt.removeEventListener("scroll",Tt)}}},[F,yt]),Object(b.useEffect)(function(){if(F&&Br){function mt(Tt,bt){Br(Tt,bt)}return F.on("beforeChange",mt),function(){F.off("beforeChange",mt)}}},[F,Br]),Object(b.useEffect)(function(){if(F&&Lt){function mt(){Lt(F.getValue())}return F.on("blur",mt),function(){F.off("blur",mt)}}},[F,Lt]),Object(b.useEffect)(function(){if(F){function mt(Tt){var bt=Tt.getValue();et(bt),Oi(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ot&&ot(bt)}return F.on("change",mt),function(){F.off("change",mt)}}},[F,ot]),Object(b.useEffect)(function(){F&&(ze==null?(F.setValue(""),et("")):ze!==F.getValue()&&(F.setValue(ze),et(ze),F.setCursor(F.lineCount(),0)))},[F,ze]);var Vi=Object(b.useCallback)(function(mt){var Tt=F.getCursor(),bt=F.getSelection(),At=bt.split(`
`);switch(mt){case"bold":return F.replaceSelection("**"+bt+"**"),bt===""&&F.setCursor(Tt.line,Tt.ch+2),F.focus();case"italic":return F.replaceSelection("*"+bt+"*"),bt===""&&F.setCursor(Tt.line,Tt.ch+1),F.focus();case"code":return F.replaceSelection("`"+bt+"`"),bt===""&&F.setCursor(Tt.line,Tt.ch+1),F.focus();case"inline-latex":return F.replaceSelection("`$$"+bt+"$$`"),bt===""&&F.setCursor(Tt.line,Tt.ch+3),F.focus();case"latex":return F.replaceSelection("```latex\n"+bt+"\n```"),F.setCursor(Tt.line+1,bt.length+1),F.focus();case"line-break":return F.replaceSelection(`<br/>
`),F.focus();case"list-ul":return bt===""?F.replaceSelection("- "+bt):F.replaceSelection(At.map(function(Mt){return Mt===""?"":"- ".concat(Mt)}).join(`
`)),F.focus();case"list-ol":return bt===""?F.replaceSelection("1. "+bt):F.replaceSelection(At.map(function(Mt,zt){return Mt===""?"":"".concat(zt+1,". ").concat(Mt)}).join(`
`)),F.focus();case"add-null-ch":return bt===""&&F.setCursor(Tt.line,Tt.ch+1),F.replaceSelection(Be),F.focus();case"inster-template-1":return bt===""&&F.setCursor(Tt.line,Tt.ch),F.replaceSelection(Xe),F.focus();case"eraser":return F.setValue(""),F.focus();case"trigger-watch":return Nt(!yt),F.focus();case"trigger-full-screen":return vr(!gr),F.focus();case Me:Ur(Me);return;case Ye:Ur(Ye);return;case Oe:Ur(Oe);return;case Ze:Ur(Ze);return;default:throw new Error}},[F,yt,gr]),xi=Object(b.useCallback)(function(mt){Ur("");switch(nr){case Me:var Tt=mt.title,bt=mt.link;return F.replaceSelection("[".concat(Tt,"](").concat(bt,")")),F.focus();case Ye:var At=mt.language,Mt=mt.content;return F.replaceSelection(["```"+At,Mt,"```"].join(`
`)),F.focus();case Oe:var zt=mt.src,Pt=mt.alt;return Pt?F.replaceSelection("![ ".concat(Pt," ]( ").concat(zt,' "').concat(Pt,'" )')):F.replaceSelection("![,](".concat(zt,")")),F.focus();case Ze:for(var rr=mt.row,Tr=mt.col,Rt=mt.align,li=`
`,Ut=0;Ut<rr;Ut++){for(var wr=[],yr=[],Gr=0;Gr<Tr;Gr++)Ut===1&&yr.push(je[Rt]),wr.push(" ");Ut===1&&(li+="| ".concat(yr.join(" | "),` |
`)),li+="| ".concat(wr.join(Tr===1?"":" | "),` |
`)}return F.replaceSelection(li+`
`),F.focus();default:throw new Error}},[F,nr]),cn=Object(b.useMemo)(function(){switch(nr){case Me:return A.a.createElement(oe,{callback:xi,onCancel:Si});case Ye:return A.a.createElement(ce.b,{callback:xi,onCancel:Si});case Oe:return A.a.createElement(fe,{callback:xi,onCancel:Si});case Ze:return A.a.createElement(Ne,{callback:xi,onCancel:Si});default:return null}},[nr]);function Si(){Ur("")}Object(b.useEffect)(function(){if(Wt.current){var mt=Wt.current,Tt=!1,bt=0;function At(Pt){Tt=!0,bt=Pt.pageY}function Mt(){Tt=!1}function zt(Pt){if(Tt){var rr=Pt.pageY-bt;rr<0&&(rr=0),rr>300&&(rr=300);var Tr=Ct+rr+"px";Yr(Tr)}}return mt.addEventListener("mousedown",At),document.addEventListener("mousemove",zt),document.addEventListener("mouseup",Mt),function(){mt.removeEventListener("mousedown",At),document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",Mt)}}},[F,Wt]),Object(b.useEffect)(function(){Yr(Ct)},[Ct]);var ri=Ce(pt),fn=Ce(Ki),$r={width:ri,height:fn},pn=Object(b.useMemo)(function(){if(Or){var mt=new Date(Or),Tt=mt.getHours(),bt=mt.getMinutes(),At=mt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,bt=bt<10?"0"+bt:bt,At=At<10?"0"+At:At,"".concat(Tt,":").concat(bt,":").concat(At)}return 0},[Or]);function jn(){window.sessionStorage.removeItem(Nr),Ei(!1),Oi(0)}function Pi(){Ei(!1),Oi(0),F.setValue(window.sessionStorage.getItem(Nr))}function ua(mt,Tt){var bt=F.getValue();bt=bt.replace(mt,Tt),et(bt),F==null||F.setValue(bt)}return A.a.createElement(b.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:qt},A.a.createElement("div",{className:"markdown-editor-container ".concat($e," ").concat(yt?"on-preview":""," ").concat(Bt?"mini":""," ").concat(gr?"full-screen":""),style:$r},A.a.createElement(S,{insertTemp:kt,watch:yt,fullScreen:gr,showNullButton:It,onActionCallback:Vi,hidetoolBar:Hr,uuid:Jt.current,setOpenPhones:function(){Ft.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Dt,placeholder:gi})),yt?A.a.createElement("div",{ref:ti,className:"preview-container"},Kr==="stex"&&A.a.createElement(L,{value:We}),Kr!=="stex"&&A.a.createElement(m.a,{edit:!0,value:We,replaces:ua})):null))),pr?A.a.createElement("a",{ref:Wt,className:"editor-resize"}):null,A.a.createElement(M.a,null,de[nr]?A.a.createElement($.a,{centered:!0,title:de[nr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(ht,Qe){/**
* @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 re,le,$,R=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var P,K;(function(){var U=window,N=["break,continue,do,else,for,if,return,while"],D=[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=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[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"],k=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[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"],C="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",E=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[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"],h=[N,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],_=[A,T,k,E,d,a,l,h],g=/^(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",c="typ",f="lit",u="pun",o="pln",x="tag",v="dec",S="src",M="atn",j="atv",G="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(xe){for(var ke=0,Ne=!1,He=!1,Fe=0,Me=xe.length;Fe<Me;++Fe){var Oe=xe[Fe];if(Oe.ignoreCase)He=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ne=!0,He=!1;break}}var Ye={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(tt){var Pe=tt.charCodeAt(0);if(Pe!==92)return Pe;var lt=tt.charAt(1);return Pe=Ye[lt],Pe||("0"<=lt&&lt<="7"?parseInt(tt.substring(1),8):lt==="u"||lt==="x"?parseInt(tt.substring(2),16):tt.charCodeAt(1))}function Ve(tt){if(tt<32)return(tt<16?"\\x0":"\\x")+tt.toString(16);var Pe=String.fromCharCode(tt);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function je(tt){var Pe=tt.substring(1,tt.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")),lt=[],at=Pe[0]==="^",Be=["["];at&&Be.push("^");for(var Xe=at?1:0,Ce=Pe.length;Xe<Ce;++Xe){var ve=Pe[Xe];if(/\\[bdsw]/i.test(ve))Be.push(ve);else{var be=Ze(ve),ie;Xe+2<Ce&&Pe[Xe+1]==="-"?(ie=Ze(Pe[Xe+2]),Xe+=2):ie=be,lt.push([be,ie]),ie<65||be>122||(ie<65||be>90||lt.push([Math.max(65,be)|32,Math.min(ie,90)|32]),ie<97||be>122||lt.push([Math.max(97,be)&~32,Math.min(ie,122)&~32]))}}lt.sort(function(Se,Ie){return Se[0]-Ie[0]||Ie[1]-Se[1]});for(var ae=[],de=[],Xe=0;Xe<lt.length;++Xe){var me=lt[Xe];me[0]<=de[1]+1?de[1]=Math.max(de[1],me[1]):ae.push(de=me)}for(var Xe=0;Xe<ae.length;++Xe){var me=ae[Xe];Be.push(Ve(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&Be.push("-"),Be.push(Ve(me[1])))}return Be.push("]"),Be.join("")}function rt(tt){for(var Pe=tt.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")),lt=Pe.length,at=[],Be=0,Xe=0;Be<lt;++Be){var Ce=Pe[Be];if(Ce==="(")++Xe;else if(Ce.charAt(0)==="\\"){var ve=+Ce.substring(1);ve&&(ve<=Xe?at[ve]=-1:Pe[Be]=Ve(ve))}}for(var Be=1;Be<at.length;++Be)at[Be]===-1&&(at[Be]=++ke);for(var Be=0,Xe=0;Be<lt;++Be){var Ce=Pe[Be];if(Ce==="(")++Xe,at[Xe]||(Pe[Be]="(?:");else if(Ce.charAt(0)==="\\"){var ve=+Ce.substring(1);ve&&ve<=Xe&&(Pe[Be]="\\"+at[ve])}}for(var Be=0;Be<lt;++Be)Pe[Be]==="^"&&Pe[Be+1]!=="^"&&(Pe[Be]="");if(tt.ignoreCase&&Ne)for(var Be=0;Be<lt;++Be){var Ce=Pe[Be],be=Ce.charAt(0);Ce.length>=2&&be==="["?Pe[Be]=je(Ce):be!=="\\"&&(Pe[Be]=Ce.replace(/[a-zA-Z]/g,function(de){var me=de.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Pe.join("")}for(var Je=[],Fe=0,Me=xe.length;Fe<Me;++Fe){var Oe=xe[Fe];if(Oe.global||Oe.multiline)throw new Error(""+Oe);Je.push("(?:"+rt(Oe)+")")}return new RegExp(Je.join("|"),He?"gi":"g")}function I(xe,ke){var Ne=/(?:^|\s)nocode(?:\s|$)/,He=[],Fe=0,Me=[],Oe=0;function Ye(Ze){var Ve=Ze.nodeType;if(Ve==1){if(Ne.test(Ze.className))return;for(var je=Ze.firstChild;je;je=je.nextSibling)Ye(je);var rt=Ze.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(He[Oe]=`
`,Me[Oe<<1]=Fe++,Me[Oe++<<1|1]=Ze)}else if(Ve==3||Ve==4){var Je=Ze.nodeValue;Je.length&&(ke?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),He[Oe]=Je,Me[Oe<<1]=Fe,Fe+=Je.length,Me[Oe++<<1|1]=Ze)}}return Ye(xe),{sourceCode:He.join("").replace(/\n$/,""),spans:Me}}function X(xe,ke,Ne,He,Fe){if(!Ne)return;var Me={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Ne,spans:null,basePos:ke,decorations:null};He(Me),Fe.push.apply(Fe,Me.decorations)}var q=/\S/;function oe(xe){for(var ke=void 0,Ne=xe.firstChild;Ne;Ne=Ne.nextSibling){var He=Ne.nodeType;ke=He===1?ke?xe:Ne:He===3&&q.test(Ne.nodeValue)?xe:ke}return ke===xe?void 0:ke}function ce(xe,ke){var Ne={},He;(function(){for(var Oe=xe.concat(ke),Ye=[],Ze={},Ve=0,je=Oe.length;Ve<je;++Ve){var rt=Oe[Ve],Je=rt[3];if(Je)for(var tt=Je.length;--tt>=0;)Ne[Je.charAt(tt)]=rt;var Pe=rt[1],lt=""+Pe;Ze.hasOwnProperty(lt)||(Ye.push(Pe),Ze[lt]=null)}Ye.push(/[\0-\uffff]/),He=O(Ye)})();var Fe=ke.length,Me=function(Oe){for(var Ye=Oe.sourceCode,Ze=Oe.basePos,Ve=Oe.sourceNode,je=[Ze,o],rt=0,Je=Ye.match(He)||[],tt={},Pe=0,lt=Je.length;Pe<lt;++Pe){var at=Je[Pe],Be=tt[at],Xe=void 0,Ce;if(typeof Be=="string")Ce=!1;else{var ve=Ne[at.charAt(0)];if(ve)Xe=at.match(ve[1]),Be=ve[0];else{for(var be=0;be<Fe;++be)if(ve=ke[be],Xe=at.match(ve[1]),Xe){Be=ve[0];break}Xe||(Be=o)}Ce=Be.length>=5&&Be.substring(0,5)==="lang-",Ce&&!(Xe&&typeof Xe[1]=="string")&&(Ce=!1,Be=S),Ce||(tt[at]=Be)}var ie=rt;if(rt+=at.length,!Ce)je.push(Ze+ie,Be);else{var ae=Xe[1],de=at.indexOf(ae),me=de+ae.length;Xe[2]&&(me=at.length-Xe[2].length,de=me-ae.length);var Se=Be.substring(5);X(Ve,Ze+ie,at.substring(0,de),Me,je),X(Ve,Ze+ie+de,ae,se(Se,ae),je),X(Ve,Ze+ie+me,at.substring(me),Me,je)}}Oe.decorations=je};return Me}function Le(xe){var ke=[],Ne=[];xe.tripleQuotedStrings?ke.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?ke.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ke.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Ne.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var He=xe.hashComments;He&&(xe.cStyleComments?(He>1?ke.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ke.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ne.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ke.push([y,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Ne.push([y,/^\/\/[^\r\n]*/,null]),Ne.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=xe.regexLiterals;if(Fe){var Me=Fe>1?"":`
\r`,Oe=Me?".":"[\\S\\s]",Ye="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";Ne.push(["lang-regex",RegExp("^"+V+"("+Ye+")")])}var Ze=xe.types;Ze&&Ne.push([c,Ze]);var Ve=(""+xe.keywords).replace(/^ | $/g,"");Ve.length&&Ne.push([L,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),ke.push([o,/^\s+/,null,` \r
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(je+="(?!s*/)"),Ne.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[f,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(je),null]),ce(ke,Ne)}var Ee=Le({keywords:_,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function we(xe,ke,Ne){for(var He=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Me=xe.ownerDocument,Oe=Me.createElement("li");xe.firstChild;)Oe.appendChild(xe.firstChild);var Ye=[Oe];function Ze(Pe){var lt=Pe.nodeType;if(lt==1&&!He.test(Pe.className))if(Pe.nodeName==="br")Ve(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var at=Pe.firstChild;at;at=at.nextSibling)Ze(at);else if((lt==3||lt==4)&&Ne){var Be=Pe.nodeValue,Xe=Be.match(Fe);if(Xe){var Ce=Be.substring(0,Xe.index);Pe.nodeValue=Ce;var ve=Be.substring(Xe.index+Xe[0].length);if(ve){var be=Pe.parentNode;be.insertBefore(Me.createTextNode(ve),Pe.nextSibling)}Ve(Pe),Ce||Pe.parentNode.removeChild(Pe)}}}function Ve(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function lt(Xe,Ce){var ve=Ce?Xe.cloneNode(!1):Xe,be=Xe.parentNode;if(be){var ie=lt(be,1),ae=Xe.nextSibling;ie.appendChild(ve);for(var de=ae;de;de=ae)ae=de.nextSibling,ie.appendChild(de)}return ve}for(var at=lt(Pe.nextSibling,0),Be;(Be=at.parentNode)&&Be.nodeType===1;)at=Be;Ye.push(at)}for(var je=0;je<Ye.length;++je)Ze(Ye[je]);ke===(ke|0)&&Ye[0].setAttribute("value",ke);var rt=Me.createElement("ol");rt.className="linenums";for(var Je=Math.max(0,ke-1|0)||0,je=0,tt=Ye.length;je<tt;++je)Oe=Ye[je],Oe.className="L"+(je+Je)%10,Oe.firstChild||Oe.appendChild(Me.createTextNode("\xA0")),rt.appendChild(Oe);xe.appendChild(rt)}function Te(xe){var ke=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ke=ke&&+ke[1]<=8;var Ne=/\n/g,He=xe.sourceCode,Fe=He.length,Me=0,Oe=xe.spans,Ye=Oe.length,Ze=0,Ve=xe.decorations,je=Ve.length,rt=0;Ve[je]=Fe;var Je,tt;for(tt=Je=0;tt<je;)Ve[tt]!==Ve[tt+2]?(Ve[Je++]=Ve[tt++],Ve[Je++]=Ve[tt++]):tt+=2;for(je=Je,tt=Je=0;tt<je;){for(var Pe=Ve[tt],lt=Ve[tt+1],at=tt+2;at+2<=je&&Ve[at+1]===lt;)at+=2;Ve[Je++]=Pe,Ve[Je++]=lt,tt=at}je=Ve.length=Je;var Be=xe.sourceNode,Xe="";Be&&(Xe=Be.style.display,Be.style.display="none");try{for(var Ce=null;Ze<Ye;){var ve=Oe[Ze],be=Oe[Ze+2]||Fe,ie=Ve[rt+2]||Fe,at=Math.min(be,ie),ae=Oe[Ze+1],de;if(ae.nodeType!==1&&(de=He.substring(Me,at))){ke&&(de=de.replace(Ne,"\r")),ae.nodeValue=de;var me=ae.ownerDocument,Se=me.createElement("span");Se.className=Ve[rt+1];var Ie=ae.parentNode;Ie.replaceChild(Se,ae),Se.appendChild(ae),Me<be&&(Oe[Ze+1]=ae=me.createTextNode(He.substring(at,be)),Ie.insertBefore(ae,Se.nextSibling))}Me=at,Me>=be&&(Ze+=2),Me>=ie&&(rt+=2)}}finally{Be&&(Be.style.display=Xe)}}var ye={};function fe(xe,ke){for(var Ne=ke.length;--Ne>=0;){var He=ke[Ne];ye.hasOwnProperty(He)?U.console&&console.warn("cannot override language handler %s",He):ye[He]=xe}}function se(xe,ke){return xe&&ye.hasOwnProperty(xe)||(xe=/^\s*</.test(ke)?"default-markup":"default-code"),ye[xe]}fe(Ee,["default-code"]),fe(ce([],[[o,/^[^<?]+/],[v,/^<!\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"]),fe(ce([[o,/^[\s]+/,null,` \r
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!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"]),fe(ce([],[[j,/^[\s\S]+/]]),["uq.val"]),fe(Le({keywords:A,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),fe(Le({keywords:"null,true,false"}),["json"]),fe(Le({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),fe(Le({keywords:k,cStyleComments:!0}),["java"]),fe(Le({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(Le({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(Le({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(Le({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(Le({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(Le({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(ce([],[[m,/^[\s\S]+/]]),["regex"]);function te(xe){var ke=xe.langExtension;try{var Ne=I(xe.sourceNode,xe.pre),He=Ne.sourceCode;xe.sourceCode=He,xe.spans=Ne.spans,xe.basePos=0,se(ke,He)(xe),Te(xe)}catch(Fe){U.console&&console.log(Fe&&Fe.stack||Fe)}}function ue(xe,ke,Ne){var He=Ne||!1,Fe=ke||null,Me=document.createElement("div");Me.innerHTML="<pre>"+xe+"</pre>",Me=Me.firstChild,He&&we(Me,He,!0);var Oe={langExtension:Fe,numberLines:He,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Oe),Me.innerHTML}function ne(xe,ke){var Ne=ke||document.body,He=Ne.ownerDocument||document;function Fe(ve){return Ne.getElementsByTagName(ve)}for(var Me=[Fe("pre"),Fe("code"),Fe("xmp")],Oe=[],Ye=0;Ye<Me.length;++Ye)for(var Ze=0,Ve=Me[Ye].length;Ze<Ve;++Ze)Oe.push(Me[Ye][Ze]);Me=null;var je=Date;je.now||(je={now:function(){return+new Date}});var rt=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,tt=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,lt=/pre|xmp/i,at=/^code$/i,Be=/^(?:pre|code|xmp)$/i,Xe={};function Ce(){for(var ve=U.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;rt<Oe.length&&je.now()<ve;rt++){for(var be=Oe[rt],ie=Xe,ae=be;ae=ae.previousSibling;){var de=ae.nodeType,me=(de===7||de===8)&&ae.nodeValue;if(me?!/^\??prettify\b/.test(me):de!==3||/\S/.test(ae.nodeValue))break;if(me){ie={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Xt,kt,Ir){ie[kt]=Ir});break}}var Se=be.className;if((ie!==Xe||tt.test(Se))&&!Pe.test(Se)){for(var Ie=!1,ze=be.parentNode;ze;ze=ze.parentNode){var ot=ze.tagName;if(Be.test(ot)&&ze.className&&tt.test(ze.className)){Ie=!0;break}}if(!Ie){be.className+=" prettyprinted";var gt=ie.lang;if(!gt){gt=Se.match(Je);var pt;!gt&&(pt=oe(be))&&at.test(pt.tagName)&&(gt=pt.className.match(Je)),gt&&(gt=gt[1])}var wt;if(lt.test(be.tagName))wt=1;else{var Ct=be.currentStyle,dt=He.defaultView,Bt=Ct?Ct.whiteSpace:dt&&dt.getComputedStyle?dt.getComputedStyle(be,null).getPropertyValue("white-space"):0;wt=Bt&&Bt.substring(0,3)==="pre"}var Ot=ie.linenums;(Ot=Ot==="true"||+Ot)||(Ot=Se.match(/\blinenums\b(?::(\d+))?/),Ot=Ot?Ot[1]&&Ot[1].length?+Ot[1]:!0:!1),Ot&&we(be,Ot,wt);var Zt={langExtension:gt,sourceNode:be,numberLines:Ot,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Zt)}}}rt<Oe.length?U.setTimeout(Ce,250):typeof xe=="function"&&xe()}Ce()}var _e=U.PR={createSimpleLexer:ce,registerLangHandler:fe,sourceDecorator:Le,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:j,PR_COMMENT:y,PR_DECLARATION:v,PR_KEYWORD:L,PR_LITERAL:f,PR_NOCODE:G,PR_PLAIN:o,PR_PUNCTUATION:u,PR_SOURCE:S,PR_STRING:m,PR_TAG:x,PR_TYPE:c,prettyPrintOne:R?U.prettyPrintOne=ue:P=ue,prettyPrint:K=R?U.prettyPrint=ne:K=ne},Re=U.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return _e})})()},"VrN/":function(ht,Qe,re){(function(le,$){ht.exports=$()})(this,function(){"use strict";var le=navigator.userAgent,$=navigator.platform,R=/gecko\/\d/i.test(le),Z=/MSIE \d/.test(le),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),P=/Edge\/(\d+)/.exec(le),K=Z||B||P,U=K&&(Z?document.documentMode||6:+(P||B)[1]),N=!P&&/WebKit\//.test(le),D=N&&/Qt\/\d+\.\d+/.test(le),b=!P&&/Chrome\//.test(le),A=/Opera\//.test(le),k=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),C=/PhantomJS/.test(le),E=!P&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),d=/Android/.test(le),a=E||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),l=E||/Mac/.test($),h=/\bCrOS\b/.test(le),_=/win/i.test($),g=A&&le.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(A=!1,N=!0);var m=l&&(D||A&&(g==null||g<12.11)),L=R||K&&U>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=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 f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return f(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 w=0;w<t.length;++w)n.appendChild(t[w]);return n}function x(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var v;document.createRange?v=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:v=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 S(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 M(){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()};E?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(V=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function X(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var w=r||0,W=n||0;;){var Y=e.indexOf(" ",w);if(Y<0||Y>=t)return W+(t-w);W+=Y-w,W+=i-W%i,w=Y+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var ce=50,Le={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},we={origin:"*mouse"},Te={origin:"+move"};function ye(e,t,i){for(var r=0,n=0;;){var w=e.indexOf(" ",r);w==-1&&(w=e.length);var W=w-r;if(w==e.length||n+W>=t)return r+Math.min(W,t-n);if(n+=w-r,n+=i-n%i,r=w+1,n>=t)return r}}var fe=[""];function se(e){for(;fe.length<=e;)fe.push(te(fe)+" ");return fe[e]}function te(e){return e[e.length-1]}function ue(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ne(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function _e(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(_e.prototype=e,i=new _e),t&&I(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ke(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Ne(e,t){return t?t.source.indexOf("\\w")>-1&&ke(e)?!0:t.test(e):ke(e)}function He(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Me(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Oe(e,t,i){for(;(i<0?t>0:t<e.length)&&Me(e.charAt(t));)t+=i;return t}function Ye(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,w=r<0?Math.ceil(n):Math.floor(n);if(w==t)return e(w)?t:i;e(w)?i=w:t=w+r}}function Ze(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,w=0;w<e.length;++w){var W=e[w];(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",w),n=!0)}n||r(t,i,"ltr")}var Ve=null;function je(e,t,i){var r;Ve=null;for(var n=0;n<e.length;++n){var w=e[n];if(w.from<t&&w.to>t)return n;w.to==t&&(w.from!=w.to&&i=="before"?r=n:Ve=n),w.from==t&&(w.from!=w.to&&i!="before"?r=n:Ve=n)}return r!=null?r:Ve}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,w=/[LRr]/,W=/[Lb1n]/,Y=/[1n]/;function J(ee,he,pe){this.level=ee,this.from=he,this.to=pe}return function(ee,he){var pe=he=="ltr"?"L":"R";if(ee.length==0||he=="ltr"&&!r.test(ee))return!1;for(var De=ee.length,Ae=[],Ue=0;Ue<De;++Ue)Ae.push(i(ee.charCodeAt(Ue)));for(var Ke=0,qe=pe;Ke<De;++Ke){var it=Ae[Ke];it=="m"?Ae[Ke]=qe:qe=it}for(var st=0,nt=pe;st<De;++st){var ut=Ae[st];ut=="1"&&nt=="r"?Ae[st]="n":w.test(ut)&&(nt=ut,ut=="r"&&(Ae[st]="R"))}for(var xt=1,vt=Ae[0];xt<De-1;++xt){var _t=Ae[xt];_t=="+"&&vt=="1"&&Ae[xt+1]=="1"?Ae[xt]="1":_t==","&&vt==Ae[xt+1]&&(vt=="1"||vt=="n")&&(Ae[xt]=vt),vt=_t}for(var Gt=0;Gt<De;++Gt){var lr=Ae[Gt];if(lr==",")Ae[Gt]="N";else if(lr=="%"){var Yt=void 0;for(Yt=Gt+1;Yt<De&&Ae[Yt]=="%";++Yt);for(var Mr=Gt&&Ae[Gt-1]=="!"||Yt<De&&Ae[Yt]=="1"?"1":"N",Lr=Gt;Lr<Yt;++Lr)Ae[Lr]=Mr;Gt=Yt-1}}for(var er=0,Dr=pe;er<De;++er){var fr=Ae[er];Dr=="L"&&fr=="1"?Ae[er]="L":w.test(fr)&&(Dr=fr)}for(var ir=0;ir<De;++ir)if(n.test(Ae[ir])){var tr=void 0;for(tr=ir+1;tr<De&&n.test(Ae[tr]);++tr);for(var $t=(ir?Ae[ir-1]:pe)=="L",Rr=(tr<De?Ae[tr]:pe)=="L",un=$t==Rr?$t?"L":"R":pe,Ri=ir;Ri<tr;++Ri)Ae[Ri]=un;ir=tr-1}for(var Er=[],ai,ur=0;ur<De;)if(W.test(Ae[ur])){var Va=ur;for(++ur;ur<De&&W.test(Ae[ur]);++ur);Er.push(new J(0,Va,ur))}else{var hi=ur,Hi=Er.length,zi=he=="rtl"?1:0;for(++ur;ur<De&&Ae[ur]!="L";++ur);for(var Cr=hi;Cr<ur;)if(Y.test(Ae[Cr])){hi<Cr&&(Er.splice(Hi,0,new J(1,hi,Cr)),Hi+=zi);var dn=Cr;for(++Cr;Cr<ur&&Y.test(Ae[Cr]);++Cr);Er.splice(Hi,0,new J(2,dn,Cr)),Hi+=zi,hi=Cr}else++Cr;hi<ur&&Er.splice(Hi,0,new J(1,hi,ur))}return he=="ltr"&&(Er[0].level==1&&(ai=ee.match(/^\s+/))&&(Er[0].from=ai[0].length,Er.unshift(new J(0,0,ai[0].length))),te(Er).level==1&&(ai=ee.match(/\s+$/))&&(te(Er).to-=ai[0].length,Er.push(new J(0,De-ai[0].length,De)))),he=="rtl"?Er.reverse():Er}}();function Je(e,t){var i=e.order;return i==null&&(i=e.order=rt(e.text,t)),i}var tt=[],Pe=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||tt).concat(i)}};function lt(e,t){return e._handlers&&e._handlers[t]||tt}function at(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var w=oe(n,i);w>-1&&(r[t]=n.slice(0,w).concat(n.slice(w+1)))}}}function Be(e,t){var i=lt(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 Xe(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Be(e,i||t.type,e,t),de(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(i,t[r])==-1&&i.push(t[r])}function ve(e,t){return lt(e,t).length>0}function be(e){e.prototype.on=function(t,i){Pe(this,t,i)},e.prototype.off=function(t,i){at(this,t,i)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){ie(e),ae(e)}function Se(e){return e.target||e.srcElement}function Ie(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 ze=function(){if(K&&U<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),ot;function gt(e){if(ot==null){var t=o("span","\u200B");u(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ot=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&U<8))}var i=ot?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var pt;function wt(e){if(pt!=null)return pt;var t=u(e,document.createTextNode("A\u062EA")),i=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return f(e),!i||i.left==i.right?!1:pt=r.right-i.right<3}var Ct=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var w=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),W=w.indexOf("\r");W!=-1?(i.push(w.slice(0,W)),t+=W+1):(i.push(w),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},dt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Bt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ot=null;function Zt(e){if(Ot!=null)return Ot;var t=u(e,o("span","x")),i=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Ot=Math.abs(i.left-r.left)>1}var Xt={},kt={};function Ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Xt[e]=t}function Kr(e,t){kt[e]=t}function Et(e){if(typeof e=="string"&&kt.hasOwnProperty(e))e=kt[e];else if(e&&typeof e.name=="string"&&kt.hasOwnProperty(e.name)){var t=kt[e.name];typeof t=="string"&&(t={name:t}),e=Re(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Et("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Et("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Nr(e,t){t=Et(t);var i=Xt[t.name];if(!i)return Nr(e,"text/plain");var r=i(e,t);if(dr.hasOwnProperty(t.name)){var n=dr[t.name];for(var w in n){if(!n.hasOwnProperty(w))continue;r.hasOwnProperty(w)&&(r["_"+w]=r[w]),r[w]=n[w]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var dr={};function pr(e,t){var i=dr.hasOwnProperty(e)?dr[e]:dr[e]={};I(t,i)}function Fr(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 ci(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 qr(e,t,i){return e.startState?e.startState(t,i):!0}var It=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(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 w=this.string.slice(this.pos).match(e);return w&&w.index>0?null:(w&&t!==!1&&(this.pos+=w[0].length),w)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ct(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],w=n.chunkSize();if(t<w){i=n;break}t-=w}return i.lines[t]}function Hr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(w){var W=w.text;n==i.line&&(W=W.slice(0,i.ch)),n==t.line&&(W=W.slice(t.ch)),r.push(W),++n}),r}function ei(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function mr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Br(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],w=n.height;if(t<w){e=n;continue e}t-=w,i+=n.chunkSize()}return i}while(!e.lines);for(var W=0;W<e.lines.length;++W){var Y=e.lines[W],J=Y.height;if(t<J)break;t-=J}return i+W}function Vr(e,t){return t>=e.first&&t<e.first+e.size}function fi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function $e(e,t,i){if(i===void 0&&(i=null),!(this instanceof $e))return new $e(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function pi(e,t){return e.sticky==t.sticky&&St(e,t)==0}function mi(e){return $e(e.line,e.ch)}function gi(e,t){return St(e,t)<0?t:e}function vi(e,t){return St(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return $e(e.first,0);var i=e.first+e.size-1;return t.line>i?$e(i,ct(e,i).text.length):p(t,ct(e,t.line).text.length)}function p(e,t){var i=e.ch;return i==null||i>t?$e(e.line,t):i<0?$e(e.line,0):e}function F(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var Q=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof Q?new H(e,Fr(e.mode,t.state),i,t.lookAhead):new H(e,Fr(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?Fr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function ge(e,t,i,r){var n=[e.state.modeGen],w={};gr(e,t.text,e.doc.mode,i,function(ee,he){return n.push(ee,he)},w,r);for(var W=i.state,Y=function(ee){i.baseTokens=n;var he=e.state.overlays[ee],pe=1,De=0;i.state=!0,gr(e,t.text,he.mode,i,function(Ae,Ue){for(var Ke=pe;De<Ae;){var qe=n[pe];qe>Ae&&n.splice(pe,1,Ae,n[pe+1],qe),pe+=2,De=Math.min(Ae,qe)}if(!Ue)return;if(he.opaque)n.splice(Ke,pe-Ke,Ae,"overlay "+Ue),pe=Ke+2;else for(;Ke<pe;Ke+=2){var it=n[Ke+1];n[Ke+1]=(it?it+" ":"")+"overlay "+Ue}},w),i.state=W,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:n,classes:w.bgClass||w.textClass?w:null}}function We(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=et(e,Lt(t)),n=t.text.length>e.options.maxHighlightLength&&Fr(e.doc.mode,r.state),w=ge(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=w.styles,w.classes?t.styleClasses=w.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function et(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var w=vr(e,t,i),W=w>r.first&&ct(r,w-1).stateAfter,Y=W?H.fromSaved(r,W,w):new H(r,qr(r.mode),w);return r.iter(w,t,function(J){ft(e,J.text,Y);var ee=Y.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&ee<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function ft(e,t,i,r){var n=e.doc.mode,w=new It(t,e.options.tabSize,i);for(w.start=w.pos=r||0,t==""&&Ge(n,i.state);!w.eol();)yt(n,w,i.state),w.start=w.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=ci(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function yt(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=ci(e,i).mode);var w=e.token(t,i);if(t.pos>t.start)return w}throw new Error("Mode "+e.name+" failed to advance stream.")}var Nt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Kt(e,t,i,r){var n=e.doc,w=n.mode,W;t=s(n,t);var Y=ct(n,t.line),J=et(e,t.line,i),ee=new It(Y.text,e.options.tabSize,J),he;for(r&&(he=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,W=yt(w,ee,J.state),r&&he.push(new Nt(ee,W,Fr(n.mode,J.state)));return r?he:new Nt(ee,W,J.state)}function kr(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 gr(e,t,i,r,n,w,W){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,ee=null,he=new It(t,e.options.tabSize,r),pe,De=e.options.addModeClass&&[null];for(t==""&&kr(Ge(i,r.state),w);!he.eol();){if(he.pos>e.options.maxHighlightLength?(Y=!1,W&&ft(e,t,r,he.pos),he.pos=t.length,pe=null):pe=kr(yt(i,he,r.state,De),w),De){var Ae=De[0].name;Ae&&(pe="m-"+(pe?Ae+" "+pe:Ae))}if(!Y||ee!=pe){for(;J<he.start;)J=Math.min(he.start,J+5e3),n(J,ee);ee=pe}he.start=he.pos}for(;J<he.pos;){var Ue=Math.min(he.pos,J+5e3);n(Ue,ee),J=Ue}}function vr(e,t,i){for(var r,n,w=e.doc,W=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>W;--Y){if(Y<=w.first)return w.first;var J=ct(w,Y-1),ee=J.stateAfter;if(ee&&(!i||Y+(ee instanceof Q?ee.lookAhead:0)<=w.modeFrontier))return Y;var he=X(J.text,null,e.options.tabSize);(n==null||r>he)&&(n=Y-1,r=he)}return n}function Xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=ct(e,r).stateAfter;if(n&&(!(n instanceof Q)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var ki=!1,nr=!1;function Ur(){ki=!0}function oi(){nr=!0}function si(e,t,i){this.marker=e,this.from=t,this.to=i}function Or(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Oi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function yi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Gi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var w=e[n],W=w.marker,Y=w.from==null||(W.inclusiveLeft?w.from<=t:w.from<t);if(Y||w.from==t&&W.type=="bookmark"&&(!i||!w.marker.insertLeft)){var J=w.to==null||(W.inclusiveRight?w.to>=t:w.to>t);(r||(r=[])).push(new si(W,w.from,J?null:w.to))}}return r}function Ki(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var w=e[n],W=w.marker,Y=w.to==null||(W.inclusiveRight?w.to>=t:w.to>t);if(Y||w.from==t&&W.type=="bookmark"&&(!i||w.marker.insertLeft)){var J=w.from==null||(W.inclusiveLeft?w.from<=t:w.from<t);(r||(r=[])).push(new si(W,J?null:w.from-t,w.to==null?null:w.to-t))}}return r}function Yr(e,t){if(t.full)return null;var i=Vr(e,t.from.line)&&ct(e,t.from.line).markedSpans,r=Vr(e,t.to.line)&&ct(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,w=t.to.ch,W=St(t.from,t.to)==0,Y=Gi(i,n,W),J=Ki(r,w,W),ee=t.text.length==1,he=te(t.text).length+(ee?n:0);if(Y)for(var pe=0;pe<Y.length;++pe){var De=Y[pe];if(De.to==null){var Ae=Or(J,De.marker);Ae?ee&&(De.to=Ae.to==null?null:Ae.to+he):De.to=n}}if(J)for(var Ue=0;Ue<J.length;++Ue){var Ke=J[Ue];if(Ke.to!=null&&(Ke.to+=he),Ke.from==null){var qe=Or(Y,Ke.marker);qe||(Ke.from=he,ee&&(Y||(Y=[])).push(Ke))}else Ke.from+=he,ee&&(Y||(Y=[])).push(Ke)}Y&&(Y=zr(Y)),J&&J!=Y&&(J=zr(J));var it=[Y];if(!ee){var st=t.text.length-2,nt;if(st>0&&Y)for(var ut=0;ut<Y.length;++ut)Y[ut].to==null&&(nt||(nt=[])).push(new si(Y[ut].marker,null,null));for(var xt=0;xt<st;++xt)it.push(nt);it.push(J)}return it}function zr(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 bi(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ae){if(Ae.markedSpans)for(var Ue=0;Ue<Ae.markedSpans.length;++Ue){var Ke=Ae.markedSpans[Ue].marker;Ke.readOnly&&(!r||oe(r,Ke)==-1)&&(r||(r=[])).push(Ke)}}),!r)return null;for(var n=[{from:t,to:i}],w=0;w<r.length;++w)for(var W=r[w],Y=W.find(0),J=0;J<n.length;++J){var ee=n[J];if(St(ee.to,Y.from)<0||St(ee.from,Y.to)>0)continue;var he=[J,1],pe=St(ee.from,Y.from),De=St(ee.to,Y.to);(pe<0||!W.inclusiveLeft&&!pe)&&he.push({from:ee.from,to:Y.from}),(De>0||!W.inclusiveRight&&!De)&&he.push({from:Y.to,to:ee.to}),n.splice.apply(n,he),J+=he.length-3}return n}function hn(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 Ei(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Jt(e){return e.inclusiveLeft?-1:0}function Ft(e){return e.inclusiveRight?1:0}function hr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),w=St(r.from,n.from)||Jt(e)-Jt(t);if(w)return-w;var W=St(r.to,n.to)||Ft(e)-Ft(t);return W||t.id-e.id}function Dt(e,t){var i=nr&&e.markedSpans,r;if(i)for(var n=void 0,w=0;w<i.length;++w)n=i[w],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||hr(r,n.marker)<0)&&(r=n.marker);return r}function qt(e){return Dt(e,!0)}function Wt(e){return Dt(e,!1)}function ti(e,t){var i=nr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var w=i[n];w.marker.collapsed&&(w.from==null||w.from<t)&&(w.to==null||w.to>t)&&(!r||hr(r,w.marker)<0)&&(r=w.marker)}return r}function ar(e,t,i,r,n){var w=ct(e,t),W=nr&&w.markedSpans;if(W)for(var Y=0;Y<W.length;++Y){var J=W[Y];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),he=St(ee.from,i)||Jt(J.marker)-Jt(n),pe=St(ee.to,r)||Ft(J.marker)-Ft(n);if(he>=0&&pe<=0||he<=0&&pe>=0)continue;if(he<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.to,i)>=0:St(ee.to,i)>0)||he>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.from,r)<=0:St(ee.from,r)<0))return!0}}function xr(e){for(var t;t=qt(e);)e=t.find(-1,!0).line;return e}function Vi(e){for(var t;t=Wt(e);)e=t.find(1,!0).line;return e}function xi(e){for(var t,i;t=Wt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function cn(e,t){var i=ct(e,t),r=xr(i);return i==r?t:Lt(r)}function Si(e,t){if(t>e.lastLine())return t;var i=ct(e,t),r;if(!ri(e,i))return t;for(;r=Wt(i);)i=r.find(1,!0).line;return Lt(i)+1}function ri(e,t){var i=nr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Or(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,w=0;w<t.markedSpans.length;++w)if(n=t.markedSpans[w],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function $r(e){e=xr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var w=i.parent;w;i=w,w=i.parent)for(var W=0;W<w.children.length;++W){var Y=w.children[W];if(Y==i)break;t+=Y.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=qt(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Wt(r);){var w=i.find(0,!0);t-=r.text.length-w.from.ch,r=w.to.line,t+=r.text.length-w.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=ct(i,i.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=pn(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Pi=function(e,t,i){this.text=e,Ei(this,t),this.height=i?i(this):1};Pi.prototype.lineNo=function(){return Lt(this)},be(Pi);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),hn(e),Ei(e,i);var n=r?r(e):1;n!=e.height&&mr(e,n)}function mt(e){e.parent=null,hn(e)}var Tt={},bt={};function At(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?bt:Tt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Mt(e,t){var i=x("span",null,null,N?"padding-right: .1px":null),r={pre:x("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var w=n?t.rest[n-1]:t.line,W=void 0;r.pos=0,r.addToken=Pt,wt(e.display.measure)&&(W=Je(w,e.doc.direction))&&(r.addToken=Tr(r.addToken,W)),r.map=[];var Y=t!=e.display.externalMeasured&&Lt(w);li(w,r,We(e,w,Y)),w.styleClasses&&(w.styleClasses.bgClass&&(r.bgClass=G(w.styleClasses.bgClass,r.bgClass||"")),w.styleClasses.textClass&&(r.textClass=G(w.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(gt(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 J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=G(r.pre.className,r.textClass||"")),r}function zt(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 Pt(e,t,i,r,n,w,W){if(!t)return;var Y=e.splitSpaces?rr(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,he;if(!J.test(t))e.col+=t.length,he=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,he),K&&U<9&&(ee=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var pe=0;;){J.lastIndex=pe;var De=J.exec(t),Ae=De?De.index-pe:t.length-pe;if(Ae){var Ue=document.createTextNode(Y.slice(pe,pe+Ae));K&&U<9?he.appendChild(o("span",[Ue])):he.appendChild(Ue),e.map.push(e.pos,e.pos+Ae,Ue),e.col+=Ae,e.pos+=Ae}if(!De)break;pe+=Ae+1;var Ke=void 0;if(De[0]==" "){var qe=e.cm.options.tabSize,it=qe-e.col%qe;Ke=he.appendChild(o("span",se(it),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=it}else De[0]=="\r"||De[0]==`
`?(Ke=he.appendChild(o("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",De[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(De[0]),Ke.setAttribute("cm-text",De[0]),K&&U<9?he.appendChild(o("span",[Ke])):he.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||ee||w||W){var st=i||"";r&&(st+=r),n&&(st+=n);var nt=o("span",[he],st,w);if(W)for(var ut in W)W.hasOwnProperty(ut)&&ut!="style"&&ut!="class"&&nt.setAttribute(ut,W[ut]);return e.content.appendChild(nt)}e.content.appendChild(he)}function rr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var w=e.charAt(n);w==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(w="\xA0"),r+=w,i=w==" "}return r}function Tr(e,t){return function(i,r,n,w,W,Y,J){n=n?n+" cm-force-border":"cm-force-border";for(var ee=i.pos,he=ee+r.length;;){for(var pe=void 0,De=0;De<t.length&&!(pe=t[De],pe.to>ee&&pe.from<=ee);De++);if(pe.to>=he)return e(i,r,n,w,W,Y,J);e(i,r.slice(0,pe.to-ee),n,w,null,Y,J),w=null,r=r.slice(pe.to-ee),ee=pe.to}}}function Rt(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 li(e,t,i){var r=e.markedSpans,n=e.text,w=0;if(!r){for(var W=1;W<i.length;W+=2)t.addToken(t,n.slice(w,w=i[W]),At(i[W+1],t.cm.options));return}for(var Y=n.length,J=0,ee=1,he="",pe,De,Ae=0,Ue,Ke,qe,it,st;;){if(Ae==J){Ue=Ke=qe=De="",st=null,it=null,Ae=Infinity;for(var nt=[],ut=void 0,xt=0;xt<r.length;++xt){var vt=r[xt],_t=vt.marker;if(_t.type=="bookmark"&&vt.from==J&&_t.widgetNode)nt.push(_t);else if(vt.from<=J&&(vt.to==null||vt.to>J||_t.collapsed&&vt.to==J&&vt.from==J)){if(vt.to!=null&&vt.to!=J&&Ae>vt.to&&(Ae=vt.to,Ke=""),_t.className&&(Ue+=" "+_t.className),_t.css&&(De=(De?De+";":"")+_t.css),_t.startStyle&&vt.from==J&&(qe+=" "+_t.startStyle),_t.endStyle&&vt.to==Ae&&(ut||(ut=[])).push(_t.endStyle,vt.to),_t.title&&((st||(st={})).title=_t.title),_t.attributes)for(var Gt in _t.attributes)(st||(st={}))[Gt]=_t.attributes[Gt];_t.collapsed&&(!it||hr(it.marker,_t)<0)&&(it=vt)}else vt.from>J&&Ae>vt.from&&(Ae=vt.from)}if(ut)for(var lr=0;lr<ut.length;lr+=2)ut[lr+1]==Ae&&(Ke+=" "+ut[lr]);if(!it||it.from==J)for(var Yt=0;Yt<nt.length;++Yt)Rt(t,0,nt[Yt]);if(it&&(it.from||0)==J){if(Rt(t,(it.to==null?Y+1:it.to)-J,it.marker,it.from==null),it.to==null)return;it.to==J&&(it=!1)}}if(J>=Y)break;for(var Mr=Math.min(Y,Ae);;){if(he){var Lr=J+he.length;if(!it){var er=Lr>Mr?he.slice(0,Mr-J):he;t.addToken(t,er,pe?pe+Ue:Ue,qe,J+er.length==Ae?Ke:"",De,st)}if(Lr>=Mr){he=he.slice(Mr-J),J=Mr;break}J=Lr,qe=""}he=n.slice(w,w=i[ee++]),pe=At(i[ee++],t.cm.options)}}}function Ut(e,t,i){this.line=t,this.rest=xi(t),this.size=this.rest?Lt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ri(e,t)}function wr(e,t,i){for(var r=[],n,w=t;w<i;w=n){var W=new Ut(e.doc,ct(e.doc,w),w);n=w+W.size,r.push(W)}return r}var yr=null;function Gr(e){yr?yr.ops.push(e):e.ownsGroup=yr={ops:[e],delayedCallbacks:[]}}function Rs(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 ks(e,t){var i=e.ownsGroup;if(!i)return;try{Rs(i)}finally{yr=null,t(i)}}var mn=null;function cr(e,t){var i=lt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;yr?n=yr.delayedCallbacks:mn?n=mn:(n=mn=[],setTimeout(Os,0));for(var w=function(Y){n.push(function(){return i[Y].apply(null,r)})},W=0;W<i.length;++W)w(W)}function Os(){var e=mn;mn=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 w=t.changes[n];w=="text"?Ms(e,t):w=="gutter"?Za(e,t,i,r):w=="class"?da(e,t):w=="widget"&&Is(e,t,r)}t.changes=null}function gn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&U<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=gn(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):Mt(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?gn(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 Za(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=gn(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 w=t.line.gutterMarkers;if(e.options.lineNumbers||w){var W=gn(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&&(!w||!w["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(o("div",fi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),w)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,he=w.hasOwnProperty(ee)&&w[ee];he&&Y.appendChild(o("div",[he],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),n=t.node.firstChild,w=void 0;n;n=w)w=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Ja(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),Za(e,t,i,r),Ja(e,t,r),t.node}function Ja(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 w=gn(i),W=0,Y=t.widgets;W<Y.length;++W){var J=Y[W],ee=o("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Fs(J,ee,i,r),e.display.input.setUneditable(ee),n&&J.above?w.insertBefore(ee,i.gutter||i.text):w.appendChild(ee),cr(J,"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 vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(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 ui(e,t){for(var i=Se(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Wn(e){return e.lineSpace.offsetTop}function 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 ii(e){return ce-e.display.nativeBarWidth}function Mi(e){return e.display.scroller.clientWidth-ii(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-ii(e)-e.display.barHeight}function Bs(e,t,i){var r=e.options.lineWrapping,n=r&&Mi(e);if(!t.measure.heights||r&&t.measure.width!=n){var w=t.measure.heights=[];if(r){t.measure.width=n;for(var W=t.text.firstChild.getClientRects(),Y=0;Y<W.length-1;Y++){var J=W[Y],ee=W[Y+1];Math.abs(J.bottom-ee.bottom)>2&&w.push((J.bottom+ee.top)/2-i.top)}}w.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(Lt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=xr(t);var i=Lt(t),r=e.display.externalMeasured=new Ut(e.doc,t,i);r.lineN=i;var n=r.built=Mt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return ni(e,Xi(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Lt(t),r=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 ni(e,t,i,r,n){t.before&&(i=-1);var w=i+(r||""),W;return t.cache.hasOwnProperty(w)?W=t.cache[w]:(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[w]=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,w,W,Y,J,ee=0;ee<e.length;ee+=3)if(Y=e[ee],J=e[ee+1],t<Y?(n=0,w=1,W="left"):t<J?(n=t-Y,w=n+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(w=J-Y,n=w-1,t>=J&&(W="right")),n!=null){if(r=e[ee+2],Y==J&&i==(r.insertLeft?"left":"right")&&(W=i),i=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],W="left";if(i=="right"&&n==J-Y)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],W="right";break}return{node:r,start:n,end:w,collapse:W,coverStart:Y,coverEnd:J}}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),w=n.node,W=n.start,Y=n.end,J=n.collapse,ee;if(w.nodeType==3){for(var he=0;he<4;he++){for(;W&&Me(t.line.text.charAt(n.coverStart+W));)--W;for(;n.coverStart+Y<n.coverEnd&&Me(t.line.text.charAt(n.coverStart+Y));)++Y;if(K&&U<9&&W==0&&Y==n.coverEnd-n.coverStart?ee=w.parentNode.getBoundingClientRect():ee=js(v(w,W,Y).getClientRects(),r),ee.left||ee.right||W==0)break;Y=W,W=W-1,J="right"}K&&U<11&&(ee=Hs(e.display.measure,ee))}else{W>0&&(J=r="right");var pe;e.options.lineWrapping&&(pe=w.getClientRects()).length>1?ee=pe[r=="right"?pe.length-1:0]:ee=w.getBoundingClientRect()}if(K&&U<9&&!W&&(!ee||!ee.left&&!ee.right)){var De=w.parentNode.getClientRects()[0];De?ee={left:De.left,right:De.left+$i(e.display),top:De.top,bottom:De.bottom}:ee=ro}for(var Ae=ee.top-t.rect.top,Ue=ee.bottom-t.rect.top,Ke=(Ae+Ue)/2,qe=t.view.measure.heights,it=0;it<qe.length-1&&!(Ke<qe[it]);it++);var st=it?qe[it-1]:0,nt=qe[it],ut={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:st,bottom:nt};return!ee.left&&!ee.right&&(ut.bogus=!0),e.options.singleCursorHeightPerLine||(ut.rtop=Ae,ut.rbottom=Ue),ut}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Zt(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,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function yn(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&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&d?-(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+=vn(e.widgets[i]));return t}function Hn(e,t,i,r,n){if(!n){var w=pa(t);i.top+=w,i.bottom+=w}if(r=="line")return i;r||(r="local");var W=$r(t);if(r=="local"?W+=Wn(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();W+=Y.top+(r=="window"?0:so());var J=Y.left+(r=="window"?0:oo());i.left+=J,i.right+=J}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 w=e.display.sizer.getBoundingClientRect();r+=w.left,n+=w.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=ct(e.doc,t.line)),Hn(e,r,to(e,r,t.ch,n),i)}function Zr(e,t,i,r,n,w){r=r||ct(e.doc,t.line),n||(n=Xi(e,r));function W(Ue,Ke){var qe=ni(e,n,Ue,Ke?"right":"left",w);return Ke?qe.left=qe.right:qe.right=qe.left,Hn(e,r,qe,i)}var Y=Je(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!Y)return W(ee=="before"?J-1:J,ee=="before");function he(Ue,Ke,qe){var it=Y[Ke],st=it.level==1;return W(qe?Ue-1:Ue,st!=qe)}var pe=je(Y,J,ee),De=Ve,Ae=he(J,pe,ee=="before");return De!=null&&(Ae.other=he(J,De,ee!="before")),Ae}function uo(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=ct(e.doc,t.line),n=$r(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var w=$e(e,t,i);return w.xRel=n,r&&(w.outside=r),w}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=Br(r,i),w=r.first+r.size-1;if(n>w)return ga(r.first+r.size-1,ct(r,w).text.length,null,1,1);t<0&&(t=0);for(var W=ct(r,n);;){var Y=zs(e,W,n,t,i),J=ti(W,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var ee=J.find(1);if(ee.line==n)return ee;W=ct(r,n=ee.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,w=Ye(function(W){return ni(e,i,W-1).bottom<=r},n,0);return n=Ye(function(W){return ni(e,i,W).top>r},w,n),{begin:w,end:n}}function co(e,t,i,r){i||(i=Xi(e,t));var n=Hn(e,t,ni(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-=$r(t);var w=Xi(e,t),W=pa(t),Y=0,J=t.text.length,ee=!0,he=Je(t,e.doc.direction);if(he){var pe=(e.options.lineWrapping?Ks:Gs)(e,t,i,w,he,r,n);ee=pe.level!=1,Y=ee?pe.from:pe.to-1,J=ee?pe.to:pe.from-1}var De=null,Ae=null,Ue=Ye(function(xt){var vt=ni(e,w,xt);return vt.top+=W,vt.bottom+=W,ya(vt,r,n,!1)?(vt.top<=n&&vt.left<=r&&(De=xt,Ae=vt),!0):!1},Y,J),Ke,qe,it=!1;if(Ae){var st=r-Ae.left<Ae.right-r,nt=st==ee;Ue=De+(nt?0:1),qe=nt?"after":"before",Ke=st?Ae.left:Ae.right}else{!ee&&(Ue==J||Ue==Y)&&Ue++,qe=Ue==0?"after":Ue==t.text.length?"before":ni(e,w,Ue-(ee?1:0)).bottom+W<=n==ee?"after":"before";var ut=Zr(e,$e(i,Ue,qe),"line",t,w);Ke=ut.left,it=n<ut.top?-1:n>=ut.bottom?1:0}return Ue=Oe(t.text,Ue,1),ga(i,Ue,qe,it,r-Ke)}function Gs(e,t,i,r,n,w,W){var Y=Ye(function(pe){var De=n[pe],Ae=De.level!=1;return ya(Zr(e,$e(i,Ae?De.to:De.from,Ae?"before":"after"),"line",t,r),w,W,!0)},0,n.length-1),J=n[Y];if(Y>0){var ee=J.level!=1,he=Zr(e,$e(i,ee?J.from:J.to,ee?"after":"before"),"line",t,r);ya(he,w,W,!0)&&he.top>W&&(J=n[Y-1])}return J}function Ks(e,t,i,r,n,w,W){var Y=ho(e,t,r,W),J=Y.begin,ee=Y.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var he=null,pe=null,De=0;De<n.length;De++){var Ae=n[De];if(Ae.from>=ee||Ae.to<=J)continue;var Ue=Ae.level!=1,Ke=ni(e,r,Ue?Math.min(ee,Ae.to)-1:Math.max(J,Ae.from)).right,qe=Ke<w?w-Ke+1e9:Ke-w;(!he||pe>qe)&&(he=Ae,pe=qe)}return he||(he=n[n.length-1]),he.from<J&&(he={from:J,to:he.to,level:he.level}),he.to>ee&&(he={from:he.from,to:ee,level:he.level}),he}var Ii;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ii==null){Ii=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ii.appendChild(document.createTextNode("x")),Ii.appendChild(o("br"));Ii.appendChild(document.createTextNode("x"))}u(e.measure,Ii);var i=Ii.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),f(e.measure),i||1}function $i(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,w=t.gutters.firstChild,W=0;w;w=w.nextSibling,++W){var Y=e.display.gutterSpecs[W].className;i[Y]=w.offsetLeft+w.clientLeft+n,r[Y]=w.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(ri(e.doc,n))return 0;var w=0;if(n.widgets)for(var W=0;W<n.widgets.length;W++)n.widgets[W].height&&(w+=n.widgets[W].height);return i?w+(Math.ceil(n.text.length/r)||1)*t:w+t}}function xa(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&mr(r,n)})}function Ni(e,t,i,r){var n=e.display;if(!i&&Se(t).getAttribute("cm-not-content")=="true")return null;var w,W,Y=n.lineSpace.getBoundingClientRect();try{w=t.clientX-Y.left,W=t.clientY-Y.top}catch(pe){return null}var J=va(e,w,W),ee;if(r&&J.xRel>0&&(ee=ct(e.doc,J.line).text).length==J.ch){var he=X(ee,ee.length,e.options.tabSize)-ee.length;J=$e(J.line,Math.max(0,Math.round((w-qa(e.display).left)/$i(e.display))-he))}return J}function Fi(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 _r(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)nr&&cn(e.doc,t)<n.viewTo&&Ti(e);else if(i<=n.viewFrom)nr&&Si(e.doc,i+r)>n.viewFrom?Ti(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ti(e);else if(t<=n.viewFrom){var w=zn(e,i,i+r,1);w?(n.view=n.view.slice(w.index),n.viewFrom=w.lineN,n.viewTo+=r):Ti(e)}else if(i>=n.viewTo){var W=zn(e,t,t,-1);W?(n.view=n.view.slice(0,W.index),n.viewTo=W.lineN):Ti(e)}else{var Y=zn(e,t,t,-1),J=zn(e,i,i+r,1);Y&&J?(n.view=n.view.slice(0,Y.index).concat(wr(e,Y.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Ti(e)}var ee=n.externalMeasured;ee&&(i<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.size&&(n.externalMeasured=null))}function Ci(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var w=r.view[Fi(e,t)];if(w.node==null)return;var W=w.changes||(w.changes=[]);oe(W,i)==-1&&W.push(i)}function Ti(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Fi(e,t),w,W=e.display.view;if(!nr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,J=0;J<n;J++)Y+=W[J].size;if(Y!=t){if(r>0){if(n==W.length-1)return null;w=Y+W[n].size-t,n++}else w=Y-t;t+=w,i+=w}for(;cn(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=wr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=wr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Fi(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(wr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Fi(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 bn(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(),w=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 J=Y.empty();(J||e.options.showCursorWhenSelecting)&&go(e,Y.head,n),J||Xs(e,Y,w)}return r}function go(e,t,i){var r=Zr(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 w=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));w.style.display="",w.style.left=r.other.left+"px",w.style.top=r.other.top+"px",w.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,w=document.createDocumentFragment(),W=qa(e.display),Y=W.left,J=Math.max(r.sizerWidth,Mi(e)-r.sizer.offsetLeft)-W.right,ee=n.direction=="ltr";function he(nt,ut,xt,vt){ut<0&&(ut=0),ut=Math.round(ut),vt=Math.round(vt),w.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
top: `+ut+"px; width: "+(xt==null?J-nt:xt)+`px;
height: `+(vt-ut)+"px"))}function pe(nt,ut,xt){var vt=ct(n,nt),_t=vt.text.length,Gt,lr;function Yt(er,Dr){return ma(e,$e(nt,er),"div",vt,Dr)}function Mr(er,Dr,fr){var ir=co(e,vt,null,er),tr=Dr=="ltr"==(fr=="after")?"left":"right",$t=fr=="after"?ir.begin:ir.end-(/\s/.test(vt.text.charAt(ir.end-1))?2:1);return Yt($t,tr)[tr]}var Lr=Je(vt,n.direction);return Ze(Lr,ut||0,xt==null?_t:xt,function(er,Dr,fr,ir){var tr=fr=="ltr",$t=Yt(er,tr?"left":"right"),Rr=Yt(Dr-1,tr?"right":"left"),un=ut==null&&er==0,Ri=xt==null&&Dr==_t,Er=ir==0,ai=!Lr||ir==Lr.length-1;if(Rr.top-$t.top<=3){var ur=(ee?un:Ri)&&Er,Va=(ee?Ri:un)&&ai,hi=ur?Y:(tr?$t:Rr).left,Hi=Va?J:(tr?Rr:$t).right;he(hi,$t.top,Hi-hi,$t.bottom)}else{var zi,Cr,dn,Xa;tr?(zi=ee&&un&&Er?Y:$t.left,Cr=ee?J:Mr(er,fr,"before"),dn=ee?Y:Mr(Dr,fr,"after"),Xa=ee&&Ri&&ai?J:Rr.right):(zi=ee?Mr(er,fr,"before"):Y,Cr=!ee&&un&&Er?J:$t.right,dn=!ee&&Ri&&ai?Y:Rr.left,Xa=ee?Mr(Dr,fr,"after"):J),he(zi,$t.top,Cr-zi,$t.bottom),$t.bottom<Rr.top&&he(Y,$t.bottom,null,Rr.top),he(dn,Rr.top,Xa-dn,Rr.bottom)}(!Gt||Gn($t,Gt)<0)&&(Gt=$t),Gn(Rr,Gt)<0&&(Gt=Rr),(!lr||Gn($t,lr)<0)&&(lr=$t),Gn(Rr,lr)<0&&(lr=Rr)}),{start:Gt,end:lr}}var De=t.from(),Ae=t.to();if(De.line==Ae.line)pe(De.line,De.ch,Ae.ch);else{var Ue=ct(n,De.line),Ke=ct(n,Ae.line),qe=xr(Ue)==xr(Ke),it=pe(De.line,De.ch,qe?Ue.text.length+1:null).end,st=pe(Ae.line,qe?0:null,Ae.ch).start;qe&&(it.top<st.top-2?(he(it.right,it.top,null,it.bottom),he(Y,st.top,st.left,st.bottom)):he(it.right,it.top,st.left-it.right,it.bottom)),it.bottom<st.top&&he(Y,it.bottom,null,st.top)}i.appendChild(w)}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()||Zi(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,Zi(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Be(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 Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Be(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],w=e.options.lineWrapping,W=void 0,Y=0;if(n.hidden)continue;if(K&&U<8){var J=n.node.offsetTop+n.node.offsetHeight;W=J-i,i=J}else{var ee=n.node.getBoundingClientRect();W=ee.bottom-ee.top,!w&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-ee.left-1)}var he=n.line.height-W;if((he>.005||he<-.005)&&(mr(n.line,W),bo(n.line),n.rest))for(var pe=0;pe<n.rest.length;pe++)bo(n.rest[pe]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/$i(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,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 Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,w=Br(t,r),W=Br(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,J=i.ensure.to.line;Y<w?(w=Y,W=Br(t,$r(ct(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=W&&(w=Br(t,$r(ct(t,J))-e.wrapper.clientHeight),W=J)}return{from:w,to:Math.max(W,w+1)}}function Ys(e,t){if(Xe(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&&!C){var w=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ii(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(w),w.scrollIntoView(n),e.display.lineSpace.removeChild(w)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?$e(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?$e(t.line,t.ch+1,"before"):t);for(var w=0;w<5;w++){var W=!1,Y=Zr(e,t),J=!i||i==t?Y:Zr(e,i);n={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var ee=Ta(e,n),he=e.doc.scrollTop,pe=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xn(e,ee.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(W=!0)),ee.scrollLeft!=null&&(Bi(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-pe)>1&&(W=!0)),!W)break}return n}function Zs(e,t){var i=Ta(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Bi(e,i.scrollLeft)}function Ta(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,w=ca(e),W={};t.bottom-t.top>w&&(t.bottom=t.top+w);var Y=e.doc.height+ha(i),J=t.top<r,ee=t.bottom>Y-r;if(t.top<n)W.scrollTop=J?0:t.top;else if(t.bottom>n+w){var he=Math.min(t.top,(ee?Y:t.bottom)-w);he!=n&&(W.scrollTop=he)}var pe=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-pe,Ae=Mi(e)-i.gutters.offsetWidth,Ue=t.right-t.left>Ae;return Ue&&(t.right=t.left+Ae),t.left<10?W.scrollLeft=0:t.left<De?W.scrollLeft=Math.max(0,t.left+pe-(Ue?0:10)):t.right>Ae+De-3&&(W.scrollLeft=t.right+(Ue?0:10)-Ae),W}function wa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function En(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=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});En(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||Aa(e,{top:t}),xo(e,t,!0),R&&Aa(e),Tn(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 Bi(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 Sn(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+ii(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Ui=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),Pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Pe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ui.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var w=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+w)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Ui.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ui.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ui.prototype.zeroWidthHack=function(){var e=l&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},Ui.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),w=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);w!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Ui.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Cn=function(){};Cn.prototype.update=function(){return{bottom:0,right:0}},Cn.prototype.setScrollLeft=function(){},Cn.prototype.setScrollTop=function(){},Cn.prototype.clear=function(){};function Qi(e,t){t||(t=Sn(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&&Kn(e),So(e,Sn(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:Ui,null:Cn};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(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),Pe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Bi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function ji(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},Gr(e.curOp)}function Wi(e){var t=e.curOp;t&&ks(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var w=0;w<t.length;w++)il(t[w]);for(var W=0;W<t.length;W++)nl(t[W])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(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&&Kn(t),e.barMeasure=Sn(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+ii(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Mi(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&&Bi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&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&&Bi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var w=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(w)for(var Y=0;Y<w.length;++Y)w[Y].lines.length||Be(w[Y],"hide");if(W)for(var J=0;J<W.length;++J)W[J].lines.length&&Be(W[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Pr(e,t){if(e.curOp)return t();ji(e);try{return t()}finally{Wi(e)}}function or(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ji(e);try{return t.apply(e,arguments)}finally{Wi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);ji(this);try{return e.apply(this,arguments)}finally{Wi(this)}}}function sr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ji(t);try{return e.apply(this,arguments)}finally{Wi(t)}}}function Tn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=et(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(w){if(r.line>=e.display.viewFrom){var W=w.styles,Y=w.text.length>e.options.maxHighlightLength?Fr(t.mode,r.state):null,J=ge(e,w,r,!0);Y&&(r.state=Y),w.styles=J.styles;var ee=w.styleClasses,he=J.classes;he?w.styleClasses=he:ee&&(w.styleClasses=null);for(var pe=!W||W.length!=w.styles.length||ee!=he&&(!ee||!he||ee.bgClass!=he.bgClass||ee.textClass!=he.textClass),De=0;!pe&&De<W.length;++De)pe=W[De]!=w.styles[De];pe&&n.push(r.line),w.stateAfter=r.save(),r.nextLine()}else w.text.length<=e.options.maxHighlightLength&&ft(e,w.text,r),w.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Pr(e,function(){for(var w=0;w<n.length;w++)Ci(e,n[w],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mi(e),this.force=i,this.dims=ba(e),this.events=[]};Yn.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Be.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=ii(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ii(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!S(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(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==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(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 Ti(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)&&(Ti(e),t.dims=ba(e));var n=r.first+r.size,w=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<w&&w-i.viewFrom<20&&(w=Math.max(r.first,i.viewFrom)),i.viewTo>W&&i.viewTo-W<20&&(W=Math.min(n,i.viewTo)),nr&&(w=cn(e.doc,w),W=Si(e.doc,W));var Y=w!=i.viewFrom||W!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,w,W),i.viewOffset=$r(ct(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=po(e);if(!Y&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var ee=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(ee),f(i.cursorDiv),f(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Tn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Mi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ha(e.display)-ca(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!_a(e,t))break;Kn(e);var n=Sn(e);bn(e),Qi(e,n),Da(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var i=new Yn(e,t);if(_a(e,i)){Kn(e),wo(e,i);var r=Sn(e);bn(e),Qi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,w=r.lineDiv,W=w.firstChild;function Y(Ue){var Ke=Ue.nextSibling;return N&&l&&e.display.currentWheelTarget==Ue?Ue.style.display="none":Ue.parentNode.removeChild(Ue),Ke}for(var J=r.view,ee=r.viewFrom,he=0;he<J.length;he++){var pe=J[he];if(!pe.hidden)if(!pe.node||pe.node.parentNode!=w){var De=Ns(e,pe,ee,i);w.insertBefore(De,W)}else{for(;W!=pe.node;)W=Y(W);var Ae=n&&t!=null&&t<=ee&&pe.lineNumber;pe.changes&&(oe(pe.changes,"gutter")>-1&&(Ae=!1),Ya(e,pe,ee,i)),Ae&&(f(pe.lineNumber),pe.lineNumber.appendChild(document.createTextNode(fi(e.options,ee)))),W=pe.node.nextSibling}ee+=pe.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+ii(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,w=r+"px",W=0;W<i.length;W++)if(!i[W].hidden){e.options.fixedGutter&&(i[W].gutter&&(i[W].gutter.style.left=w),i[W].gutterBackground&&(i[W].gutterBackground.style.left=w));var Y=i[W].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=w}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=fi(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")),w=n.firstChild.offsetWidth,W=n.offsetWidth-w;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(w,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 Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var w=e[n],W=null;if(typeof w!="string"&&(W=w.style,w=w.className),w=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:w,style:W})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Lo(e){var t=e.gutters,i=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],w=n.className,W=n.style,Y=t.appendChild(o("div",null,"CodeMirror-gutter "+w));W&&(Y.style.cssText=W),w=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",La(e)}function wn(e){Lo(e.display),_r(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=x("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=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var w=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[w],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+ce+"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&&U<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!N&&!(R&&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=Ra(r.gutters,r.lineNumbers),Lo(n),i.init(n)}var $n=0,jr=null;K?jr=-.53:R?jr=15:b?jr=-.7:k&&(jr=-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*=jr,t.y*=jr,t}function Ro(e,t){var i=Do(t),r=i.x,n=i.y,w=e.display,W=w.scroller,Y=W.scrollWidth>W.clientWidth,J=W.scrollHeight>W.clientHeight;if(!(r&&Y||n&&J))return;if(n&&l&&N){e:for(var ee=t.target,he=w.view;ee!=W;ee=ee.parentNode)for(var pe=0;pe<he.length;pe++)if(he[pe].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!R&&!A&&jr!=null){n&&J&&xn(e,Math.max(0,W.scrollTop+n*jr)),Bi(e,Math.max(0,W.scrollLeft+r*jr)),(!n||n&&J)&&ie(t),w.wheelStartX=null;return}if(n&&jr!=null){var De=n*jr,Ae=e.doc.scrollTop,Ue=Ae+w.wrapper.clientHeight;De<0?Ae=Math.max(0,Ae+De-50):Ue=Math.min(e.doc.height,Ue+De+50),Aa(e,{top:Ae,bottom:Ue})}$n<20&&(w.wheelStartX==null?(w.wheelStartX=W.scrollLeft,w.wheelStartY=W.scrollTop,w.wheelDX=r,w.wheelDY=n,setTimeout(function(){if(w.wheelStartX==null)return;var Ke=W.scrollLeft-w.wheelStartX,qe=W.scrollTop-w.wheelStartY,it=qe&&w.wheelDY&&qe/w.wheelDY||Ke&&w.wheelDX&&Ke/w.wheelDX;if(w.wheelStartX=w.wheelStartY=null,!it)return;jr=(jr*$n+it)/($n+1),++$n},200)):(w.wheelDX+=r,w.wheelDY+=n))}var Wr=function(e,t){this.ranges=e,this.primIndex=t};Wr.prototype.primary=function(){return this.ranges[this.primIndex]},Wr.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(!pi(i.anchor,r.anchor)||!pi(i.head,r.head))return!1}return!0},Wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(mi(this.ranges[t].anchor),mi(this.ranges[t].head));return new Wr(e,this.primIndex)},Wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return vi(this.anchor,this.head)},jt.prototype.to=function(){return gi(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Jr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,Ae){return St(De.from(),Ae.from())}),i=oe(t,n);for(var w=1;w<t.length;w++){var W=t[w],Y=t[w-1],J=St(Y.to(),W.from());if(r&&!W.empty()?J>0:J>=0){var ee=vi(Y.from(),W.from()),he=gi(Y.to(),W.to()),pe=Y.empty()?W.from()==W.head:Y.from()==Y.head;w<=i&&--i,t.splice(--w,2,new jt(pe?he:ee,pe?ee:he))}}return new Wr(t,i)}function wi(e,t){return new Wr([new jt(e,t||e)],0)}function _i(e){return e.text?$e(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return _i(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+=_i(t).ch-t.to.ch),$e(i,r)}function ka(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(ko(n.anchor,t),ko(n.head,t)))}return Jr(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?$e(i.line,e.ch-t.ch+i.ch):$e(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=$e(e.first,0),w=n,W=0;W<t.length;W++){var Y=t[W],J=Oo(Y.from,n,w),ee=Oo(_i(Y),n,w);if(n=Y.to,w=ee,i=="around"){var he=e.sel.ranges[W],pe=St(he.head,he.anchor)<0;r[W]=new jt(pe?ee:J,pe?J:ee)}else r[W]=new jt(J,J)}return new Wr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=Nr(e.options,e.doc.modeOption),_n(e)}function _n(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Tn(e,100),e.state.modeGen++,e.curOp&&_r(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(st){return i?i[st]:null}function w(st,nt,ut){ua(st,nt,ut,r),cr(st,"change",st,t)}function W(st,nt){for(var ut=[],xt=st;xt<nt;++xt)ut.push(new Pi(ee[xt],n(xt),r));return ut}var Y=t.from,J=t.to,ee=t.text,he=ct(e,Y.line),pe=ct(e,J.line),De=te(ee),Ae=n(ee.length-1),Ue=J.line-Y.line;if(t.full)e.insert(0,W(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(Po(e,t)){var Ke=W(0,ee.length-1);w(pe,pe.text,Ae),Ue&&e.remove(Y.line,Ue),Ke.length&&e.insert(Y.line,Ke)}else if(he==pe)if(ee.length==1)w(he,he.text.slice(0,Y.ch)+De+he.text.slice(J.ch),Ae);else{var qe=W(1,ee.length-1);qe.push(new Pi(De+he.text.slice(J.ch),Ae,r)),w(he,he.text.slice(0,Y.ch)+ee[0],n(0)),e.insert(Y.line+1,qe)}else if(ee.length==1)w(he,he.text.slice(0,Y.ch)+ee[0]+pe.text.slice(J.ch),n(0)),e.remove(Y.line+1,Ue);else{w(he,he.text.slice(0,Y.ch)+ee[0],n(0)),w(pe,De+pe.text.slice(J.ch),Ae);var it=W(1,ee.length-1);Ue>1&&e.remove(Y.line+1,Ue-1),e.insert(Y.line+1,it)}cr(e,"change",e,t)}function Ai(e,t,i){function r(n,w,W){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var J=n.linked[Y];if(J.doc==w)continue;var ee=W&&J.sharedHist;if(i&&!ee)continue;t(J.doc,ee),r(J.doc,n,ee)}}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||jn(e),e.options.mode=t.modeOption,_r(e)}function Io(e){(e.doc.direction=="rtl"?j:c)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Pr(e,function(){Io(e),_r(e)})}function Zn(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:mi(t.from),to:_i(t),text:Hr(e,t.from,t.to)};return Bo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Bo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Fo(e,t,i,r){var n=e.history;n.undone.length=0;var w=+new Date,W,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>w-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(n,n.lastOp==r)))Y=te(W.changes),St(t.from,t.to)==0&&St(t.from,Y.to)==0?Y.to=_i(t):W.changes.push(Ma(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Jn(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=w,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Be(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,w=r&&r.origin;i==n.lastSelOp||w&&n.lastSelOrigin==w&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==w||ml(e,w,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=w,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Bo(e,t,i,r){var n=t["spans_"+e.id],w=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((n||(n=t["spans_"+e.id]={}))[w]=W.markedSpans),++w})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Uo(e,t){var i=yl(e,t),r=Yr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var w=i[n],W=r[n];if(w&&W){e:for(var Y=0;Y<W.length;++Y){for(var J=W[Y],ee=0;ee<w.length;++ee)if(w[ee].marker==J.marker)continue e;w.push(J)}}else W&&(i[n]=W)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var w=e[n];if(w.ranges){r.push(i?Wr.prototype.deepCopy.call(w):w);continue}var W=w.changes,Y=[];r.push({changes:Y});for(var J=0;J<W.length;++J){var ee=W[J],he=void 0;if(Y.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var pe in ee)(he=pe.match(/^spans_(\d+)$/))&&(oe(t,Number(he[1]))>-1&&(te(Y)[pe]=ee[pe],delete ee[pe]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var w=St(t,n)<0;w!=St(i,n)<0?(n=t,t=i):w!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),br(e,new Wr([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),w=0;w<e.sel.ranges.length;w++)r[w]=Ia(e.sel.ranges[w],t[w],null,n);var W=Jr(e.cm,r,e.sel.primIndex);br(e,W,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,br(e,Jr(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){br(e,wi(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var w=0;w<n.length;w++)this.ranges[w]=new jt(s(e,n[w].anchor),s(e,n[w].head))},origin:i&&i.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Jr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):br(e,t,i)}function br(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);zo(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(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,Ce(e.cm)),cr(e,"cursorActivity",e)}function Go(e){zo(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,w=0;w<t.ranges.length;w++){var W=t.ranges[w],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[w],J=ea(e,W.anchor,Y&&Y.anchor,i,r),ee=ea(e,W.head,Y&&Y.head,i,r);(n||J!=W.anchor||ee!=W.head)&&(n||(n=t.ranges.slice(0,w)),n[w]=new jt(J,ee))}return n?Jr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var w=ct(e,t.line);if(w.markedSpans)for(var W=0;W<w.markedSpans.length;++W){var Y=w.markedSpans[W],J=Y.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,he="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(ee?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(he?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Be(J,"beforeCursorEnter"),J.explicitlyCleared))if(w.markedSpans){--W;continue}else break;if(!J.atomic)continue;if(i){var pe=J.find(r<0?1:-1),De=void 0;if((r<0?he:ee)&&(pe=Vo(e,pe,-r,pe&&pe.line==t.line?w:null)),pe&&pe.line==t.line&&(De=St(pe,i))&&(r<0?De<0:De>0))return en(e,pe,t,r,n)}var Ae=J.find(r<0?-1:1);return(r<0?ee:he)&&(Ae=Vo(e,Ae,r,Ae.line==t.line?w:null)),Ae?en(e,Ae,t,r,n):null}}return t}function ea(e,t,i,r,n){var w=r||1,W=en(e,t,i,w,n)||!n&&en(e,t,i,w,!0)||en(e,t,i,-w,n)||!n&&en(e,t,i,-w,!0);return W||(e.cantEdit=!0,$e(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,$e(t.line-1)):null:i>0&&t.ch==(r||ct(e,t.line)).text.length?t.line<e.first+e.size-1?$e(t.line+1,0):null:new $e(t.line,t.ch+i)}function Xo(e){e.setSelection($e(e.firstLine(),0),$e(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,w,W,Y){n&&(r.from=s(e,n)),w&&(r.to=s(e,w)),W&&(r.text=W),Y!==void 0&&(r.origin=Y)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function tn(e,t,i){if(e.cm){if(!e.cm.curOp)return or(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=ki&&!i&&bi(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]==""&&St(t.from,t.to)==0)return;var i=ka(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Yr(e,t));var r=[];Ai(e,function(n,w){!w&&oe(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),An(n,t,null,Yr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,w,W=e.sel,Y=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<Y.length&&!(w=Y[ee],i?w.ranges&&!w.equals(e.sel):!w.ranges);ee++);if(ee==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(w=Y.pop(),w.ranges){if(Jn(w,J),i&&!w.equals(e.sel)){br(e,w,{clearRedo:!1});return}W=w}else if(r){Y.push(w);return}else break;var he=[];Jn(W,J),J.push({changes:he,generation:n.generation}),n.generation=w.generation||++n.maxGeneration;for(var pe=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),De=function(Ke){var qe=w.changes[Ke];if(qe.origin=t,pe&&!Yo(e,qe,!1))return Y.length=0,{};he.push(Ma(e,qe));var it=Ke?ka(e,qe):te(Y);An(e,qe,it,Uo(e,qe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:qe.from,to:_i(qe)});var st=[];Ai(e,function(nt,ut){!ut&&oe(st,nt.history)==-1&&(qo(nt.history,qe),st.push(nt.history)),An(nt,qe,null,Uo(nt,qe))})},Ae=w.changes.length-1;Ae>=0;--Ae){var Ue=De(Ae);if(Ue)return Ue.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wr(ue(e.sel.ranges,function(n){return new jt($e(n.anchor.line+t,n.anchor.ch),$e(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){_r(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Ci(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return or(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Zo(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);Zo(e,n),t={from:$e(e.first,0),to:$e(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var w=e.lastLine();t.to.line>w&&(t={from:t.from,to:$e(w,ct(e,w).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Hr(e,t.from,t.to),i||(i=ka(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),qn(e,i,Ee),e.cantEdit&&ea(e,$e(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,i){var r=e.doc,n=e.display,w=t.from,W=t.to,Y=!1,J=w.line;e.options.lineWrapping||(J=Lt(xr(ct(r,w.line))),r.iter(J,W.line+1,function(Ae){if(Ae==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ce(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(J,w.line+t.text.length,function(Ae){var Ue=pn(Ae);Ue>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=Ue,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Xr(r,w.line),Tn(e,400);var ee=t.text.length-(W.line-w.line)-1;t.full?_r(e):w.line==W.line&&t.text.length==1&&!Po(e.doc,t)?Ci(e,w.line,"text"):_r(e,w.line,W.line+1,ee);var he=ve(e,"changes"),pe=ve(e,"change");if(pe||he){var De={from:w,to:W,text:t.text,removed:t.removed,origin:t.origin};pe&&cr(e,"change",e,De),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var w;r||(r=i),St(r,i)<0&&(w=[r,i],i=w[0],r=w[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function Jo(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 w=e[n],W=!0;if(w.ranges){w.copied||(w=e[n]=w.deepCopy(),w.copied=!0);for(var Y=0;Y<w.ranges.length;Y++)Jo(w.ranges[Y].anchor,t,i,r),Jo(w.ranges[Y].head,t,i,r);continue}for(var J=0;J<w.changes.length;++J){var ee=w.changes[J];if(i<ee.from.line)ee.from=$e(ee.from.line+r,ee.from.ch),ee.to=$e(ee.to.line+r,ee.to.ch);else if(t<=ee.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 Ln(e,t,i,r){var n=t,w=t;return typeof t=="number"?w=ct(e,z(e,t)):n=Lt(t),n==null?null:(r(w,n)&&e.cm&&Ci(e.cm,n,i),w)}function Dn(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}Dn.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,mt(n),cr(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 Rn(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}Rn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var w=Math.min(t,n-e),W=r.height;if(r.removeInner(e,w),this.height-=W-r.height,n==w&&(this.children.splice(i--,1),r.parent=null),(t-=w)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Dn))){var Y=[];this.collapse(Y),this.children=[new Dn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],w=n.chunkSize();if(e<=w){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var W=n.lines.length%25+25,Y=W;Y<n.lines.length;){var J=new Dn(n.lines.slice(Y,Y+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,W),this.maybeSpill()}break}e-=w}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Rn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Rn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],w=n.chunkSize();if(e<w){var W=Math.min(t,w-e);if(n.iterN(e,W,i))return!0;if((t-=W)==0)break;e=0}else e-=w}}};var kn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};kn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Lt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var w=vn(this);mr(i,Math.max(0,i.height-w)),e&&(Pr(e,function(){es(e,i,-w),Ci(e,r,"widget")}),cr(e,"lineWidgetCleared",e,this,r))},kn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=vn(this)-t;if(!n)return;ri(this.doc,r)||mr(r,r.height+n),i&&Pr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),cr(i,"lineWidgetChanged",i,e,Lt(r))})},be(kn);function es(e,t,i){$r(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function xl(e,t,i,r){var n=new kn(e,i,r),w=e.cm;return w&&n.noHScroll&&(w.display.alignWidgets=!0),Ln(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,w&&!ri(e,W)){var J=$r(W)<e.scrollTop;mr(W,W.height+vn(n)),J&&wa(w,n.height),w.curOp.forceUpdate=!0}return!0}),w&&cr(w,"lineWidgetAdded",w,n,typeof t=="number"?t:Lt(t)),n}var ts=0,Li=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ji(e),ve(this,"clear")){var i=this.find();i&&cr(this,"clear",i.from,i.to)}for(var r=null,n=null,w=0;w<this.lines.length;++w){var W=this.lines[w],Y=Or(W.markedSpans,this);e&&!this.collapsed?Ci(e,Lt(W),"text"):e&&(Y.to!=null&&(n=Lt(W)),Y.from!=null&&(r=Lt(W))),W.markedSpans=Oi(W.markedSpans,Y),Y.from==null&&this.collapsed&&!ri(this.doc,W)&&e&&mr(W,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=xr(this.lines[J]),he=pn(ee);he>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&_r(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&&cr(e,"markerCleared",e,this,r,n),t&&Wi(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var w=this.lines[n],W=Or(w.markedSpans,this);if(W.from!=null&&(i=$e(t?w:Lt(w),W.from),e==-1))return i;if(W.to!=null&&(r=$e(t?w:Lt(w),W.to),e==1))return r}return i&&{from:i,to:r}},Li.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Pr(r,function(){var n=t.line,w=Lt(t.line),W=fa(r,w);if(W&&(no(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!ri(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var J=vn(i)-Y;J&&mr(n,n.height+J)}cr(r,"markerChanged",r,e)})},Li.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Li.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Li);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return or(e.cm,nn)(e,t,i,r,n);var w=new Li(e,n),W=St(t,i);if(r&&I(r,w,!1),W>0||W==0&&w.clearWhenEmpty!==!1)return w;if(w.replacedWith&&(w.collapsed=!0,w.widgetNode=x("span",[w.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||w.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(w.widgetNode.insertLeft=!0)),w.collapsed){if(ar(e,t.line,t,i,w)||t.line!=i.line&&ar(e,i.line,t,i,w))throw new Error("Inserting collapsed marker partially overlapping an existing one");oi()}w.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,ee;if(e.iter(Y,i.line+1,function(pe){J&&w.collapsed&&!J.options.lineWrapping&&xr(pe)==J.display.maxLine&&(ee=!0),w.collapsed&&Y!=t.line&&mr(pe,0),yi(pe,new si(w,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),w.collapsed&&e.iter(t.line,i.line+1,function(pe){ri(e,pe)&&mr(pe,0)}),w.clearOnEnter&&Pe(w,"beforeCursorEnter",function(){return w.clear()}),w.readOnly&&(Ur(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),w.collapsed&&(w.id=++ts,w.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),w.collapsed)_r(J,t.line,i.line+1);else if(w.className||w.startStyle||w.endStyle||w.css||w.attributes||w.title)for(var he=t.line;he<=i.line;he++)Ci(J,he,"text");w.atomic&&Go(J.doc),cr(J,"markerAdded",J,w)}return w}var On=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};On.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();cr(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},be(On);function Sl(e,t,i,r,n){r=I(r),r.shared=!1;var w=[nn(e,t,i,r,n)],W=w[0],Y=r.widgetNode;return Ai(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),w.push(nn(J,s(J,t),s(J,i),r,n));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;W=te(w)}),new On(w,W)}function rs(e){return e.findMarks($e(e.first,0),e.clipPos($e(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(),w=e.clipPos(n.from),W=e.clipPos(n.to);if(St(w,W)){var Y=nn(e,w,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],w=[n.primary.doc];Ai(n.primary.doc,function(J){return w.push(J)});for(var W=0;W<n.markers.length;W++){var Y=n.markers[W];oe(w,Y.doc)==-1&&(Y.parent=null,n.markers.splice(W--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Ar=function(e,t,i,r,n){if(!(this instanceof Ar))return new Ar(e,t,i,r,n);i==null&&(i=0),Rn.call(this,[new Dn([new Pi("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var w=$e(i,0);this.sel=wi(w),this.history=new Zn(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:w,to:w,text:e}),br(this,wi(w),Ee)};Ar.prototype=Re(Rn.prototype,{constructor:Ar,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=ei(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:sr(function(e){var t=$e(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:$e(i,ct(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&En(this.cm,0,0),br(this,wi(t),Ee)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Hr(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Vr(this,e))return ct(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ct(this,e)),xr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:sr(function(e,t,i){Wo(this,s(this,typeof e=="number"?$e(e,t||0):e),null,i)}),setSelection:sr(function(e,t,i){Wo(this,s(this,e),s(this,t||e),i)}),extendSelection:sr(function(e,t,i){Qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:sr(function(e,t){jo(this,F(this,e),t)}),extendSelectionsBy:sr(function(e,t){var i=ue(this.sel.ranges,e);jo(this,F(this,i),t)}),setSelections:sr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),br(this,Jr(this.cm,r,t),i)}),addSelection:sr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),br(this,Jr(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=Hr(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=Hr(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:sr(function(e,t,i){for(var r=[],n=this.sel,w=0;w<n.ranges.length;w++){var W=n.ranges[w];r[w]={from:W.from(),to:W.to(),text:this.splitLines(e[w]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)tn(this,r[J]);Y?Ho(this,Y):this.cm&&Ji(this.cm)}),undo:sr(function(){ta(this,"undo")}),redo:sr(function(){ta(this,"redo")}),undoSelection:sr(function(){ta(this,"undo",!0)}),redoSelection:sr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Zn(this.history.maxGeneration),Ai(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Zn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:sr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&He(n)&&(r.gutterMarkers=null),!0})}),clearGutter:sr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,He(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=ct(this,e),!e)return null}else if(t=Lt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:sr(function(e,t,i){return Ln(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:sr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",w=r[n];if(w)if(i==null)r[n]=null;else{var W=w.match(y(i));if(!W)return!1;var Y=W.index+W[0].length;r[n]=w.slice(0,W.index)+(!W.index||Y==w.length?"":" ")+w.slice(Y)||null}else return!1;return!0})}),addLineWidget:sr(function(e,t,i){return xl(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=ct(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(w){var W=w.markedSpans;if(W)for(var Y=0;Y<W.length;Y++){var J=W[Y];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var w=n.text.length+r;if(w>e)return t=e,!0;e-=w,++i}),s(this,$e(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Ar(ei(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 Ar(ei(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 Vt&&(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];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Zn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ct(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:sr(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)})}),Ar.prototype.eachLine=Ar.prototype.iter;var is=0;function _l(e){var t=this;if(ns(t),Xe(t,e)||ui(t.display,e))return;ie(e),K&&(is=+new Date);var i=Ni(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,w=Array(n),W=0,Y=function(){++W==n&&or(t,function(){i=s(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(w.filter(function(Ue){return Ue!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Ae),Ho(t.doc,wi(s(t.doc,i),s(t.doc,_i(Ae))))})()},J=function(Ae,Ue){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ae.type)==-1){Y();return}var Ke=new FileReader;Ke.onerror=function(){return Y()},Ke.onload=function(){var qe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(qe)){Y();return}w[Ue]=qe,Y()},Ke.readAsText(Ae)},ee=0;ee<r.length;ee++)J(r[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var he=e.dataTransfer.getData("Text");if(he){var pe;if(t.state.draggingText&&!t.state.draggingText.copy&&(pe=t.listSelections()),qn(t.doc,wi(i,i)),pe)for(var De=0;De<pe.length;++De)rn(t.doc,"",pe[De].anchor,pe[De].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-is<100)){me(t);return}if(Xe(e,t)||ui(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!k){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Ni(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 w=0;w<i.length;w++)e(i[w])})}var os=!1;function Dl(){if(os)return;Rl(),os=!0}function Rl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(kl)},100))}),Pe(window,"blur",function(){return as(Zi)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Di={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"},Pn=0;Pn<10;Pn++)Di[Pn+48]=Di[Pn+96]=String(Pn);for(var ra=65;ra<=90;ra++)Di[ra]=String.fromCharCode(ra);for(var Mn=1;Mn<=12;Mn++)Di[Mn+111]=Di[Mn+63235]="F"+Mn;var di={};di.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"},di.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"},di.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"},di.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"]},di.default=l?di.macDefault:di.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,w,W=0;W<t.length-1;W++){var Y=t[W];if(/^(cmd|meta|m)$/i.test(Y))w=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),w&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=ue(i.split(" "),Ol),w=0;w<n.length;w++){var W=void 0,Y=void 0;w==n.length-1?(Y=n.join(" "),W=r):(Y=n.slice(0,w+1).join(" "),W="...");var J=t[Y];if(!J)t[Y]=W;else if(J!=W)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var ee in t)e[ee]=t[ee];return e}function an(e,t,i,r){t=ia(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,i,r);for(var w=0;w<t.fallthrough.length;w++){var W=an(e,t.fallthrough[w],i,r);if(W)return W}}}function ss(e){var t=typeof e=="string"?e:Di[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(A&&e.keyCode==34&&e.char)return!1;var i=Di[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function ia(e){return typeof e=="string"?di[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var w=t(i[n]);r.length&&St(w.from,te(r).to)<=0;){var W=r.pop();if(St(W.from,w.from)<0){w.from=W.from;break}}r.push(w)}Pr(e,function(){for(var Y=r.length-1;Y>=0;Y--)rn(e.doc,"",r[Y].from,r[Y].to,"+delete");Ji(e)})}function Fa(e,t,i){var r=Oe(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 $e(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var w=Je(i,t.doc.direction);if(w){var W=n<0?te(w):w[0],Y=n<0==(W.level==1),J=Y?"after":"before",ee;if(W.level>0||t.doc.direction=="rtl"){var he=Xi(t,i);ee=n<0?i.text.length-1:0;var pe=ni(t,he,ee).top;ee=Ye(function(De){return ni(t,he,De).top==pe},n<0==(W.level==1)?W.from:W.to-1,ee),J=="before"&&(ee=Fa(i,ee,1))}else ee=n<0?W.to:W.from;return new $e(r,ee,J)}}return new $e(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Je(t,e.doc.direction);if(!n)return 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 w=je(n,i.ch,i.sticky),W=n[w];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(it,st){return Fa(t,it instanceof $e?it.ch:it,st)},J,ee=function(it){return e.options.lineWrapping?(J=J||Xi(e,t),co(e,t,J,it)):{begin:0,end:t.text.length}},he=ee(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||W.level==1){var pe=W.level==1==r<0,De=Y(i,pe?1:-1);if(De!=null&&(pe?De<=W.to&&De<=he.end:De>=W.from&&De>=he.begin)){var Ae=pe?"before":"after";return new $e(i.line,De,Ae)}}var Ue=function(it,st,nt){for(var ut=function(Gt,lr){return lr?new $e(i.line,Y(Gt,1),"before"):new $e(i.line,Gt,"after")};it>=0&&it<n.length;it+=st){var xt=n[it],vt=st>0==(xt.level!=1),_t=vt?nt.begin:Y(nt.end,-1);if(xt.from<=_t&&_t<xt.to)return ut(_t,vt);if(_t=vt?xt.from:Y(xt.to,-1),nt.begin<=_t&&_t<nt.end)return ut(_t,vt)}},Ke=Ue(w+r,r,he);if(Ke)return Ke;var qe=r>0?he.end:Y(he.begin,-1);return qe!=null&&!(r>0&&qe==t.text.length)&&(Ke=Ue(r>0?0:n.length-1,r,ee(qe)),Ke)?Ke:null}var In={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=ct(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:$e(t.head.line+1,0)}:{from:t.head,to:$e(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:$e(t.from().line,0),to:s(e.doc,$e(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:$e(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection($e(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection($e(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")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?hs(e,t.head):r},Te)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var w=i[n].from(),W=X(e.getLine(w.line),w.ch,r);t.push(se(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Pr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,w=ct(e.doc,n.line).text;if(w){if(n.ch==w.length&&(n=new $e(n.line,n.ch-1)),n.ch>0)n=new $e(n.line,n.ch+1),e.replaceRange(w.charAt(n.ch-1)+w.charAt(n.ch-2),$e(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var W=ct(e.doc,n.line-1).text;W&&(n=new $e(n.line,1),e.replaceRange(w.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),$e(n.line-1,W.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Pr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Ji(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=ct(e.doc,t),r=xr(i);return r!=i&&(t=Lt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=ct(e.doc,t),r=Vi(i);return r!=i&&(t=Lt(r)),Ua(!0,e,i,t,-1)}function hs(e,t){var i=ds(e,t.line),r=ct(e.doc,i.line),n=Je(r,e.doc.direction);if(!n||n[0].level==0){var w=Math.max(i.ch,r.text.search(/\S/)),W=t.line==i.line&&t.ch<=w&&t.ch;return $e(i.line,W?0:w,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=In[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=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Fl=new q;function Nn(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"&&cr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(ie(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||Nn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):Nn(e,i,t,function(r){return na(e,r)}):!1}function Bl(e,t,i){return Nn(e,"'"+i+"'",t,function(r){return na(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=M(),Xe(t,e))return;K&&U<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);A&&(ja=r?i:null,!r&&i==88&&!Bt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!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)&&(c(t,"CodeMirror-crosshair"),at(document,"keyup",i),at(document,"mouseover",i))}Pe(document,"keyup",i),Pe(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),Xe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(ui(t.display,e)||Xe(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==ja){ja=null,ie(e);return}if(A&&(!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&&St(t,this.pos)==0&&i==this.button};var Fn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Fn=Bn=null,"triple"):Fn&&Fn.compare(i,e,t)?(Bn=new Wa(i,e,t),Fn=null,"double"):(Fn=new Wa(i,e,t),Bn=null,"single")}function vs(e){var t=this,i=t.display;if(Xe(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,ui(i,e)){N||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Ni(t,e),n=Ie(e),w=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,w,e))return;n==1?r?Gl(t,r,w,e):Se(e)==i.scroller&&ie(e):n==2?(r&&Qn(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 w="Click";return r=="double"?w="Double"+w:r=="triple"&&(w="Triple"+w),w=(t==1?"Left":t==2?"Middle":"Right")+w,Nn(e,ls(w,n),n,function(W){if(typeof W=="string"&&(W=In[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 w=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=w?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){K?setTimeout(O(vo,e),0):e.curOp.focus=M();var n=zl(e,i,r),w=e.doc.sel,W;e.options.dragDrop&&ze&&!e.isReadOnly()&&i=="single"&&(W=w.contains(t))>-1&&(St((W=w.ranges[W]).from(),t)<0||t.xRel>0)&&(St(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,w=!1,W=or(e,function(ee){N&&(n.scroller.draggable=!1),e.state.draggingText=!1,at(n.wrapper.ownerDocument,"mouseup",W),at(n.wrapper.ownerDocument,"mousemove",Y),at(n.scroller,"dragstart",J),at(n.scroller,"drop",W),w||(ie(ee),r.addNew||Qn(e.doc,i,null,null,r.extend),N&&!k||K&&U==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(ee){w=w||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return w=!0};N&&(n.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Pe(n.wrapper.ownerDocument,"mouseup",W),Pe(n.wrapper.ownerDocument,"mousemove",Y),Pe(n.scroller,"dragstart",J),Pe(n.scroller,"drop",W),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt($e(t.line,0),s(e.doc,$e(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,w=e.doc;ie(t);var W,Y,J=w.sel,ee=J.ranges;if(r.addNew&&!r.extend?(Y=w.sel.contains(i),Y>-1?W=ee[Y]:W=new jt(i,i)):(W=w.sel.primary(),Y=w.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new jt(i,i)),i=Ni(e,t,!0,!0),Y=-1;else{var he=ys(e,i,r.unit);r.extend?W=Ia(W,he.anchor,he.head,r.extend):W=he}r.addNew?Y==-1?(Y=ee.length,br(w,Jr(e,ee.concat([W]),Y),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Y].empty()&&r.unit=="char"&&!r.extend?(br(w,Jr(e,ee.slice(0,Y).concat(ee.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=w.sel):Na(w,Y,W,we):(Y=0,br(w,new Wr([W],0),we),J=w.sel);var pe=i;function De(nt){if(St(pe,nt)==0)return;if(pe=nt,r.unit=="rectangle"){for(var ut=[],xt=e.options.tabSize,vt=X(ct(w,i.line).text,i.ch,xt),_t=X(ct(w,nt.line).text,nt.ch,xt),Gt=Math.min(vt,_t),lr=Math.max(vt,_t),Yt=Math.min(i.line,nt.line),Mr=Math.min(e.lastLine(),Math.max(i.line,nt.line));Yt<=Mr;Yt++){var Lr=ct(w,Yt).text,er=ye(Lr,Gt,xt);Gt==lr?ut.push(new jt($e(Yt,er),$e(Yt,er))):Lr.length>er&&ut.push(new jt($e(Yt,er),$e(Yt,ye(Lr,lr,xt))))}ut.length||ut.push(new jt(i,i)),br(w,Jr(e,J.ranges.slice(0,Y).concat(ut),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var Dr=W,fr=ys(e,nt,r.unit),ir=Dr.anchor,tr;St(fr.anchor,ir)>0?(tr=fr.head,ir=vi(Dr.from(),fr.anchor)):(tr=fr.anchor,ir=gi(Dr.to(),fr.head));var $t=J.ranges.slice(0);$t[Y]=Xl(e,new jt(s(w,ir),tr)),br(w,Jr(e,$t,Y),we)}}var Ae=n.wrapper.getBoundingClientRect(),Ue=0;function Ke(nt){var ut=++Ue,xt=Ni(e,nt,!0,r.unit=="rectangle");if(!xt)return;if(St(xt,pe)!=0){e.curOp.focus=M(),De(xt);var vt=Vn(n,w);(xt.line>=vt.to||xt.line<vt.from)&&setTimeout(or(e,function(){Ue==ut&&Ke(nt)}),150)}else{var _t=nt.clientY<Ae.top?-20:nt.clientY>Ae.bottom?20:0;_t&&setTimeout(or(e,function(){if(Ue!=ut)return;n.scroller.scrollTop+=_t,Ke(nt)}),50)}}function qe(nt){e.state.selectingText=!1,Ue=Infinity,nt&&(ie(nt),n.input.focus()),at(n.wrapper.ownerDocument,"mousemove",it),at(n.wrapper.ownerDocument,"mouseup",st),w.history.lastSelOrigin=null}var it=or(e,function(nt){nt.buttons===0||!Ie(nt)?qe(nt):Ke(nt)}),st=or(e,qe);e.state.selectingText=st,Pe(n.wrapper.ownerDocument,"mousemove",it),Pe(n.wrapper.ownerDocument,"mouseup",st)}function Xl(e,t){var i=t.anchor,r=t.head,n=ct(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var w=Je(n);if(!w)return t;var W=je(w,i.ch,i.sticky),Y=w[W];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var J=W+(Y.from==i.ch==(Y.level!=1)?0:1);if(J==0||J==w.length)return t;var ee;if(r.line!=i.line)ee=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=je(w,r.ch,r.sticky),pe=he-W||(r.ch-i.ch)*(Y.level==1?-1:1);he==J-1||he==J?ee=pe<0:ee=pe>0}var De=w[J+(ee?-1:0)],Ae=ee==(De.level==1),Ue=Ae?De.from:De.to,Ke=Ae?"after":"before";return i.ch==Ue&&i.sticky==Ke?t:new jt(new $e(i.line,Ue,Ke),r)}function bs(e,t,i,r){var n,w;if(t.touches)n=t.touches[0].clientX,w=t.touches[0].clientY;else try{n=t.clientX,w=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ie(t);var W=e.display,Y=W.lineDiv.getBoundingClientRect();if(w>Y.bottom||!ve(e,i))return de(t);w-=Y.top-W.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=W.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=n){var he=Br(e.doc,w),pe=e.display.gutterSpecs[J];return Be(e,i,e,he,pe.className,t),de(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(ui(e.display,t)||Yl(e,t))return;if(Xe(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(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-"),yn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,w,W){e.defaults[r]=n,w&&(t[r]=W?function(Y,J,ee){ee!=sn&&w(Y,J,ee)}:w)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){_n(r),yn(r),_r(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var w=[],W=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var he=J.text.indexOf(n,ee);if(he==-1)break;ee=he+n.length,w.push($e(W,he))}W++});for(var Y=w.length-1;Y>=0;Y--)rn(r.doc,n,w[Y],$e(w[Y].line,w[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,w){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),w!=sn&&r.refresh()}),i("specialCharPlaceholder",zt,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",!_),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){xs(r),wn(r)},!0),i("keyMap","default",function(r,n,w){var W=ia(n),Y=w!=sn&&ia(w);Y&&Y.detach&&Y.detach(r,W),W.attach&&W.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),wn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){To(r),Qi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Ra(r.options.gutters,n),wn(r)},!0),i("firstLineNumber",1,wn,!0),i("lineNumberFormatter",function(r){return r},wn,!0),i("showCursorWhenSelecting",!1,bn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,bn,!0),i("singleCursorHeightPerLine",!0,bn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,_n,!0),i("addModeClass",!1,_n,!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,_n,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,w=t?Pe:at;w(e.display.scroller,"dragstart",n.start),w(e.display.scroller,"dragenter",n.enter),w(e.display.scroller,"dragover",n.over),w(e.display.scroller,"dragleave",n.leave),w(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),jn(e)),xa(e),_r(e),yn(e),setTimeout(function(){return Qi(e)},100)}function Vt(e,t){var i=this;if(!(this instanceof Vt))return new Vt(e,t);this.options=t=t?I(t):{},I(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Ar(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Vt.inputStyles[t.inputStyle](this),w=this.display=new dl(e,r,n,t);w.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 q,keySeq:null,specialChars:null},t.autofocus&&!a&&w.input.focus(),K&&U<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),Dl(),ji(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):Zi(this);for(var W in aa)aa.hasOwnProperty(W)&&aa[W](this,t[W],sn);Ao(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);Wi(this),N&&t.lineWrapping&&getComputedStyle(w.lineDiv).textRendering=="optimizelegibility"&&(w.lineDiv.style.textRendering="auto")}Vt.defaults=Ss,Vt.optionHandlers=aa;function Ql(e){var t=e.display;Pe(t.scroller,"mousedown",or(e,vs)),K&&U<11?Pe(t.scroller,"dblclick",or(e,function(J){if(Xe(e,J))return;var ee=Ni(e,J);if(!ee||Ha(e,J)||ui(e.display,J))return;ie(J);var he=e.findWordAt(ee);Qn(e.doc,he.anchor,he.head)})):Pe(t.scroller,"dblclick",function(J){return Xe(e,J)||ie(J)}),Pe(t.scroller,"contextmenu",function(J){return Es(e,J)}),Pe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Es(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function w(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function W(J,ee){if(ee.left==null)return!0;var he=ee.left-J.left,pe=ee.top-J.top;return he*he+pe*pe>20*20}Pe(t.scroller,"touchstart",function(J){if(!Xe(e,J)&&!w(J)&&!Ha(e,J)){t.input.ensurePolled(),clearTimeout(i);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!ui(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var he=e.coordsChar(t.activeTouch,"page"),pe;!ee.prev||W(ee,ee.prev)?pe=new jt(he,he):!ee.prev.prev||W(ee,ee.prev.prev)?pe=e.findWordAt(he):pe=new jt($e(he.line,0),s(e.doc,$e(he.line+1,0))),e.setSelection(pe.anchor,pe.head),e.focus(),ie(J)}n()}),Pe(t.scroller,"touchcancel",n),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Bi(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(J){return Ro(e,J)}),Pe(t.scroller,"DOMMouseScroll",function(J){return Ro(e,J)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Xe(e,J)||me(J)},over:function(J){Xe(e,J)||(Ll(e,J),me(J))},start:function(J){return Al(e,J)},drop:or(e,_l),leave:function(J){Xe(e,J)||ns(e)}};var Y=t.input.getField();Pe(Y,"keyup",function(J){return ms.call(e,J)}),Pe(Y,"keydown",or(e,ps)),Pe(Y,"keypress",or(e,gs)),Pe(Y,"focus",function(J){return Ca(e,J)}),Pe(Y,"blur",function(J){return Zi(e,J)})}var za=[];Vt.defineInitHook=function(e){return za.push(e)};function Un(e,t,i,r){var n=e.doc,w;i==null&&(i="add"),i=="smart"&&(n.mode.indent?w=et(e,t).state:i="prev");var W=e.options.tabSize,Y=ct(n,t),J=X(Y.text,null,W);Y.stateAfter&&(Y.stateAfter=null);var ee=Y.text.match(/^\s*/)[0],he;if(!r&&!/\S/.test(Y.text))he=0,i="not";else if(i=="smart"&&(he=n.mode.indent(w,Y.text.slice(ee.length),Y.text),he==Le||he>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?he=X(ct(n,t-1).text,null,W):he=0:i=="add"?he=J+e.options.indentUnit:i=="subtract"?he=J-e.options.indentUnit:typeof i=="number"&&(he=J+i),he=Math.max(0,he);var pe="",De=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(he/W);Ae;--Ae)De+=W,pe+=" ";if(De<he&&(pe+=se(he-De)),pe!=ee)return rn(n,pe,$e(t,0),$e(t,ee.length),"+input"),Y.stateAfter=null,!0;for(var Ue=0;Ue<n.sel.ranges.length;Ue++){var Ke=n.sel.ranges[Ue];if(Ke.head.line==t&&Ke.head.ch<ee.length){var qe=$e(t,ee.length);Na(n,Ue,new jt(qe,qe));break}}}var Qr=null;function oa(e){Qr=e}function Ga(e,t,i,r,n){var w=e.doc;e.display.shift=!1,r||(r=w.sel);var W=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>W,J=Ct(t),ee=null;if(Y&&r.ranges.length>1)if(Qr&&Qr.text.join(`
`)==t){if(r.ranges.length%Qr.text.length==0){ee=[];for(var he=0;he<Qr.text.length;he++)ee.push(w.splitLines(Qr.text[he]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=ue(J,function(it){return[it]}));for(var pe=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var Ae=r.ranges[De],Ue=Ae.from(),Ke=Ae.to();Ae.empty()&&(i&&i>0?Ue=$e(Ue.line,Ue.ch-i):e.state.overwrite&&!Y?Ke=$e(Ke.line,Math.min(ct(w,Ke.line).text.length,Ke.ch+te(J).length)):Y&&Qr&&Qr.lineWise&&Qr.text.join(`
`)==J.join(`
`)&&(Ue=Ke=$e(Ue.line,0)));var qe={from:Ue,to:Ke,text:ee?ee[De%ee.length]:J,origin:n||(Y?"paste":e.state.cutIncoming>W?"cut":"+input")};tn(e.doc,qe),cr(e,"inputRead",e,qe)}t&&!Y&&Ts(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=pe),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&&Pr(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 w=e.getModeAt(n.head),W=!1;if(w.electricChars){for(var Y=0;Y<w.electricChars.length;Y++)if(t.indexOf(w.electricChars.charAt(Y))>-1){W=Un(e,n.head.line,"smart");break}}else w.electricInput&&(w.electricInput.test(ct(e.doc,n.head.line).text.slice(0,n.head.ch))&&(W=Un(e,n.head.line,"smart")));W&&cr(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,w={anchor:$e(n,0),head:$e(n+1,0)};i.push(w),t.push(e.getRange(w.anchor,w.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"),E&&(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 w=this.options,W=w[r];if(w[r]==n&&r!="mode")return;w[r]=n,t.hasOwnProperty(r)&&or(this,t[r])(this,n,W),Be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,w=0;w<n.length;++w)if(n[w]==r||n[w].name==r)return n.splice(w,1),!0},addOverlay:Sr(function(r,n){var w=r.token?r:e.getMode(this.options,r);if(w.startState)throw new Error("Overlays may not be stateful.");ne(this.state.overlays,{mode:w,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(W){return W.priority}),this.state.modeGen++,_r(this)}),removeOverlay:Sr(function(r){for(var n=this.state.overlays,w=0;w<n.length;++w){var W=n[w].modeSpec;if(W==r||typeof r=="string"&&W.name==r){n.splice(w,1),this.state.modeGen++,_r(this);return}}}),indentLine:Sr(function(r,n,w){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Vr(this.doc,r)&&Un(this,r,n,w)}),indentSelection:Sr(function(r){for(var n=this.doc.sel.ranges,w=-1,W=0;W<n.length;W++){var Y=n[W];if(Y.empty())Y.head.line>w&&(Un(this,Y.head.line,r,!0),w=Y.head.line,W==this.doc.sel.primIndex&&Ji(this));else{var J=Y.from(),ee=Y.to(),he=Math.max(w,J.line);w=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var pe=he;pe<w;++pe)Un(this,pe,r);var De=this.doc.sel.ranges;J.ch==0&&n.length==De.length&&De[W].from().ch>0&&Na(this.doc,W,new jt(J,De[W].to()),Ee)}}}),getTokenAt:function(r,n){return Kt(this,r,n)},getLineTokens:function(r,n){return Kt(this,$e(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=We(this,ct(this.doc,r.line)),w=0,W=(n.length-1)/2,Y=r.ch,J;if(Y==0)J=n[2];else for(;;){var ee=w+W>>1;if((ee?n[ee*2-1]:0)>=Y)W=ee;else if(n[ee*2+1]<Y)w=ee+1;else{J=n[ee*2+2];break}}var he=J?J.indexOf("overlay "):-1;return he<0?J:he==0?null:J.slice(0,he-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var w=[];if(!i.hasOwnProperty(n))return w;var W=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")W[Y[n]]&&w.push(W[Y[n]]);else if(Y[n])for(var J=0;J<Y[n].length;J++){var ee=W[Y[n][J]];ee&&w.push(ee)}else Y.helperType&&W[Y.helperType]?w.push(W[Y.helperType]):W[Y.name]&&w.push(W[Y.name]);for(var he=0;he<W._global.length;he++){var pe=W._global[he];pe.pred(Y,this)&&oe(w,pe.val)==-1&&w.push(pe.val)}return w},getStateAfter:function(r,n){var w=this.doc;return r=z(w,r==null?w.first+w.size-1:r),et(this,r+1,n).state},cursorCoords:function(r,n){var w,W=this.doc.sel.primary();return r==null?w=W.head:typeof r=="object"?w=s(this.doc,r):w=r?W.from():W.to(),Zr(this,w,n||"page")},charCoords:function(r,n){return ma(this,s(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,Br(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,w){var W=!1,Y;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,W=!0),Y=ct(this.doc,r)}else Y=r;return Hn(this,Y,{top:0,left:0},n||"page",w||W).top+(W?this.doc.height-$r(Y):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,w,W,Y){var J=this.display;r=Zr(this,s(this.doc,r));var ee=r.bottom,he=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),W=="over")ee=r.top;else if(W=="above"||W=="near"){var pe=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(W=="above"||r.bottom+n.offsetHeight>pe)&&r.top>n.offsetHeight?ee=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=pe&&(ee=r.bottom),he+n.offsetWidth>De&&(he=De-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",Y=="right"?(he=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?he=0:Y=="middle"&&(he=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=he+"px"),w&&Zs(this,{left:he,top:ee,right:he+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Sr(ps),triggerOnKeyPress:Sr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Sr(vs),execCommand:function(r){if(In.hasOwnProperty(r))return In[r].call(null,this)},triggerElectric:Sr(function(r){Ts(this,r)}),findPosH:function(r,n,w,W){var Y=1;n<0&&(Y=-1,n=-n);for(var J=s(this.doc,r),ee=0;ee<n&&!(J=Ka(this.doc,J,Y,w,W),J.hitSide);++ee);return J},moveH:Sr(function(r,n){var w=this;this.extendSelectionsBy(function(W){return w.display.shift||w.doc.extend||W.empty()?Ka(w.doc,W.head,r,n,w.options.rtlMoveVisually):r<0?W.from():W.to()},Te)}),deleteH:Sr(function(r,n){var w=this.doc.sel,W=this.doc;w.somethingSelected()?W.replaceSelection("",null,"+delete"):on(this,function(Y){var J=Ka(W,Y.head,r,n,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,n,w,W){var Y=1,J=W;n<0&&(Y=-1,n=-n);for(var ee=s(this.doc,r),he=0;he<n;++he){var pe=Zr(this,ee,"div");if(J==null?J=pe.left:pe.left=J,ee=Ls(this,pe,Y,w),ee.hitSide)break}return ee},moveV:Sr(function(r,n){var w=this,W=this.doc,Y=[],J=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(he){if(J)return r<0?he.from():he.to();var pe=Zr(w,he.head,"div");he.goalColumn!=null&&(pe.left=he.goalColumn),Y.push(pe.left);var De=Ls(w,pe,r,n);return n=="page"&&he==W.sel.primary()&&wa(w,ma(w,De,"div").top-pe.top),De},Te),Y.length)for(var ee=0;ee<W.sel.ranges.length;ee++)W.sel.ranges[ee].goalColumn=Y[ee]}),findWordAt:function(r){var n=this.doc,w=ct(n,r.line).text,W=r.ch,Y=r.ch;if(w){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==w.length)&&W?--W:++Y;for(var ee=w.charAt(W),he=Ne(ee,J)?function(pe){return Ne(pe,J)}:/\s/.test(ee)?function(pe){return/\s/.test(pe)}:function(pe){return!/\s/.test(pe)&&!Ne(pe)};W>0&&he(w.charAt(W-1));)--W;for(;Y<w.length&&he(w.charAt(Y));)++Y}return new jt($e(r.line,W),$e(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"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(r,n){En(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ii(this)-this.display.barHeight,width:r.scrollWidth-ii(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Mi(this)}},scrollIntoView:Sr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:$e(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Sr(function(r,n){var w=this,W=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};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(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Ci(w,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Be(this,"refresh",this)}),operation:function(r){return Pr(this,r)},startOperation:function(){return ji(this)},endOperation:function(){return Wi(this)},refresh:Sr(function(){var r=this.display.cachedTextHeight;_r(this),this.curOp.forceUpdate=!0,yn(this),En(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&xa(this),Be(this,"refresh",this)}),swapDoc:Sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yn(this),this.display.input.reset(),En(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,cr(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},be(e),e.registerHelper=function(r,n,w){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=w},e.registerGlobalHelper=function(r,n,w,W){e.registerHelper(r,n,W),i[r]._global.push({pred:w,val:W})}}function Ka(e,t,i,r,n){var w=t,W=i,Y=ct(e,t.line),J=n&&e.direction=="rtl"?-i:i;function ee(){var st=t.line+J;return st<e.first||st>=e.first+e.size?!1:(t=new $e(st,t.ch,t.sticky),Y=ct(e,st))}function he(st){var nt;if(r=="codepoint"){var ut=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ut)?nt=null:nt=new $e(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(ut>=55296&&ut<56320?2:1))),-i)}else n?nt=Ml(e.cm,Y,t,i):nt=Ba(Y,t,i);if(nt==null)if(!st&&ee())t=Ua(n,e.cm,Y,t.line,J);else return!1;else t=nt;return!0}if(r=="char"||r=="codepoint")he();else if(r=="column")he(!0);else if(r=="word"||r=="group")for(var pe=null,De=r=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Ue=!0;!(i<0&&!he(!Ue));Ue=!1){var Ke=Y.text.charAt(t.ch)||`
`,qe=Ne(Ke,Ae)?"w":De&&Ke==`
`?"n":!De||/\s/.test(Ke)?null:"p";if(De&&!Ue&&!qe&&(qe="s"),pe&&pe!=qe){i<0&&(i=1,he(),t.sticky="after");break}if(qe&&(pe=qe),i>0&&!he(!Ue))break}var it=ea(e,t,w,W,!0);return pi(w,it)&&(it.hitSide=!0),it}function Ls(e,t,i,r){var n=e.doc,w=t.left,W;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*Yi(e.display),3);W=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(W=i>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,w,W),!ee.outside);){if(i<0?W<=0:W>=n.height){ee.hitSide=!0;break}W+=i*5}return ee}var Ht=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ht.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 w(Y){for(var J=Y.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Pe(n,"paste",function(Y){if(!w(Y)||Xe(r,Y)||Cs(Y,r))return;U<=11&&setTimeout(or(r,function(){return t.updateFromDOM()}),20)}),Pe(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Pe(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Pe(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(n,"touchstart",function(){return i.forceCompositionEnd()}),Pe(n,"input",function(){t.composing||t.readFromDOMSoon()});function W(Y){if(!w(Y)||Xe(r,Y))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=ws(r);oa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var ee=Qr.text.join(`
`);if(Y.clipboardData.setData("Text",ee),Y.clipboardData.getData("Text")==ee){Y.preventDefault();return}}var he=As(),pe=he.firstChild;r.display.lineSpace.insertBefore(he,r.display.lineSpace.firstChild),pe.value=Qr.text.join(`
`);var De=document.activeElement;V(pe),setTimeout(function(){r.display.lineSpace.removeChild(he),De.focus(),De==n&&i.showPrimarySelection()},50)}Pe(n,"copy",W),Pe(n,"cut",W)},Ht.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ht.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ht.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ht.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ht.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var w=sa(t,e.anchorNode,e.anchorOffset),W=sa(t,e.focusNode,e.focusOffset);if(w&&!w.bad&&W&&!W.bad&&St(vi(w,W),r)==0&&St(gi(w,W),n)==0)return;var Y=t.display.view,J=r.line>=t.display.viewFrom&&Ds(t,r)||{node:Y[0].measure.map[2],offset:0},ee=n.line<t.display.viewTo&&Ds(t,n);if(!ee){var he=Y[Y.length-1].measure,pe=he.maps?he.maps[he.maps.length-1]:he.map;ee={node:pe[pe.length-1],offset:pe[pe.length-2]-pe[pe.length-3]}}if(!J||!ee){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=v(J.node,J.offset,ee.offset,ee.node)}catch(Ue){}Ae&&(!R&&t.state.focused?(e.collapse(J.node,J.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),De&&e.anchorNode==null?e.addRange(De):R&&this.startGracePeriod()),this.rememberSelection()},Ht.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)},Ht.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Ht.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ht.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},Ht.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ht.prototype.blur=function(){this.div.blur()},Ht.prototype.getField=function(){return this.div},Ht.prototype.supportsTouch=function(){return!0},Ht.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Pr(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)},Ht.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ht.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&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=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Pr(t,function(){br(t.doc,wi(i,r),Ee),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ht.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=$e(r.line-1,ct(e.doc,r.line-1).length)),n.ch==ct(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=$e(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var w,W,Y;r.line==t.viewFrom||(w=Fi(e,r.line))==0?(W=Lt(t.view[0].line),Y=t.view[0].node):(W=Lt(t.view[w].line),Y=t.view[w-1].node.nextSibling);var J=Fi(e,n.line),ee,he;if(J==t.view.length-1?(ee=t.viewTo-1,he=t.lineDiv.lastChild):(ee=Lt(t.view[J+1].line)-1,he=t.view[J+1].node.previousSibling),!Y)return!1;for(var pe=e.doc.splitLines(tu(e,Y,he,W,ee)),De=Hr(e.doc,$e(W,0),$e(ee,ct(e.doc,ee).text.length));pe.length>1&&De.length>1;)if(te(pe)==te(De))pe.pop(),De.pop(),ee--;else if(pe[0]==De[0])pe.shift(),De.shift(),W++;else break;for(var Ae=0,Ue=0,Ke=pe[0],qe=De[0],it=Math.min(Ke.length,qe.length);Ae<it&&Ke.charCodeAt(Ae)==qe.charCodeAt(Ae);)++Ae;for(var st=te(pe),nt=te(De),ut=Math.min(st.length-(pe.length==1?Ae:0),nt.length-(De.length==1?Ae:0));Ue<ut&&st.charCodeAt(st.length-Ue-1)==nt.charCodeAt(nt.length-Ue-1);)++Ue;if(pe.length==1&&De.length==1&&W==r.line)for(;Ae&&Ae>r.ch&&st.charCodeAt(st.length-Ue-1)==nt.charCodeAt(nt.length-Ue-1);)Ae--,Ue++;pe[pe.length-1]=st.slice(0,st.length-Ue).replace(/^\u200b+/,""),pe[0]=pe[0].slice(Ae).replace(/\u200b+$/,"");var xt=$e(W,Ae),vt=$e(ee,De.length?te(De).length-Ue:0);if(pe.length>1||pe[0]||St(xt,vt))return rn(e.doc,pe,xt,vt,"+input"),!0},Ht.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ht.prototype.reset=function(){this.forceCompositionEnd()},Ht.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ht.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)},Ht.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Pr(this.cm,function(){return _r(e.cm)})},Ht.prototype.setUneditable=function(e){e.contentEditable="false"},Ht.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||or(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ht.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ht.prototype.onContextMenu=function(){},Ht.prototype.resetPosition=function(){},Ht.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=ct(e.doc,t.line),n=eo(i,r,t.line),w=Je(r,e.doc.direction),W="left";if(w){var Y=je(w,t.ch);W=Y%2?"right":"left"}var J=io(n.map,t.ch,W);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var w="",W=!1,Y=e.doc.lineSeparator(),J=!1;function ee(Ae){return function(Ue){return Ue.id==Ae}}function he(){W&&(w+=Y,J&&(w+=Y),W=J=!1)}function pe(Ae){Ae&&(he(),w+=Ae)}function De(Ae){if(Ae.nodeType==1){var Ue=Ae.getAttribute("cm-text");if(Ue){pe(Ue);return}var Ke=Ae.getAttribute("cm-marker"),qe;if(Ke){var it=e.findMarks($e(r,0),$e(n+1,0),ee(+Ke));it.length&&(qe=it[0].find(0))&&pe(Hr(e.doc,qe.from,qe.to).join(Y));return}if(Ae.getAttribute("contenteditable")=="false")return;var st=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;st&&he();for(var nt=0;nt<Ae.childNodes.length;nt++)De(Ae.childNodes[nt]);/^(pre|p)$/i.test(Ae.nodeName)&&(J=!0),st&&(W=!0)}else Ae.nodeType==3&&pe(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,J=!1;return w}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos($e(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var w=e.display.view[n];if(w.node==r)return ru(w,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!S(r,t))return ln($e(Lt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var w=e.rest?te(e.rest):e.line;return ln($e(Lt(w),w.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 J=e.measure,ee=J.maps;function he(qe,it,st){for(var nt=-1;nt<(ee?ee.length:0);nt++)for(var ut=nt<0?J.map:ee[nt],xt=0;xt<ut.length;xt+=3){var vt=ut[xt+2];if(vt==qe||vt==it){var _t=Lt(nt<0?e.line:e.rest[nt]),Gt=ut[xt]+st;return(st<0||vt!=qe)&&(Gt=ut[xt+(st?1:0)]),$e(_t,Gt)}}}var pe=he(W,Y,i);if(pe)return ln(pe,n);for(var De=Y.nextSibling,Ae=W?W.nodeValue.length-i:0;De;De=De.nextSibling){if(pe=he(De,De.firstChild,0),pe)return ln($e(pe.line,pe.ch-Ae),n);Ae+=De.textContent.length}for(var Ue=Y.previousSibling,Ke=i;Ue;Ue=Ue.previousSibling){if(pe=he(Ue,Ue.firstChild,-1),pe)return ln($e(pe.line,pe.ch+Ke),n);Ke+=Ue.textContent.length}}var Qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};Qt.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),E&&(n.style.width="0px"),Pe(n,"input",function(){K&&U>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Pe(n,"paste",function(W){if(Xe(r,W)||Cs(W,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function w(W){if(Xe(r,W))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ws(r);oa({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)}Pe(n,"cut",w),Pe(n,"copy",w),Pe(e.scroller,"paste",function(W){if(ui(e,W)||Xe(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)}),Pe(e.lineSpace,"selectstart",function(W){ui(e,W)||ie(W)}),Pe(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"})}}),Pe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Qt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=Zr(e,i.sel.primary().head,"div"),w=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+W.top-w.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+W.left-w.left))}return r},Qt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Qt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),K&&U>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",K&&U>=9&&(this.hasSelection=null))},Qt.prototype.getField=function(){return this.textarea},Qt.prototype.supportsTouch=function(){return!1},Qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Qt.prototype.blur=function(){this.textarea.blur()},Qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Qt.prototype.receivedFocus=function(){this.slowPoll()},Qt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Qt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||dt(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(K&&U>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var w=n.charCodeAt(0);if(w==8203&&!r&&(r="\u200B"),w==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,Y=Math.min(r.length,n.length);W<Y&&r.charCodeAt(W)==n.charCodeAt(W);)++W;return Pr(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},Qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Qt.prototype.onKeyPress=function(){K&&U>=9&&(this.hasSelection=null),this.fastPoll()},Qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var w=Ni(i,e),W=r.scroller.scrollTop;if(!w||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(w)==-1&&or(i,br)(i.doc,wi(w),Ee);var J=n.style.cssText,ee=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.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 pe;N&&(pe=window.scrollY),r.input.focus(),N&&window.scrollTo(null,pe),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var Ke=i.somethingSelected(),qe="\u200B"+(Ke?n.value:"");n.value="\u21DA",n.value=qe,t.prevInput=Ke?"":"\u200B",n.selectionStart=1,n.selectionEnd=qe.length,r.selForContextMenu=i.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,K&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),n.selectionStart!=null){(!K||K&&U<9)&&De();var Ke=0,qe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?or(i,Xo)(i):Ke++<10?r.detectingSelectAll=setTimeout(qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(qe,200)}}if(K&&U>=9&&De(),L){me(e);var Ue=function(){at(window,"mouseup",Ue),setTimeout(Ae,20)};Pe(window,"mouseup",Ue)}else setTimeout(Ae,50)},Qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Qt.prototype.setUneditable=function(){},Qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?I(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=M();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var w=e.form;n=w.submit;try{var W=w.submit=function(){r(),w.submit=n,w.submit(),w.submit=W}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Vt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function nu(e){e.off=at,e.on=Pe,e.wheelEventPixels=hl,e.Doc=Ar,e.splitLines=Ct,e.countColumn=X,e.findColumn=ye,e.isWordChar=ke,e.Pass=Le,e.signal=Be,e.Line=Pi,e.changeEnd=_i,e.scrollbarModel=Co,e.Pos=$e,e.cmpPos=St,e.modes=Xt,e.mimeModes=kt,e.resolveMode=Et,e.getMode=Nr,e.modeExtensions=dr,e.extendMode=pr,e.copyState=Fr,e.startState=qr,e.innerMode=ci,e.commands=In,e.keyMap=di,e.keyName=us,e.isModifierKey=ss,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=On,e.TextMarker=Li,e.LineWidget=kn,e.e_preventDefault=ie,e.e_stopPropagation=ae,e.e_stop=me,e.addClass=j,e.contains=S,e.rmClass=c,e.keyNames=Di}$l(Vt),ql(Vt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Ar.prototype)Ar.prototype.hasOwnProperty(la)&&oe(au,la)<0&&(Vt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ar.prototype[la]));return be(Ar),Vt.inputStyles={textarea:Qt,contenteditable:Ht},Vt.defineMode=function(e){!Vt.defaults.mode&&e!="null"&&(Vt.defaults.mode=e),Ir.apply(this,arguments)},Vt.defineMIME=Kr,Vt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Vt.defineMIME("text/plain","null"),Vt.defineExtension=function(e,t){Vt.prototype[e]=t},Vt.defineDocExtension=function(e,t){Ar.prototype[e]=t},Vt.fromTextArea=iu,nu(Vt),Vt.version="5.58.2",Vt})},Y1PL:function(ht,Qe,re){"use strict";re.r(Qe),re.d(Qe,"ResizableTextArea",function(){return oe});var le=re("wx14"),$=re("1OyB"),R=re("vuIU"),Z=re("Ji7U"),B=re("LK+K"),P=re("q1tI"),K=re("VTBJ"),U=re("rePB"),N=re("Zm9Q"),D=re("Kwbf"),b=re("c+Xe"),A=re("m+aA"),k=re("bdgK"),T=new Map;function C(Ee){Ee.forEach(function(we){var Te,ye=we.target;(Te=T.get(ye))===null||Te===void 0||Te.forEach(function(fe){return fe(ye)})})}var E=new k.default(C),d=null,a=null;function l(Ee,we){T.has(Ee)||(T.set(Ee,new Set),E.observe(Ee)),T.get(Ee).add(we)}function h(Ee,we){T.has(Ee)&&(T.get(Ee).delete(we),T.get(Ee).size||(E.unobserve(Ee),T.delete(Ee)))}var _=function(Ee){Object(Z.a)(Te,Ee);var we=Object(B.a)(Te);function Te(){return Object($.a)(this,Te),we.apply(this,arguments)}return Object(R.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(P.Component),g=P.createContext(null);function m(Ee){var we=Ee.children,Te=Ee.onBatchResize,ye=P.useRef(0),fe=P.useRef([]),se=P.useContext(g),te=P.useCallback(function(ue,ne,_e){ye.current+=1;var Re=ye.current;fe.current.push({size:ue,element:ne,data:_e}),Promise.resolve().then(function(){Re===ye.current&&(Te==null||Te(fe.current),fe.current=[])}),se==null||se(ue,ne,_e)},[Te,se]);return P.createElement(g.Provider,{value:te},we)}function L(Ee){var we=Ee.children,Te=Ee.disabled,ye=P.useRef(null),fe=P.useRef(null),se=P.useContext(g),te=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ue=P.isValidElement(we)&&Object(b.c)(we),ne=ue?we.ref:null,_e=P.useMemo(function(){return Object(b.a)(ne,ye)},[ne,ye]),Re=P.useRef(Ee);Re.current=Ee;var xe=P.useCallback(function(ke){var Ne=Re.current,He=Ne.onResize,Fe=Ne.data,Me=ke.getBoundingClientRect(),Oe=Me.width,Ye=Me.height,Ze=ke.offsetWidth,Ve=ke.offsetHeight,je=Math.floor(Oe),rt=Math.floor(Ye);if(te.current.width!==je||te.current.height!==rt||te.current.offsetWidth!==Ze||te.current.offsetHeight!==Ve){var Je={width:je,height:rt,offsetWidth:Ze,offsetHeight:Ve};te.current=Je;var tt=Ze===Math.round(Oe)?Oe:Ze,Pe=Ve===Math.round(Ye)?Ye:Ve,lt=Object(K.a)(Object(K.a)({},Je),{},{offsetWidth:tt,offsetHeight:Pe});se==null||se(lt,ke,Fe),He&&Promise.resolve().then(function(){He(lt,ke)})}},[]);return P.useEffect(function(){var ke=Object(A.a)(ye.current)||Object(A.a)(fe.current);return ke&&!Te&&l(ke,xe),function(){return h(ke,xe)}},[ye.current,Te]),P.createElement(_,{ref:fe},ue?P.cloneElement(we,{ref:_e}):we)}var y="rc-observer-key";function c(Ee){var we=Ee.children,Te=Object(N.a)(we);return Te.map(function(ye,fe){var se=(ye==null?void 0:ye.key)||"".concat(y,"-").concat(fe);return P.createElement(L,Object(le.a)({},Ee,{key:se}),ye)})}c.Collection=m;var f=c,u=re("bT9E"),o=re("TSYQ"),x=re.n(o),v=`
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
`,S=["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"],M={},j;function G(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(we&&M[Te])return M[Te];var ye=window.getComputedStyle(Ee),fe=ye.getPropertyValue("box-sizing")||ye.getPropertyValue("-moz-box-sizing")||ye.getPropertyValue("-webkit-box-sizing"),se=parseFloat(ye.getPropertyValue("padding-bottom"))+parseFloat(ye.getPropertyValue("padding-top")),te=parseFloat(ye.getPropertyValue("border-bottom-width"))+parseFloat(ye.getPropertyValue("border-top-width")),ue=S.map(function(_e){return"".concat(_e,":").concat(ye.getPropertyValue(_e))}).join(";"),ne={sizingStyle:ue,paddingSize:se,borderSize:te,boxSizing:fe};return we&&Te&&(M[Te]=ne),ne}function V(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ye=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 fe=G(Ee,we),se=fe.paddingSize,te=fe.borderSize,ue=fe.boxSizing,ne=fe.sizingStyle;j.setAttribute("style","".concat(ne,";").concat(v)),j.value=Ee.value||Ee.placeholder||"";var _e=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,xe=j.scrollHeight,ke;if(ue==="border-box"?xe+=te:ue==="content-box"&&(xe-=se),Te!==null||ye!==null){j.value=" ";var Ne=j.scrollHeight-se;Te!==null&&(_e=Ne*Te,ue==="border-box"&&(_e=_e+se+te),xe=Math.max(_e,xe)),ye!==null&&(Re=Ne*ye,ue==="border-box"&&(Re=Re+se+te),ke=xe>Re?"":"hidden",xe=Math.min(Re,xe))}return{height:xe,minHeight:_e,maxHeight:Re,overflowY:ke,resize:"none"}}var O=re("Gytx"),I=re.n(O),X;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(Ee){Object(Z.a)(Te,Ee);var we=Object(B.a)(Te);function Te(ye){var fe;return Object($.a)(this,Te),fe=we.call(this,ye),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(se){fe.textArea=se},fe.handleResize=function(se){var te=fe.state.resizeStatus,ue=fe.props,ne=ue.autoSize,_e=ue.onResize;if(te!==X.NONE)return;typeof _e=="function"&&_e(se),ne&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var se=fe.props.autoSize;if(!se||!fe.textArea)return;var te=se.minRows,ue=se.maxRows,ne=V(fe.textArea,!1,te,ue);fe.setState({textareaStyles:ne,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:X.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:X.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var se=fe.props,te=se.prefixCls,ue=te===void 0?"rc-textarea":te,ne=se.autoSize,_e=se.onResize,Re=se.className,xe=se.disabled,ke=fe.state,Ne=ke.textareaStyles,He=ke.resizeStatus,Fe=Object(u.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=x()(ue,Re,Object(U.a)({},"".concat(ue,"-disabled"),xe));"value"in Fe&&(Fe.value=Fe.value||"");var Oe=Object(K.a)(Object(K.a)(Object(K.a)({},fe.props.style),Ne),He===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(f,{onResize:fe.handleResize,disabled:!(ne||_e)},P.createElement("textarea",Object(le.a)({},Fe,{className:Me,style:Oe,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:X.NONE},fe}return Object(R.a)(Te,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!I()(fe.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 fe=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,se)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(P.Component),oe=q,ce=function(Ee){Object(Z.a)(Te,Ee);var we=Object(B.a)(Te);function Te(ye){var fe;Object($.a)(this,Te),fe=we.call(this,ye),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(te){fe.resizableTextArea=te},fe.handleChange=function(te){var ue=fe.props.onChange;fe.setValue(te.target.value,function(){fe.resizableTextArea.resizeTextarea()}),ue&&ue(te)},fe.handleKeyDown=function(te){var ue=fe.props,ne=ue.onPressEnter,_e=ue.onKeyDown;te.keyCode===13&&ne&&ne(te),_e&&_e(te)};var se=typeof ye.value=="undefined"||ye.value===null?ye.defaultValue:ye.value;return fe.state={value:se},fe}return Object(R.a)(Te,[{key:"setValue",value:function(fe,se){"value"in this.props||this.setState({value:fe},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Te}(P.Component),Le=Qe.default=ce},ZpRC:function(ht,Qe,re){"use strict";function le(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function $(b,A){return(!A||b!=="hidden")&&b!=="visible"&&b!=="clip"}function R(b,A){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var k=getComputedStyle(b,null);return $(k.overflowY,A)||$(k.overflowX,A)||function(T){var C=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(d){return null}}(T);return!!C&&(C.clientHeight<T.scrollHeight||C.clientWidth<T.scrollWidth)}(b)}return!1}function Z(b,A,k,T,C,E,d,a){return E<b&&d>A||E>b&&d<A?0:E<=b&&a<=k||d>=A&&a>=k?E-b-T:d>A&&a<k||E<b&&a>k?d-A+C:0}var B=function(b,A){var k=window,T=A.scrollMode,C=A.block,E=A.inline,d=A.boundary,a=A.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Ne){return Ne!==d};if(!le(b))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,_=[],g=b;le(g)&&l(g);){if((g=g.parentElement)===h){_.push(g);break}g!=null&&g===document.body&&R(g)&&!R(document.documentElement)||g!=null&&R(g,a)&&_.push(g)}for(var m=k.visualViewport?k.visualViewport.width:innerWidth,L=k.visualViewport?k.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=b.getBoundingClientRect(),u=f.height,o=f.width,x=f.top,v=f.right,S=f.bottom,M=f.left,j=C==="start"||C==="nearest"?x:C==="end"?S:x+u/2,G=E==="center"?M+o/2:E==="end"?v:M,V=[],O=0;O<_.length;O++){var I=_[O],X=I.getBoundingClientRect(),q=X.height,oe=X.width,ce=X.top,Le=X.right,Ee=X.bottom,we=X.left;if(T==="if-needed"&&x>=0&&M>=0&&S<=L&&v<=m&&x>=ce&&S<=Ee&&M>=we&&v<=Le)return V;var Te=getComputedStyle(I),ye=parseInt(Te.borderLeftWidth,10),fe=parseInt(Te.borderTopWidth,10),se=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),ue=0,ne=0,_e="offsetWidth"in I?I.offsetWidth-I.clientWidth-ye-se:0,Re="offsetHeight"in I?I.offsetHeight-I.clientHeight-fe-te:0;if(h===I)ue=C==="start"?j:C==="end"?j-L:C==="nearest"?Z(c,c+L,L,fe,te,c+j,c+j+u,u):j-L/2,ne=E==="start"?G:E==="center"?G-m/2:E==="end"?G-m:Z(y,y+m,m,ye,se,y+G,y+G+o,o),ue=Math.max(0,ue+c),ne=Math.max(0,ne+y);else{ue=C==="start"?j-ce-fe:C==="end"?j-Ee+te+Re:C==="nearest"?Z(ce,Ee,q,fe,te+Re,j,j+u,u):j-(ce+q/2)+Re/2,ne=E==="start"?G-we-ye:E==="center"?G-(we+oe/2)+_e/2:E==="end"?G-Le+se+_e:Z(we,Le,oe,ye,se+_e,G,G+o,o);var xe=I.scrollLeft,ke=I.scrollTop;j+=ke-(ue=Math.max(0,Math.min(ke+ue,I.scrollHeight-q+Re))),G+=xe-(ne=Math.max(0,Math.min(xe+ne,I.scrollWidth-oe+_e)))}V.push({el:I,top:ue,left:ne})}return V};function P(b){return b===Object(b)&&Object.keys(b).length!==0}function K(b,A){A===void 0&&(A="auto");var k="scrollBehavior"in document.body.style;b.forEach(function(T){var C=T.el,E=T.top,d=T.left;C.scroll&&k?C.scroll({top:E,left:d,behavior:A}):(C.scrollTop=E,C.scrollLeft=d)})}function U(b){return b===!1?{block:"end",inline:"nearest"}:P(b)?b:{block:"start",inline:"nearest"}}function N(b,A){var k=!b.ownerDocument.documentElement.contains(b);if(P(A)&&typeof A.behavior=="function")return A.behavior(k?[]:B(b,A));if(k)return;var T=U(A);return K(B(b,T),T.behavior)}var D=Qe.a=N},Zss7:function(ht,Qe,re){var le;(function($){var R=/^\s+/,Z=/\s+$/,B=0,P=$.round,K=$.min,U=$.max,N=$.random;function D(te,ue){if(te=te||"",ue=ue||{},te instanceof D)return te;if(!(this instanceof D))return new D(te,ue);var ne=b(te);this._originalInput=te,this._r=ne.r,this._g=ne.g,this._b=ne.b,this._a=ne.a,this._roundA=P(100*this._a)/100,this._format=ue.format||ne.format,this._gradientType=ue.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ne.ok,this._tc_id=B++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),ue,ne,_e,Re,xe,ke;return ue=te.r/255,ne=te.g/255,_e=te.b/255,ue<=.03928?Re=ue/12.92:Re=$.pow((ue+.055)/1.055,2.4),ne<=.03928?xe=ne/12.92:xe=$.pow((ne+.055)/1.055,2.4),_e<=.03928?ke=_e/12.92:ke=$.pow((_e+.055)/1.055,2.4),.2126*Re+.7152*xe+.0722*ke},setAlpha:function(te){return this._a=V(te),this._roundA=P(100*this._a)/100,this},toHsv:function(){var te=C(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=C(this._r,this._g,this._b),ue=P(te.h*360),ne=P(te.s*100),_e=P(te.v*100);return this._a==1?"hsv("+ue+", "+ne+"%, "+_e+"%)":"hsva("+ue+", "+ne+"%, "+_e+"%, "+this._roundA+")"},toHsl:function(){var te=k(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=k(this._r,this._g,this._b),ue=P(te.h*360),ne=P(te.s*100),_e=P(te.l*100);return this._a==1?"hsl("+ue+", "+ne+"%, "+_e+"%)":"hsla("+ue+", "+ne+"%, "+_e+"%, "+this._roundA+")"},toHex:function(te){return d(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(O(this._r,255)*100)+"%",g:P(O(this._g,255)*100)+"%",b:P(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%)":"rgba("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:j[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var ue="#"+l(this._r,this._g,this._b,this._a),ne=ue,_e=this._gradientType?"GradientType = 1, ":"";if(te){var Re=D(te);ne="#"+l(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+_e+"startColorstr="+ue+",endColorstr="+ne+")"},toString:function(te){var ue=!!te;te=te||this._format;var ne=!1,_e=this._a<1&&this._a>=0,Re=!ue&&_e&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ne=this.toRgbString()),te==="prgb"&&(ne=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ne=this.toHexString()),te==="hex3"&&(ne=this.toHexString(!0)),te==="hex4"&&(ne=this.toHex8String(!0)),te==="hex8"&&(ne=this.toHex8String()),te==="name"&&(ne=this.toName()),te==="hsl"&&(ne=this.toHslString()),te==="hsv"&&(ne=this.toHsvString()),ne||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(te,ue){var ne=te.apply(null,[this].concat([].slice.call(ue)));return this._r=ne._r,this._g=ne._g,this._b=ne._b,this.setAlpha(ne._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(h,arguments)},saturate:function(){return this._applyModification(_,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(te,ue){return te.apply(null,[this].concat([].slice.call(ue)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},D.fromRatio=function(te,ue){if(typeof te=="object"){var ne={};for(var _e in te)te.hasOwnProperty(_e)&&(_e==="a"?ne[_e]=te[_e]:ne[_e]=Le(te[_e]));te=ne}return D(te,ue)};function b(te){var ue={r:0,g:0,b:0},ne=1,_e=null,Re=null,xe=null,ke=!1,Ne=!1;return typeof te=="string"&&(te=fe(te)),typeof te=="object"&&(ye(te.r)&&ye(te.g)&&ye(te.b)?(ue=A(te.r,te.g,te.b),ke=!0,Ne=String(te.r).substr(-1)==="%"?"prgb":"rgb"):ye(te.h)&&ye(te.s)&&ye(te.v)?(_e=Le(te.s),Re=Le(te.v),ue=E(te.h,_e,Re),ke=!0,Ne="hsv"):ye(te.h)&&ye(te.s)&&ye(te.l)&&(_e=Le(te.s),xe=Le(te.l),ue=T(te.h,_e,xe),ke=!0,Ne="hsl"),te.hasOwnProperty("a")&&(ne=te.a)),ne=V(ne),{ok:ke,format:te.format||Ne,r:K(255,U(ue.r,0)),g:K(255,U(ue.g,0)),b:K(255,U(ue.b,0)),a:ne}}function A(te,ue,ne){return{r:O(te,255)*255,g:O(ue,255)*255,b:O(ne,255)*255}}function k(te,ue,ne){te=O(te,255),ue=O(ue,255),ne=O(ne,255);var _e=U(te,ue,ne),Re=K(te,ue,ne),xe,ke,Ne=(_e+Re)/2;if(_e==Re)xe=ke=0;else{var He=_e-Re;ke=Ne>.5?He/(2-_e-Re):He/(_e+Re);switch(_e){case te:xe=(ue-ne)/He+(ue<ne?6:0);break;case ue:xe=(ne-te)/He+2;break;case ne:xe=(te-ue)/He+4;break}xe/=6}return{h:xe,s:ke,l:Ne}}function T(te,ue,ne){var _e,Re,xe;te=O(te,360),ue=O(ue,100),ne=O(ne,100);function ke(Fe,Me,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Fe+(Me-Fe)*6*Oe:Oe<1/2?Me:Oe<2/3?Fe+(Me-Fe)*(2/3-Oe)*6:Fe}if(ue===0)_e=Re=xe=ne;else{var Ne=ne<.5?ne*(1+ue):ne+ue-ne*ue,He=2*ne-Ne;_e=ke(He,Ne,te+1/3),Re=ke(He,Ne,te),xe=ke(He,Ne,te-1/3)}return{r:_e*255,g:Re*255,b:xe*255}}function C(te,ue,ne){te=O(te,255),ue=O(ue,255),ne=O(ne,255);var _e=U(te,ue,ne),Re=K(te,ue,ne),xe,ke,Ne=_e,He=_e-Re;if(ke=_e===0?0:He/_e,_e==Re)xe=0;else{switch(_e){case te:xe=(ue-ne)/He+(ue<ne?6:0);break;case ue:xe=(ne-te)/He+2;break;case ne:xe=(te-ue)/He+4;break}xe/=6}return{h:xe,s:ke,v:Ne}}function E(te,ue,ne){te=O(te,360)*6,ue=O(ue,100),ne=O(ne,100);var _e=$.floor(te),Re=te-_e,xe=ne*(1-ue),ke=ne*(1-Re*ue),Ne=ne*(1-(1-Re)*ue),He=_e%6,Fe=[ne,ke,xe,xe,Ne,ne][He],Me=[Ne,ne,ne,ke,xe,xe][He],Oe=[xe,xe,Ne,ne,ne,ke][He];return{r:Fe*255,g:Me*255,b:Oe*255}}function d(te,ue,ne,_e){var Re=[ce(P(te).toString(16)),ce(P(ue).toString(16)),ce(P(ne).toString(16))];return _e&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function a(te,ue,ne,_e,Re){var xe=[ce(P(te).toString(16)),ce(P(ue).toString(16)),ce(P(ne).toString(16)),ce(Ee(_e))];return Re&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function l(te,ue,ne,_e){var Re=[ce(Ee(_e)),ce(P(te).toString(16)),ce(P(ue).toString(16)),ce(P(ne).toString(16))];return Re.join("")}D.equals=function(te,ue){return!te||!ue?!1:D(te).toRgbString()==D(ue).toRgbString()},D.random=function(){return D.fromRatio({r:N(),g:N(),b:N()})};function h(te,ue){ue=ue===0?0:ue||10;var ne=D(te).toHsl();return ne.s-=ue/100,ne.s=I(ne.s),D(ne)}function _(te,ue){ue=ue===0?0:ue||10;var ne=D(te).toHsl();return ne.s+=ue/100,ne.s=I(ne.s),D(ne)}function g(te){return D(te).desaturate(100)}function m(te,ue){ue=ue===0?0:ue||10;var ne=D(te).toHsl();return ne.l+=ue/100,ne.l=I(ne.l),D(ne)}function L(te,ue){ue=ue===0?0:ue||10;var ne=D(te).toRgb();return ne.r=U(0,K(255,ne.r-P(255*-(ue/100)))),ne.g=U(0,K(255,ne.g-P(255*-(ue/100)))),ne.b=U(0,K(255,ne.b-P(255*-(ue/100)))),D(ne)}function y(te,ue){ue=ue===0?0:ue||10;var ne=D(te).toHsl();return ne.l-=ue/100,ne.l=I(ne.l),D(ne)}function c(te,ue){var ne=D(te).toHsl(),_e=(ne.h+ue)%360;return ne.h=_e<0?360+_e:_e,D(ne)}function f(te){var ue=D(te).toHsl();return ue.h=(ue.h+180)%360,D(ue)}function u(te){var ue=D(te).toHsl(),ne=ue.h;return[D(te),D({h:(ne+120)%360,s:ue.s,l:ue.l}),D({h:(ne+240)%360,s:ue.s,l:ue.l})]}function o(te){var ue=D(te).toHsl(),ne=ue.h;return[D(te),D({h:(ne+90)%360,s:ue.s,l:ue.l}),D({h:(ne+180)%360,s:ue.s,l:ue.l}),D({h:(ne+270)%360,s:ue.s,l:ue.l})]}function x(te){var ue=D(te).toHsl(),ne=ue.h;return[D(te),D({h:(ne+72)%360,s:ue.s,l:ue.l}),D({h:(ne+216)%360,s:ue.s,l:ue.l})]}function v(te,ue,ne){ue=ue||6,ne=ne||30;var _e=D(te).toHsl(),Re=360/ne,xe=[D(te)];for(_e.h=(_e.h-(Re*ue>>1)+720)%360;--ue;)_e.h=(_e.h+Re)%360,xe.push(D(_e));return xe}function S(te,ue){ue=ue||6;for(var ne=D(te).toHsv(),_e=ne.h,Re=ne.s,xe=ne.v,ke=[],Ne=1/ue;ue--;)ke.push(D({h:_e,s:Re,v:xe})),xe=(xe+Ne)%1;return ke}D.mix=function(te,ue,ne){ne=ne===0?0:ne||50;var _e=D(te).toRgb(),Re=D(ue).toRgb(),xe=ne/100,ke={r:(Re.r-_e.r)*xe+_e.r,g:(Re.g-_e.g)*xe+_e.g,b:(Re.b-_e.b)*xe+_e.b,a:(Re.a-_e.a)*xe+_e.a};return D(ke)},D.readability=function(te,ue){var ne=D(te),_e=D(ue);return($.max(ne.getLuminance(),_e.getLuminance())+.05)/($.min(ne.getLuminance(),_e.getLuminance())+.05)},D.isReadable=function(te,ue,ne){var _e=D.readability(te,ue),Re,xe;xe=!1,Re=se(ne);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":xe=_e>=4.5;break;case"AAlarge":xe=_e>=3;break;case"AAAsmall":xe=_e>=7;break}return xe},D.mostReadable=function(te,ue,ne){var _e=null,Re=0,xe,ke,Ne,He;ne=ne||{},ke=ne.includeFallbackColors,Ne=ne.level,He=ne.size;for(var Fe=0;Fe<ue.length;Fe++)xe=D.readability(te,ue[Fe]),xe>Re&&(Re=xe,_e=D(ue[Fe]));return D.isReadable(te,_e,{level:Ne,size:He})||!ke?_e:(ne.includeFallbackColors=!1,D.mostReadable(te,["#fff","#000"],ne))};var M=D.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=D.hexNames=G(M);function G(te){var ue={};for(var ne in te)te.hasOwnProperty(ne)&&(ue[te[ne]]=ne);return ue}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function O(te,ue){q(te)&&(te="100%");var ne=oe(te);return te=K(ue,U(0,parseFloat(te))),ne&&(te=parseInt(te*ue,10)/100),$.abs(te-ue)<1e-6?1:te%ue/parseFloat(ue)}function I(te){return K(1,U(0,te))}function X(te){return parseInt(te,16)}function q(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function ce(te){return te.length==1?"0"+te:""+te}function Le(te){return te<=1&&(te=te*100+"%"),te}function Ee(te){return $.round(parseFloat(te)*255).toString(16)}function we(te){return X(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",ue="[-\\+]?\\d*\\.\\d+%?",ne="(?:"+ue+")|(?:"+te+")",_e="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?",Re="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?";return{CSS_UNIT:new RegExp(ne),rgb:new RegExp("rgb"+_e),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+_e),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+_e),hsva:new RegExp("hsva"+Re),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ye(te){return!!Te.CSS_UNIT.exec(te)}function fe(te){te=te.replace(R,"").replace(Z,"").toLowerCase();var ue=!1;if(M[te])te=M[te],ue=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ne;return(ne=Te.rgb.exec(te))?{r:ne[1],g:ne[2],b:ne[3]}:(ne=Te.rgba.exec(te))?{r:ne[1],g:ne[2],b:ne[3],a:ne[4]}:(ne=Te.hsl.exec(te))?{h:ne[1],s:ne[2],l:ne[3]}:(ne=Te.hsla.exec(te))?{h:ne[1],s:ne[2],l:ne[3],a:ne[4]}:(ne=Te.hsv.exec(te))?{h:ne[1],s:ne[2],v:ne[3]}:(ne=Te.hsva.exec(te))?{h:ne[1],s:ne[2],v:ne[3],a:ne[4]}:(ne=Te.hex8.exec(te))?{r:X(ne[1]),g:X(ne[2]),b:X(ne[3]),a:we(ne[4]),format:ue?"name":"hex8"}:(ne=Te.hex6.exec(te))?{r:X(ne[1]),g:X(ne[2]),b:X(ne[3]),format:ue?"name":"hex"}:(ne=Te.hex4.exec(te))?{r:X(ne[1]+""+ne[1]),g:X(ne[2]+""+ne[2]),b:X(ne[3]+""+ne[3]),a:we(ne[4]+""+ne[4]),format:ue?"name":"hex8"}:(ne=Te.hex3.exec(te))?{r:X(ne[1]+""+ne[1]),g:X(ne[2]+""+ne[2]),b:X(ne[3]+""+ne[3]),format:ue?"name":"hex"}:!1}function se(te){var ue,ne;return te=te||{level:"AA",size:"small"},ue=(te.level||"AA").toUpperCase(),ne=(te.size||"small").toLowerCase(),ue!=="AA"&&ue!=="AAA"&&(ue="AA"),ne!=="small"&&ne!=="large"&&(ne="small"),{level:ue,size:ne}}ht.exports?ht.exports=D:!(le=function(){return D}.call(Qe,re,Qe,ht),le!==void 0&&(ht.exports=le))})(Math)},bT9E:function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return $});var le=re("VTBJ");function $(R,Z){var B=Object(le.a)({},R);return Array.isArray(Z)&&Z.forEach(function(P){delete B[P]}),B}},c5Ni:function(ht,Qe,re){},dejd:function(ht,Qe,re){},dmUQ:function(ht,Qe,re){"use strict";var le=re("Ff2n"),$=re("rePB"),R=re("1OyB"),Z=re("vuIU"),B=re("Ji7U"),P=re("md7G"),K=re("foSv"),U=re("q1tI"),N=re.n(U),D=re("TSYQ"),b=re.n(D),A=re("4IlW");function k(u,o){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);o&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(u,S).enumerable})),x.push.apply(x,v)}return x}function T(u){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?k(Object(x),!0).forEach(function(v){Object($.a)(u,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):k(Object(x)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(x,v))})}return u}function C(u){var o=E();return function(){var v=Object(K.a)(u),S;if(o){var M=Object(K.a)(this).constructor;S=Reflect.construct(v,arguments,M)}else S=v.apply(this,arguments);return Object(P.a)(this,S)}}function E(){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 d(){}function a(u){u.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},h=200,_=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},L=function(o,x){return x===o||typeof x=="number"&&typeof o=="number"&&isNaN(x)&&isNaN(o)},y=function(u){Object(B.a)(x,u);var o=C(x);function x(v){var S;Object(R.a)(this,x),S=o.call(this,v),S.onKeyDown=function(G){var V=S.props,O=V.onKeyDown,I=V.onPressEnter;if(G.keyCode===A.a.UP){var X=S.getRatio(G);S.up(G,X,null),S.stop()}else if(G.keyCode===A.a.DOWN){var q=S.getRatio(G);S.down(G,q,null),S.stop()}else G.keyCode===A.a.ENTER&&I&&I(G);if(S.recordCursorPosition(),S.lastKeyCode=G.keyCode,O){for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),Le=1;Le<oe;Le++)ce[Le-1]=arguments[Le];O.apply(void 0,[G].concat(ce))}},S.onKeyUp=function(G){var V=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),V){for(var O=arguments.length,I=new Array(O>1?O-1:0),X=1;X<O;X++)I[X-1]=arguments[X];V.apply(void 0,[G].concat(I))}},S.onChange=function(G){var V=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(G)),S.setState({inputValue:S.rawInput}),V(S.toNumber(S.rawInput))},S.onMouseUp=function(){var G=S.props.onMouseUp;S.recordCursorPosition(),G&&G.apply(void 0,arguments)},S.onFocus=function(){var G;S.setState({focused:!0}),(G=S.props).onFocus.apply(G,arguments)},S.onBlur=function(){var G=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var V=S.getCurrentValidValue(S.state.inputValue),O=S.setValue(V,d);if(G){var I=S.input.value,X=S.getInputDisplayValue({focus:!1,value:O});S.input.value=X&&Number(X),G.apply(void 0,arguments),S.input.value=I}},S.getRatio=function(G){var V=1;return G.metaKey||G.ctrlKey?V=.1:G.shiftKey&&(V=10),V},S.getFullNum=function(G){return isNaN(G)?G:/e/i.test(String(G))?Number(G).toFixed(18).replace(/\.?0+$/,""):G},S.getPrecision=function(G){if(m(S.props.precision))return S.props.precision;var V=String(G);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var O=0;return V.indexOf(".")>=0&&(O=V.length-V.indexOf(".")-1),O},S.getInputDisplayValue=function(G){var V=G||S.state,O=V.focused,I=V.inputValue,X=V.value,q;O?q=I:q=S.toPrecisionAsStep(X),q==null&&(q="");var oe=S.formatWrapper(q);return m(S.props.decimalSeparator)&&(oe=oe.toString().replace(".",S.props.decimalSeparator)),oe},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(G){}},S.restoreByAfter=function(G){if(G===void 0)return!1;var V=S.input.value,O=V.lastIndexOf(G);if(O===-1)return!1;var I=S.cursorBefore.length;return S.lastKeyCode===A.a.DELETE&&S.cursorBefore.charAt(I-1)===G[0]?(S.fixCaret(I,I),!0):O+G.length===V.length?(S.fixCaret(O,O),!0):!1},S.partRestoreByAfter=function(G){return G===void 0?!1:Array.prototype.some.call(G,function(V,O){var I=G.substring(O);return S.restoreByAfter(I)})},S.isNotCompleteNumber=function(G){return isNaN(G)||G===""||G===null||G&&G.toString().indexOf(".")===G.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(G,V,O){S.pressingUpOrDown=!0,S.step("down",G,V,O)},S.up=function(G,V,O){S.pressingUpOrDown=!0,S.step("up",G,V,O)},S.saveInput=function(G){S.input=G};var M=v.value;M===void 0&&(M=v.defaultValue),S.state={focused:v.autoFocus};var j=S.getValidValue(S.toNumber(M));return S.state=T(T({},S.state),{},{inputValue:S.toPrecisionAsStep(j),value:j}),S}return Object(Z.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var M=this.props,j=M.value,G=M.onChange,V=M.max,O=M.min,I=this.state.focused;if(S){if(!L(S.value,j)||!L(S.max,V)||!L(S.min,O)){var X=I?j:this.getValidValue(j),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var oe="value"in this.props?j:this.state.value;"max"in this.props&&S.max!==V&&typeof oe=="number"&&oe>V&&G&&G(V),"min"in this.props&&S.min!==O&&typeof oe=="number"&&oe<O&&G&&G(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ce=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ce=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ce=this.cursorStart):ce=this.input.value.length,this.fixCaret(ce,ce)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(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(S){var M=S;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(S){var M=S.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(S){var M=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(S);return isNaN(G)?S:(G<M&&(G=M),G>j&&(G=j),G)}},{key:"setValue",value:function(S,M){var j=this.props.precision,G=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),V=this.state.value,O=V===void 0?null:V,I=this.state.inputValue,X=I===void 0?null:I,q=typeof G=="number"?G.toFixed(j):"".concat(G),oe=G!==O||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},M)):this.setState({value:G,inputValue:this.toPrecisionAsStep(S)},M),oe&&this.props.onChange(G),G}},{key:"getMaxPrecision",value:function(S){var M=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 O=this.getPrecision(M),I=this.getPrecision(V),X=this.getPrecision(S);return S?Math.max(X,O+I):O+I}},{key:"getPrecisionFactor",value:function(S){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(S,M);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(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var M=Math.abs(this.getMaxPrecision(S));return isNaN(M)?S.toString():Number(S).toFixed(M)}},{key:"toNumber",value:function(S){var M=this.props.precision,j=this.state.focused,G=S&&S.length>16&&j;return this.isNotCompleteNumber(S)||G?S:m(M)?Math.round(S*Math.pow(10,M))/Math.pow(10,M):Number(S)}},{key:"upStep",value:function(S,M){var j=this.props.step,G=this.getPrecisionFactor(S,M),V=Math.abs(this.getMaxPrecision(S,M)),O=((G*S+G*j*M)/G).toFixed(V);return this.toNumber(O)}},{key:"downStep",value:function(S,M){var j=this.props.step,G=this.getPrecisionFactor(S,M),V=Math.abs(this.getMaxPrecision(S,M)),O=((G*S-G*j*M)/G).toFixed(V);return this.toNumber(O)}},{key:"step",value:function(S,M){var j=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var O=this.props;if(O.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var X=this["".concat(S,"Step")](I,G),q=X>O.max||X<O.min;if(X>O.max?X=O.max:X<O.min&&(X=O.min),this.setValue(X,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){j[S](M,G,!0)},V?h:_)}},{key:"fixCaret",value:function(S,M){if(S===void 0||M===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,G=this.input.selectionEnd;(S!==j||M!==G)&&this.input.setSelectionRange(S,M)}catch(V){}}},{key:"render",value:function(){var S,M=this.props,j=M.prefixCls,G=M.disabled,V=M.readOnly,O=M.useTouch,I=M.autoComplete,X=M.upHandler,q=M.downHandler,oe=M.className,ce=M.max,Le=M.min,Ee=M.style,we=M.title,Te=M.onMouseEnter,ye=M.onMouseLeave,fe=M.onMouseOver,se=M.onMouseOut,te=M.required,ue=M.onClick,ne=M.tabIndex,_e=M.type,Re=M.placeholder,xe=M.id,ke=M.inputMode,Ne=M.pattern,He=M.step,Fe=M.maxLength,Me=M.autoFocus,Oe=M.name,Ye=M.onPaste,Ze=M.onInput,Ve=Object(le.a)(M,["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"]),je=this.state,rt=je.value,Je=je.focused,tt=b()(j,(S={},Object($.a)(S,oe,!!oe),Object($.a)(S,"".concat(j,"-disabled"),G),Object($.a)(S,"".concat(j,"-focused"),Je),S)),Pe={};Object.keys(Ve).forEach(function(me){(me.substr(0,5)==="data-"||me.substr(0,5)==="aria-"||me==="role")&&(Pe[me]=Ve[me])});var lt=!V&&!G,at=this.getInputDisplayValue(null),Be=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=ce),Xe=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Le),Ce=Be||G||V,ve=Xe||G||V,be=b()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object($.a)({},"".concat(j,"-handler-up-disabled"),Ce)),ie=b()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object($.a)({},"".concat(j,"-handler-down-disabled"),ve)),ae=O?{onTouchStart:Ce?d:this.up,onTouchEnd:this.stop}:{onMouseDown:Ce?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=O?{onTouchStart:ve?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return N.a.createElement("div",{className:tt,style:Ee,title:we,onMouseEnter:Te,onMouseLeave:ye,onMouseOver:fe,onMouseOut:se,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"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Ce,className:be}),X||N.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:a})),N.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:ie}),q||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":ce,"aria-valuenow":rt,required:te,type:_e,placeholder:Re,onPaste:Ye,onClick:ue,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:ne,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:lt?this.onKeyDown:d,onKeyUp:lt?this.onKeyUp:d,autoFocus:Me,maxLength:Fe,readOnly:V,disabled:G,max:ce,min:Le,step:He,name:Oe,title:we,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Ne,inputMode:ke,onInput:Ze},Pe))))}}]),x}(N.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var c=y,f=Qe.a=c},gHQ5:function(ht,Qe,re){"use strict";re.r(Qe);var le=re("+L6B"),$=re("2/Rp"),R=re("5NDa"),Z=re("5rEg"),B=re("k1fw"),P=re("9og8"),K=re("y8nQ"),U=re("Vl3Y"),N=re("tJVT"),D=re("CiB2"),b=re("WmNS"),A=re.n(b),k=re("q1tI"),T=re.n(k),C=re("3vs6"),E=re("l3Yi"),d=re.n(E),a=re("Ot1p"),l=re("500L"),h=re("ErOA"),_=re("Ty5D"),g=re("9kvl"),m=function(y){var c;Object(D.a)(y);var f=Object(k.useState)({}),u=Object(N.a)(f,2),o=u[0],x=u[1],v=U.a.useForm(),S=Object(N.a)(v,1),M=S[0],j=Object(k.useState)(!0),G=Object(N.a)(j,2),V=G[0],O=G[1],I=Object(k.useState)(!1),X=Object(N.a)(I,2),q=X[0],oe=X[1],ce=Object(k.useState)(!1),Le=Object(N.a)(ce,2),Ee=Le[0],we=Le[1],Te=Object(_.i)(),ye=Te==null?void 0:Te.virtual_spacesId;Object(k.useEffect)(function(){Te!=null&&Te.id?fe():we(!0)},[]);var fe=function(){var te=Object(P.a)(A.a.mark(function ue(){var ne,_e;return A.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:return xe.next=2,Object(h.a)("/api/virtual_classrooms/".concat(ye,"/syllabuses/").concat(Te==null?void 0:Te.id,"/edit.json"),{method:"get"});case 2:ne=xe.sent,ne&&(_e={title:ne.title,description:ne.description,attachment_ids:Object(l.a)(ne.attachments)},console.log(_e,"formData"),M.setFieldsValue(Object(B.a)({},_e)),x(Object(B.a)({},_e)),we(!0));case 4:case"end":return xe.stop()}},ue)}));return function(){return te.apply(this,arguments)}}(),se=function(){var te=Object(P.a)(A.a.mark(function ue(ne){var _e,Re,xe,ke,Ne;return A.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Re=Object(B.a)({},o),Re.attachment_ids&&(Re.attachment_ids=Re==null||((xe=Re.attachment_ids)===null||xe===void 0)?void 0:xe.map(function(Me){return Me.response.id})),oe(!0),!(Te!=null&&Te.id)){Fe.next=9;break}return Fe.next=6,Object(h.a)("/api/virtual_classrooms/".concat(ye,"/syllabuses/").concat(Te==null?void 0:Te.id,".json"),{method:"put",body:Object(B.a)({},Re)});case 6:ke=Fe.sent,Fe.next=12;break;case 9:return Fe.next=11,Object(h.a)("/api/virtual_classrooms/".concat(ye,"/syllabuses.json"),{method:"post",body:Object(B.a)({},Re)});case 11:ke=Fe.sent;case 12:(_e=ke)!==null&&_e!==void 0&&_e.virtual_classroom_id&&g.d.push("/vspaces/".concat(ye,"/syllabuses/").concat((Ne=ke)===null||Ne===void 0?void 0:Ne.id,"/detail")),oe(!1);case 14:case"end":return Fe.stop()}},ue)}));return function(ne){return te.apply(this,arguments)}}();return T.a.createElement("div",{className:d.a.wrap},T.a.createElement(C.a,null),T.a.createElement("div",{className:d.a.form},T.a.createElement("div",{className:d.a.title},T.a.createElement("span",{onClick:function(){return g.d.push("/vspaces/".concat(ye,"/syllabuses"))}},T.a.createElement("i",{className:"iconfont icon-zuoshangjiaofanhui"}),"\u8FD4\u56DE"),T.a.createElement("span",null,"\u65B0\u5EFA\u6559\u5B66\u5927\u7EB2")),T.a.createElement(U.a,{colon:!1,form:M,scrollToFirstError:!0,onValuesChange:function(){x(Object(B.a)({},M.getFieldsValue()))},onFinish:se},T.a.createElement(U.a.Item,{name:"title",label:"\u5927\u7EB2\u6807\u9898",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"}]},T.a.createElement(Z.a,{maxLength:60,suffix:"".concat(((c=o.title)===null||c===void 0?void 0:c.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u5927\u7EB2\u6807\u9898"})),T.a.createElement("div",{style:{margin:"20px 0 12px 10px"}},"\u5927\u7EB2\u5185\u5BB9"),T.a.createElement(U.a.Item,{className:"ml10",name:"description",rules:[{max:5e4,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u523650000\u4E2A\u5B57\u7B26"}]},T.a.createElement(a.a,{watch:!0,defaultValue:o.description})),T.a.createElement(U.a.Item,{className:"ml10",name:"attachment_ids",label:"\u9644\u4EF6"},Ee&&T.a.createElement(l.b,{className:d.a.file,title:T.a.createElement("span",null,T.a.createElement("i",{className:"iconfont icon-shangchuan1 font14 mr5"}),"\u4E0A\u4F20\u9644\u4EF6")})),T.a.createElement("div",{style:{textAlign:"right"}},T.a.createElement(U.a.Item,null,T.a.createElement($.a,{onClick:function(){return g.d.push("/vspaces/".concat(ye,"/syllabuses"))},className:"mr10"},"\u53D6\u6D88"),T.a.createElement($.a,{type:"primary",htmlType:"submit",loading:q},"\u786E\u8BA4"))))))};Qe.default=m},h78n:function(ht,Qe,re){"use strict";re.d(Qe,"a",function(){return S});var le=re("q1tI"),$=re.n(le),R=re("TSYQ"),Z=re.n(R),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(G){var V=G.map(function(){return Object(le.useRef)()}),O=Object(le.useRef)();return Object(le.useEffect)(function(){var I=Date.now(),X=!1;Object.keys(V).forEach(function(q){var oe=V[q].current;if(!oe)return;X=!0;var ce=oe.style;ce.transitionDuration=".3s, .3s, .3s, .06s",O.current&&I-O.current<100&&(ce.transitionDuration="0s, 0s")}),X&&(O.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 O in V)Object.prototype.hasOwnProperty.call(V,O)&&(j[O]=V[O])}return j},K.apply(this,arguments)}function U(j,G){return k(j)||A(j,G)||D(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 D(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,O=new Array(G);V<G;V++)O[V]=j[V];return O}function A(j,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],O=!0,I=!1,X=void 0;try{for(var q=j[Symbol.iterator](),oe;!(O=(oe=q.next()).done)&&!(V.push(oe.value),G&&V.length===G);O=!0);}catch(ce){I=!0,X=ce}finally{try{!O&&q.return!=null&&q.return()}finally{if(I)throw X}}return V}function k(j){if(Array.isArray(j))return j}function T(j,G){if(j==null)return{};var V=C(j,G),O,I;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(j);for(I=0;I<X.length;I++){if(O=X[I],G.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,O))continue;V[O]=j[O]}}return V}function C(j,G){if(j==null)return{};var V={},O=Object.keys(j),I,X;for(X=0;X<O.length;X++){if(I=O[X],G.indexOf(I)>=0)continue;V[I]=j[I]}return V}var E=function(G){var V=G.className,O=G.percent,I=G.prefixCls,X=G.strokeColor,q=G.strokeLinecap,oe=G.strokeWidth,ce=G.style,Le=G.trailColor,Ee=G.trailWidth,we=G.transition,Te=T(G,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var ye=Array.isArray(O)?O:[O],fe=Array.isArray(X)?X:[X],se=P(ye),te=U(se,1),ue=te[0],ne=oe/2,_e=100-oe/2,Re="M ".concat(q==="round"?ne:0,",").concat(ne,`
L `).concat(q==="round"?_e:100,",").concat(ne),xe="0 0 100 ".concat(oe),ke=0;return $.a.createElement("svg",K({className:Z()("".concat(I,"-line"),V),viewBox:xe,preserveAspectRatio:"none",style:ce},Te),$.a.createElement("path",{className:"".concat(I,"-line-trail"),d:Re,strokeLinecap:q,stroke:Le,strokeWidth:Ee||oe,fillOpacity:"0"}),ye.map(function(Ne,He){var Fe={strokeDasharray:"".concat(Ne,"px, 100px"),strokeDashoffset:"-".concat(ke,"px"),transition:we||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Me=fe[He]||fe[fe.length-1];return ke+=Ne,$.a.createElement("path",{key:He,className:"".concat(I,"-line-path"),d:Re,strokeLinecap:q,stroke:Me,strokeWidth:oe,fillOpacity:"0",ref:ue[He],style:Fe})}))};E.defaultProps=B;var d=E;function a(){return a=Object.assign||function(j){for(var G=1;G<arguments.length;G++){var V=arguments[G];for(var O in V)Object.prototype.hasOwnProperty.call(V,O)&&(j[O]=V[O])}return j},a.apply(this,arguments)}function l(j,G){return L(j)||m(j,G)||_(j,G)||h()}function h(){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 _(j,G){if(!j)return;if(typeof j=="string")return g(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 g(j,G)}function g(j,G){(G==null||G>j.length)&&(G=j.length);for(var V=0,O=new Array(G);V<G;V++)O[V]=j[V];return O}function m(j,G){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],O=!0,I=!1,X=void 0;try{for(var q=j[Symbol.iterator](),oe;!(O=(oe=q.next()).done)&&!(V.push(oe.value),G&&V.length===G);O=!0);}catch(ce){I=!0,X=ce}finally{try{!O&&q.return!=null&&q.return()}finally{if(I)throw X}}return V}function L(j){if(Array.isArray(j))return j}function y(j,G){if(j==null)return{};var V=c(j,G),O,I;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(j);for(I=0;I<X.length;I++){if(O=X[I],G.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,O))continue;V[O]=j[O]}}return V}function c(j,G){if(j==null)return{};var V={},O=Object.keys(j),I,X;for(X=0;X<O.length;X++){if(I=O[X],G.indexOf(I)>=0)continue;V[I]=j[I]}return V}var f=0;function u(j){return+j.replace("%","")}function o(j){return Array.isArray(j)?j:[j]}function x(j,G,V,O){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,q=50-O/2,oe=0,ce=-q,Le=0,Ee=-2*q;switch(X){case"left":oe=-q,ce=0,Le=2*q,Ee=0;break;case"right":oe=q,ce=0,Le=-2*q,Ee=0;break;case"bottom":ce=q,Ee=2*q;break;default:}var we="M 50,50 m ".concat(oe,",").concat(ce,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(Le,",").concat(-Ee,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(-Le,",").concat(Ee),Te=Math.PI*2*q,ye={stroke:V,strokeDasharray:"".concat(G/100*(Te-I),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(I/2+j/100*(Te-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:we,pathStyle:ye}}var v=function(G){var V=G.prefixCls,O=G.strokeWidth,I=G.trailWidth,X=G.gapDegree,q=G.gapPosition,oe=G.trailColor,ce=G.strokeLinecap,Le=G.style,Ee=G.className,we=G.strokeColor,Te=G.percent,ye=y(G,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),fe=Object(le.useMemo)(function(){return f+=1,f},[]),se=x(0,100,oe,O,X,q),te=se.pathString,ue=se.pathStyle,ne=o(Te),_e=o(we),Re=_e.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),xe=P(ne),ke=l(xe,1),Ne=ke[0],He=function(){var Me=0;return ne.map(function(Oe,Ye){var Ze=_e[Ye]||_e[_e.length-1],Ve=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(fe,")"):"",je=x(Me,Oe,Ze,O,X,q);return Me+=Oe,$.a.createElement("path",{key:Ye,className:"".concat(V,"-circle-path"),d:je.pathString,stroke:Ve,strokeLinecap:ce,strokeWidth:O,opacity:Oe===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:Ne[Ye]})})};return $.a.createElement("svg",a({className:Z()("".concat(V,"-circle"),Ee),viewBox:"0 0 100 100",style:Le},ye),Re&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(fe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(Fe,Me){return u(Fe)-u(Me)}).map(function(Fe,Me){return $.a.createElement("stop",{key:Me,offset:Fe,stopColor:Re[Fe]})}))),$.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:ce,strokeWidth:I||O,fillOpacity:"0",style:ue}),He().reverse())};v.defaultProps=B;var S=v,M={Line:d,Circle:S}},kSUc:function(ht,Qe,re){},l3Yi:function(ht,Qe,re){ht.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(ht,Qe,re){(function(le){le(re("VrN/"),re("1eCo"),re("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function($,R){var Z=le.getMode($,"text/html"),B=Z.name=="null";function P(O){if(le.findModeByName){var I=le.findModeByName(O);I&&(O=I.mime||I.mimes[0])}var X=le.getMode($,O);return X.name=="null"?null:X}R.highlightFormatting===void 0&&(R.highlightFormatting=!1),R.maxBlockquoteDepth===void 0&&(R.maxBlockquoteDepth=0),R.taskLists===void 0&&(R.taskLists=!1),R.strikethrough===void 0&&(R.strikethrough=!1),R.emoji===void 0&&(R.emoji=!1),R.fencedCodeBlockHighlighting===void 0&&(R.fencedCodeBlockHighlighting=!0),R.fencedCodeBlockDefaultMode===void 0&&(R.fencedCodeBlockDefaultMode="text/plain"),R.xml===void 0&&(R.xml=!0),R.tokenTypeOverrides===void 0&&(R.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 U in K)K.hasOwnProperty(U)&&R.tokenTypeOverrides[U]&&(K[U]=R.tokenTypeOverrides[U]);var N=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,A=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,T=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function l(O,I,X){return I.f=I.inline=X,X(O,I)}function h(O,I,X){return I.f=I.block=X,X(O,I)}function _(O){return!O||!/\S/.test(O.string)}function g(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==L){var I=B;if(!I){var X=le.innerMode(Z,O.htmlState);I=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}I&&(O.f=u,O.block=m,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function m(O,I){var X=O.column()===I.indentation,q=_(I.prevLine.stream),oe=I.indentedCode,ce=I.prevLine.hr,Le=I.list!==!1,Ee=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var we=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,Le)){for(I.list=null;we<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=we-I.listStack[I.listStack.length-1])}var Te=!q&&!ce&&!I.prevLine.header&&(!Le||!oe)&&!I.prevLine.fencedCodeEnd,ye=(I.list===!1||ce||q)&&I.indentation<=Ee&&O.match(N),fe=null;if(I.indentationDiff>=4&&(oe||I.prevLine.fencedCodeEnd||I.prevLine.header||q))return O.skipToEnd(),I.indentedCode=!0,K.code;if(O.eatSpace())return null;if(X&&I.indentation<=Ee&&(fe=O.match(A))&&fe[1].length<=6)return I.quote=0,I.header=fe[1].length,I.thisLine.header=!0,R.highlightFormatting&&(I.formatting="header"),I.f=I.inline,c(I);if(I.indentation<=Ee&&O.eat(">"))return I.quote=X?1:I.quote+1,R.highlightFormatting&&(I.formatting="quote"),O.eatSpace(),c(I);if(!ye&&!I.setext&&X&&I.indentation<=Ee&&(fe=O.match(D))){var se=fe[1]?"ol":"ul";return I.indentation=we+O.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,R.taskLists&&O.match(b,!1)&&(I.taskList=!0),I.f=I.inline,R.highlightFormatting&&(I.formatting=["list","list-"+se]),c(I)}else{if(X&&I.indentation<=Ee&&(fe=O.match(C,!0)))return I.quote=0,I.fencedEndRE=new RegExp(fe[1]+"+ *$"),I.localMode=R.fencedCodeBlockHighlighting&&P(fe[2]||R.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=le.startState(I.localMode)),I.f=I.block=y,R.highlightFormatting&&(I.formatting="code-block"),I.code=-1,c(I);if(I.setext||(!Te||!Le)&&!I.quote&&I.list===!1&&!I.code&&!ye&&!E.test(O.string)&&(fe=O.lookAhead(1))&&(fe=fe.match(k)))return I.setext?(I.header=I.setext,I.setext=0,O.skipToEnd(),R.highlightFormatting&&(I.formatting="header")):(I.header=fe[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,c(I);if(ye)return O.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,K.hr;if(O.peek()==="[")return l(O,I,M)}return l(O,I,I.inline)}function L(O,I){var X=Z.token(O,I.htmlState);if(!B){var q=le.innerMode(Z,I.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||I.md_inside&&O.current().indexOf(">")>-1)&&(I.f=u,I.block=m,I.htmlState=null)}return X}function y(O,I){var X=I.listStack[I.listStack.length-1]||0,q=I.indentation<X,oe=X+3;if(I.fencedEndRE&&I.indentation<=oe&&(q||O.match(I.fencedEndRE))){R.highlightFormatting&&(I.formatting="code-block");var ce;return q||(ce=c(I)),I.localMode=I.localState=null,I.block=m,I.f=u,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,q?h(O,I,I.block):ce}else return I.localMode?I.localMode.token(O,I.localState):(O.skipToEnd(),K.code)}function c(O){var I=[];if(O.formatting){I.push(K.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var X=0;X<O.formatting.length;X++)I.push(K.formatting+"-"+O.formatting[X]),O.formatting[X]==="header"&&I.push(K.formatting+"-"+O.formatting[X]+"-"+O.header),O.formatting[X]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=O.quote?I.push(K.formatting+"-"+O.formatting[X]+"-"+O.quote):I.push("error"))}if(O.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(O.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(O.linkHref?I.push(K.linkHref,"url"):(O.strong&&I.push(K.strong),O.em&&I.push(K.em),O.strikethrough&&I.push(K.strikethrough),O.emoji&&I.push(K.emoji),O.linkText&&I.push(K.linkText),O.code&&I.push(K.code),O.image&&I.push(K.image),O.imageAltText&&I.push(K.imageAltText,"link"),O.imageMarker&&I.push(K.imageMarker)),O.header&&I.push(K.header,K.header+"-"+O.header),O.quote&&(I.push(K.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=O.quote?I.push(K.quote+"-"+O.quote):I.push(K.quote+"-"+R.maxBlockquoteDepth)),O.list!==!1){var q=(O.listStack.length-1)%3;q?q===1?I.push(K.list2):I.push(K.list3):I.push(K.list1)}return O.trailingSpaceNewLine?I.push("trailing-space-new-line"):O.trailingSpace&&I.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function f(O,I){return O.match(T,!0)?c(I):void 0}function u(O,I){var X=I.text(O,I);if(typeof X!="undefined")return X;if(I.list)return I.list=null,c(I);if(I.taskList){var q=O.match(b,!0)[1]===" ";return q?I.taskOpen=!0:I.taskClosed=!0,R.highlightFormatting&&(I.formatting="task"),I.taskList=!1,c(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&O.match(/^#+$/,!0))return R.highlightFormatting&&(I.formatting="header"),c(I);var oe=O.next();if(I.linkTitle){I.linkTitle=!1;var ce=oe;oe==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Le="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(O.match(new RegExp(Le),!0))return K.linkHref}if(oe==="`"){var Ee=I.formatting;R.highlightFormatting&&(I.formatting="code"),O.eatWhile("`");var we=O.current().length;if(I.code==0&&(!I.quote||we==1))return I.code=we,c(I);if(we==I.code){var Te=c(I);return I.code=0,Te}else return I.formatting=Ee,c(I)}else if(I.code)return c(I);if(oe==="\\"&&(O.next(),R.highlightFormatting)){var ye=c(I),fe=K.formatting+"-escape";return ye?ye+" "+fe:fe}if(oe==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,R.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="["&&I.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,R.highlightFormatting&&(I.formatting="image"),c(I);if(oe==="]"&&I.imageAltText){R.highlightFormatting&&(I.formatting="image");var ye=c(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=x,ye}if(oe==="["&&!I.image)return I.linkText&&O.match(/^.*?\]/)||(I.linkText=!0,R.highlightFormatting&&(I.formatting="link")),c(I);if(oe==="]"&&I.linkText){R.highlightFormatting&&(I.formatting="link");var ye=c(I);return I.linkText=!1,I.inline=I.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,ye}if(oe==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,R.highlightFormatting&&(I.formatting="link");var ye=c(I);return ye?ye+=" ":ye="",ye+K.linkInline}if(oe==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,R.highlightFormatting&&(I.formatting="link");var ye=c(I);return ye?ye+=" ":ye="",ye+K.linkEmail}if(R.xml&&oe==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=O.string.indexOf(">",O.pos);if(se!=-1){var te=O.string.substring(O.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(I.md_inside=!0)}return O.backUp(1),I.htmlState=le.startState(Z),h(O,I,L)}if(R.xml&&oe==="<"&&O.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var ue=1,ne=O.pos==1?" ":O.string.charAt(O.pos-2);ue<3&&O.eat(oe);)ue++;var _e=O.peek()||" ",Re=!/\s/.test(_e)&&(!d.test(_e)||/\s/.test(ne)||d.test(ne)),xe=!/\s/.test(ne)&&(!d.test(ne)||/\s/.test(_e)||d.test(_e)),ke=null,Ne=null;if(ue%2&&(!I.em&&Re&&(oe==="*"||!xe||d.test(ne))?ke=!0:I.em==oe&&xe&&(oe==="*"||!Re||d.test(_e))&&(ke=!1)),ue>1&&(!I.strong&&Re&&(oe==="*"||!xe||d.test(ne))?Ne=!0:I.strong==oe&&xe&&(oe==="*"||!Re||d.test(_e))&&(Ne=!1)),Ne!=null||ke!=null){R.highlightFormatting&&(I.formatting=ke==null?"strong":Ne==null?"em":"strong em"),ke===!0&&(I.em=oe),Ne===!0&&(I.strong=oe);var Te=c(I);return ke===!1&&(I.em=!1),Ne===!1&&(I.strong=!1),Te}}else if(oe===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return c(I);O.backUp(1)}if(R.strikethrough){if(oe==="~"&&O.eatWhile(oe)){if(I.strikethrough){R.highlightFormatting&&(I.formatting="strikethrough");var Te=c(I);return I.strikethrough=!1,Te}else if(O.match(/^[^\s]/,!1))return I.strikethrough=!0,R.highlightFormatting&&(I.formatting="strikethrough"),c(I)}else if(oe===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return c(I);O.backUp(2)}}if(R.emoji&&oe===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,R.highlightFormatting&&(I.formatting="emoji");var He=c(I);return I.emoji=!1,He}return oe===" "&&(O.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),c(I)}function o(O,I){var X=O.next();if(X===">"){I.f=I.inline=u,R.highlightFormatting&&(I.formatting="link");var q=c(I);return q?q+=" ":q="",q+K.linkInline}return O.match(/^[^>]+/,!0),K.linkInline}function x(O,I){if(O.eatSpace())return null;var X=O.next();return X==="("||X==="["?(I.f=I.inline=S(X==="("?")":"]"),R.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,c(I)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(O){return function(I,X){var q=I.next();if(q===O){X.f=X.inline=u,R.highlightFormatting&&(X.formatting="link-string");var oe=c(X);return X.linkHref=!1,oe}return I.match(v[O]),X.linkHref=!0,c(X)}}function M(O,I){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=j,O.next(),R.highlightFormatting&&(I.formatting="link"),I.linkText=!0,c(I)):l(O,I,u)}function j(O,I){if(O.match(/^\]:/,!0)){I.f=I.inline=G,R.highlightFormatting&&(I.formatting="link");var X=c(I);return I.linkText=!1,X}return O.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function G(O,I){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?I.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.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:f,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(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&le.copyState(Z,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?le.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,I){if(I.formatting=!1,O!=I.thisLine.stream){if(I.header=0,I.hr=!1,O.match(/^\s*$/,!0))return g(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:O},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=L)){var X=O.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(I.indentation=X,I.indentationDiff=null,X>0)return null}}return I.f(O,I)},innerMode:function(O){return O.block==L?{state:O.htmlState,mode:Z}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:V}},indent:function(O,I,X){return O.block==L&&Z.indent?Z.indent(O.htmlState,I,X):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,I,X):le.Pass},blankLine:g,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(ht,Qe,re){(function(le){le(re("VrN/"))})(function(le){"use strict";var $=le.Pos;function R(d,a){return d.line-a.line||d.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",B=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Z+"]["+B+"]*)","g");function K(d,a,l,h){this.line=a,this.ch=l,this.cm=d,this.text=d.getLine(a),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function U(d,a){var l=d.cm.getTokenTypeAt($(d.line,a));return l&&/\btag\b/.test(l)}function N(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function D(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function b(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(N(d))continue;return}if(!U(d,a+1)){d.ch=a+1;continue}var l=d.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,h?"selfClose":"regular"}}function A(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(D(d))continue;return}if(!U(d,a+1)){d.ch=a;continue}P.lastIndex=a,d.ch=a;var l=P.exec(d.text);if(l&&l.index==a)return l}}function k(d){for(;;){P.lastIndex=d.ch;var a=P.exec(d.text);if(!a){if(N(d))continue;return}if(!U(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function T(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(D(d))continue;return}if(!U(d,a+1)){d.ch=a;continue}var l=d.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,h?"selfClose":"regular"}}function C(d,a){for(var l=[];;){var h=k(d),_,g=d.line,m=d.ch-(h?h[0].length:0);if(!h||!(_=b(d)))return;if(_=="selfClose")continue;if(h[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==h[2]){l.length=L;break}if(L<0&&(!a||a==h[2]))return{tag:h[2],from:$(g,m),to:$(d.line,d.ch)}}else l.push(h[2])}}function E(d,a){for(var l=[];;){var h=T(d);if(!h)return;if(h=="selfClose"){A(d);continue}var _=d.line,g=d.ch,m=A(d);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:$(d.line,d.ch),to:$(_,g)}}}}le.registerHelper("fold","xml",function(d,a){for(var l=new K(d,a.line,0);;){var h=k(l);if(!h||l.line!=a.line)return;var _=b(l);if(!_)return;if(!h[1]&&_!="selfClose"){var g=$(l.line,l.ch),m=C(l,h[2]);return m&&R(m.from,g)>0?{from:g,to:m.from}:null}}}),le.findMatchingTag=function(d,a,l){var h=new K(d,a.line,a.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var _=b(h),g=_&&$(h.line,h.ch),m=_&&A(h);if(!_||!m||R(h,a)>0)return;var L={from:$(h.line,h.ch),to:g,tag:m[2]};return _=="selfClose"?{open:L,close:null,at:"open"}:m[1]?{open:E(h,m[2]),close:L,at:"close"}:(h=new K(d,g.line,g.ch,l),{open:L,close:C(h,m[2]),at:"open"})},le.findEnclosingTag=function(d,a,l,h){for(var _=new K(d,a.line,a.ch,l);;){var g=E(_,h);if(!g)break;var m=new K(d,a.line,a.ch,l),L=C(m,g.tag);if(L)return{open:g,close:L}}},le.scanForClosingTag=function(d,a,l,h){var _=new K(d,a.line,a.ch,h?{from:0,to:h}:null);return C(_,l)}})},p5ED:function(ht,Qe,re){"use strict";var le=re("+L6B"),$=re("2/Rp"),R=re("5Dmo"),Z=re("3S7+"),B=re("k1fw"),P=re("tJVT"),K=re("q1tI"),U=re.n(K),N=re("vHTk"),D=re.n(N),b=re("yEEn"),A=re("ZW9T"),k=re("1vsH");Qe.a=function(T){var C=T.name,E=T.data,d=T.theme,a=T.type,l=T.filename,h=T.monacoEditor,_=T.className,g=T.style,m=T.close,L=T.onClose,y=T.hasMask,c=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(P.a)(c,2),u=f[0],o=f[1],x=Object(K.useState)(""),v=Object(P.a)(x,2),S=v[0],M=v[1],j,G=1024*1024,V=10*G,O=Object(K.useRef)();a==="office"&&(j=Object(k.T)(E).filesize,j>V&&(a="other")),l&&(h.filename=l),Object(K.useEffect)(function(){var q,oe,ce=(q=document.cookie)===null||q===void 0||((oe=q.replace(/\s/g,""))===null||oe===void 0)?void 0:oe.split(";");ce==null||ce.map(function(Le){var Ee=Le.split("=");Ee[0]==="_educoder_session"&&M(Ee[1])})},[]);var I=function(){if(E.startsWith("http")||E.startsWith("/")){X();return}Object(k.z)(l||"educoder",E,l)},X=function(){Object(k.x)(l||C,E)};return console.log("data:",E,"fileanme:",l," name:",C),U.a.createElement("div",{style:Object(B.a)({},g||{}),className:"".concat(y&&D.a.bgBlack," ").concat(a?D.a.wrp:"hide")},m&&U.a.createElement("div",{className:D.a.close,ref:O},U.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return O.current}},U.a.createElement("span",{onClick:X},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return O.current}},U.a.createElement("span",{className:"",onClick:L},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(D.a[_]," ").concat(_," ").concat(D.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&U.a.createElement(A.b,h)),a==="audio"&&U.a.createElement("audio",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?E:"data:audio/mp3;base64,").concat(E),autoPlay:!0}),a==="video"&&U.a.createElement(U.a.Fragment,null,E!=null&&E.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(E),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(E),autoPlay:!0})),a==="html"&&U.a.createElement("iframe",{src:E+"&disposition=inline"}),a==="pdf"&&U.a.createElement("embed",{className:D.a.embed,src:E}),a==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(E)})),a==="other"&&U.a.createElement("div",null,U.a.createElement($.a,{type:"primary",size:"large",onClick:I},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&U.a.createElement($.a,{type:"primary",size:"large",onClick:I},U.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ht,Qe,re){},rUJ1:function(ht,Qe){const re=/[&<>"']/,le=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=y=>Z[y];function P(y,c){if(c){if(re.test(y))return y.replace(le,B)}else if($.test(y))return y.replace(R,B);return y}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(y){return y.replace(K,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const N=/(^|[^\[])\^/g;function D(y,c){y=y.source||y,c=c||"";const f={replace:(u,o)=>(o=o.source||o,o=o.replace(N,"$1"),y=y.replace(u,o),f),getRegex:()=>new RegExp(y,c)};return f}const b=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(y,c,f){if(y){let u;try{u=decodeURIComponent(U(f)).replace(b,"").toLowerCase()}catch(o){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}c&&!A.test(f)&&(f=a(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(u){return null}return f}const T={},C=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(y,c){T[" "+y]||(C.test(y)?T[" "+y]=y+"/":T[" "+y]=g(y,"/",!0)),y=T[" "+y];const f=y.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:y.replace(E,"$1")+c:c.charAt(0)==="/"?f?c:y.replace(d,"$1")+c:y+c}const l={exec:function(){}};function h(y){let c=1,f,u;for(;c<arguments.length;c++){f=arguments[c];for(u in f)Object.prototype.hasOwnProperty.call(f,u)&&(y[u]=f[u])}return y}function _(y,c){const f=y.replace(/\|/g,(x,v,S)=>{let M=!1,j=v;for(;--j>=0&&S[j]==="\\";)M=!M;return M?"|":" |"}),u=f.split(/ \|/);let o=0;if(u.length>c)u.splice(c);else for(;u.length<c;)u.push("");for(;o<u.length;o++)u[o]=u[o].trim().replace(/\\\|/g,"|");return u}function g(y,c,f){const u=y.length;if(u===0)return"";let o=0;for(;o<u;){const x=y.charAt(u-o-1);if(x===c&&!f)o++;else if(x!==c&&f)o++;else break}return y.substr(0,u-o)}function m(y,c){if(y.indexOf(c[1])===-1)return-1;const f=y.length;let u=0,o=0;for(;o<f;o++)if(y[o]==="\\")o++;else if(y[o]===c[0])u++;else if(y[o]===c[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")}ht.exports={escape:P,unescape:U,edit:D,cleanUrl:k,resolveUrl:a,noopTest:l,merge:h,splitCells:_,rtrim:g,findClosingBracket:m,checkSanitizeDeprecation:L}},ttuQ:function(ht,Qe,re){ht.exports={bg:"bg___3F6Km",name:"name___1NsJT",member:"member___2pzzt"}},ulZh:function(ht,Qe,re){typeof window!="undefined"&&function($,R){ht.exports=R()}(this,function(){return function(le){var $={};function R(Z){if($[Z])return $[Z].exports;var B=$[Z]={i:Z,l:!1,exports:{}};return le[Z].call(B.exports,B,B.exports,R),B.l=!0,B.exports}return R.m=le,R.c=$,R.d=function(Z,B,P){R.o(Z,B)||Object.defineProperty(Z,B,{enumerable:!0,get:P})},R.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},R.t=function(Z,B){if(B&1&&(Z=R(Z)),B&8)return Z;if(B&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var P=Object.create(null);if(R.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Z}),B&2&&typeof Z!="string")for(var K in Z)R.d(P,K,function(U){return Z[U]}.bind(null,K));return P},R.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return R.d(B,"a",B),B},R.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,$,R){"use strict";var Z=Object.prototype.hasOwnProperty,B="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(B=!1));function K(b,A,k){this.fn=b,this.context=A,this.once=k||!1}function U(b,A,k,T,C){if(typeof k!="function")throw new TypeError("The listener must be a function");var E=new K(k,T||b,C),d=B?B+A:A;return b._events[d]?b._events[d].fn?b._events[d]=[b._events[d],E]:b._events[d].push(E):(b._events[d]=E,b._eventsCount++),b}function N(b,A){--b._eventsCount===0?b._events=new P:delete b._events[A]}function D(){this._events=new P,this._eventsCount=0}D.prototype.eventNames=function(){var A=[],k,T;if(this._eventsCount===0)return A;for(T in k=this._events)Z.call(k,T)&&A.push(B?T.slice(1):T);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(k)):A},D.prototype.listeners=function(A){var k=B?B+A:A,T=this._events[k];if(!T)return[];if(T.fn)return[T.fn];for(var C=0,E=T.length,d=new Array(E);C<E;C++)d[C]=T[C].fn;return d},D.prototype.listenerCount=function(A){var k=B?B+A:A,T=this._events[k];return T?T.fn?1:T.length:0},D.prototype.emit=function(A,k,T,C,E,d){var a=B?B+A:A;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,_,g;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,k),!0;case 3:return l.fn.call(l.context,k,T),!0;case 4:return l.fn.call(l.context,k,T,C),!0;case 5:return l.fn.call(l.context,k,T,C,E),!0;case 6:return l.fn.call(l.context,k,T,C,E,d),!0}for(g=1,_=new Array(h-1);g<h;g++)_[g-1]=arguments[g];l.fn.apply(l.context,_)}else{var m=l.length,L;for(g=0;g<m;g++){l[g].once&&this.removeListener(A,l[g].fn,void 0,!0);switch(h){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,k);break;case 3:l[g].fn.call(l[g].context,k,T);break;case 4:l[g].fn.call(l[g].context,k,T,C);break;default:if(!_)for(L=1,_=new Array(h-1);L<h;L++)_[L-1]=arguments[L];l[g].fn.apply(l[g].context,_)}}}return!0},D.prototype.on=function(A,k,T){return U(this,A,k,T,!1)},D.prototype.once=function(A,k,T){return U(this,A,k,T,!0)},D.prototype.removeListener=function(A,k,T,C){var E=B?B+A:A;if(!this._events[E])return this;if(!k)return N(this,E),this;var d=this._events[E];if(d.fn)d.fn===k&&(!C||d.once)&&(!T||d.context===T)&&N(this,E);else{for(var a=0,l=[],h=d.length;a<h;a++)(d[a].fn!==k||C&&!d[a].once||T&&d[a].context!==T)&&l.push(d[a]);l.length?this._events[E]=l.length===1?l[0]:l:N(this,E)}return this},D.prototype.removeAllListeners=function(A){var k;return A?(k=B?B+A:A,this._events[k]&&N(this,k)):(this._events=new P,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=B,D.EventEmitter=D,le.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,$,R){(function(Z){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,N={buildAbsoluteURL:function(D,b,A){if(A=A||{},D=D.trim(),b=b.trim(),!b){if(!A.alwaysNormalize)return D;var k=N.parseURL(D);if(!k)throw new Error("Error trying to parse base URL.");return k.path=N.normalizePath(k.path),N.buildURLFromParts(k)}var T=N.parseURL(b);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return A.alwaysNormalize?(T.path=N.normalizePath(T.path),N.buildURLFromParts(T)):b;var C=N.parseURL(D);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var E=P.exec(C.path);C.netLoc=E[1],C.path=E[2]}C.netLoc&&!C.path&&(C.path="/");var d={scheme:C.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(d.netLoc=C.netLoc,T.path[0]!=="/"))if(!T.path)d.path=C.path,T.params||(d.params=C.params,T.query||(d.query=C.query));else{var a=C.path,l=a.substring(0,a.lastIndexOf("/")+1)+T.path;d.path=N.normalizePath(l)}return d.path===null&&(d.path=A.alwaysNormalize?N.normalizePath(T.path):T.path),N.buildURLFromParts(d)},parseURL:function(D){var b=B.exec(D);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(K,"");D.length!==(D=D.replace(U,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};le.exports=N})(this)},"./node_modules/webworkify-webpack/index.js":function(le,$,R){function Z(A){var k={};function T(E){if(k[E])return k[E].exports;var d=k[E]={i:E,l:!1,exports:{}};return A[E].call(d.exports,d,d.exports,T),d.l=!0,d.exports}T.m=A,T.c=k,T.i=function(E){return E},T.d=function(E,d,a){T.o(E,d)||Object.defineProperty(E,d,{configurable:!1,enumerable:!0,get:a})},T.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},T.n=function(E){var d=E&&E.__esModule?function(){return E.default}:function(){return E};return T.d(d,"a",d),d},T.o=function(E,d){return Object.prototype.hasOwnProperty.call(E,d)},T.p="/",T.oe=function(E){throw console.error(E),E};var C=T(T.s=ENTRY_MODULE);return C.default||C}var B="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function K(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(A){return!isNaN(1*A)}function N(A,k,T){var C={};C[T]=[];var E=k.toString(),d=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return C;for(var a=d[1],l=new RegExp("(\\\\n|\\W)"+K(a)+P,"g"),h;h=l.exec(E);){if(h[3]==="dll-reference")continue;C[T].push(h[3])}for(l=new RegExp("\\("+K(a)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+P,"g");h=l.exec(E);)A[h[2]]||(C[T].push(h[1]),A[h[2]]=R(h[1]).m),C[h[2]]=C[h[2]]||[],C[h[2]].push(h[4]);for(var _=Object.keys(C),g=0;g<_.length;g++)for(var m=0;m<C[_[g]].length;m++)U(C[_[g]][m])&&(C[_[g]][m]=1*C[_[g]][m]);return C}function D(A){var k=Object.keys(A);return k.reduce(function(T,C){return T||A[C].length>0},!1)}function b(A,k){for(var T={main:[k]},C={main:[]},E={main:{}};D(T);)for(var d=Object.keys(T),a=0;a<d.length;a++){var l=d[a],h=T[l],_=h.pop();if(E[l]=E[l]||{},E[l][_]||!A[l][_])continue;E[l][_]=!0,C[l]=C[l]||[],C[l].push(_);for(var g=N(A,A[l][_],l),m=Object.keys(g),L=0;L<m.length;L++)T[m[L]]=T[m[L]]||[],T[m[L]]=T[m[L]].concat(g[m[L]])}return C}le.exports=function(A,k){k=k||{};var T={main:R.m},C=k.all?{main:Object.keys(T.main)}:b(T,A),E="";Object.keys(C).filter(function(_){return _!=="main"}).forEach(function(_){for(var g=0;C[_][g];)g++;C[_].push(g),T[_][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+_+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+C[_].map(function(m){return""+JSON.stringify(m)+": "+T[_][m].toString()}).join(",")+`});
`}),E=E+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+C.main.map(function(_){return""+JSON.stringify(_)+": "+T.main[_].toString()}).join(",")+"}))(self);";var d=new window.Blob([E],{type:"text/javascript"});if(k.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(d),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(le,$,R){"use strict";R.r($),R.d($,"hlsDefaultConfig",function(){return L}),R.d($,"mergeConfig",function(){return c}),R.d($,"enableStreamingMode",function(){return f});var Z=R("./src/controller/abr-controller.ts"),B=R("./src/controller/audio-stream-controller.ts"),P=R("./src/controller/audio-track-controller.ts"),K=R("./src/controller/subtitle-stream-controller.ts"),U=R("./src/controller/subtitle-track-controller.ts"),N=R("./src/controller/buffer-controller.ts"),D=R("./src/controller/timeline-controller.ts"),b=R("./src/controller/cap-level-controller.ts"),A=R("./src/controller/fps-controller.ts"),k=R("./src/controller/eme-controller.ts"),T=R("./src/controller/cmcd-controller.ts"),C=R("./src/utils/xhr-loader.ts"),E=R("./src/utils/fetch-loader.ts"),d=R("./src/utils/cues.ts"),a=R("./src/utils/mediakeys-helper.ts"),l=R("./src/utils/logger.ts");function h(){return h=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var x=arguments[o];for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(u[v]=x[v])}return u},h.apply(this,arguments)}function _(u,o){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);o&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(u,S).enumerable})),x.push.apply(x,v)}return x}function g(u){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?_(Object(x),!0).forEach(function(v){m(u,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):_(Object(x)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(x,v))})}return u}function m(u,o,x){return o in u?Object.defineProperty(u,o,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[o]=x,u}var L=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:C.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:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:U.default,timelineController:D.TimelineController,audioStreamController:B.default,audioTrackController:P.default,emeController:k.default,cmcdController:T.default});function y(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(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 h({},u,o)}function f(u){var o=u.loader;if(o!==E.default&&o!==C.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(E.fetchSupported)();x&&(u.loader=E.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/ewma-bandwidth-estimator.ts"),P=R("./src/events.ts"),K=R("./src/utils/buffer-helper.ts"),U=R("./src/errors.ts"),N=R("./src/types/loader.ts"),D=R("./src/utils/logger.ts");function b(T,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(T,d.key,d)}}function A(T,C,E){return C&&b(T.prototype,C),E&&b(T,E),T}var k=function(){function T(E){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=E;var d=E.config;this.bwEstimator=new B.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var C=T.prototype;return C.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(d,a){var l=a.frag;if(l.type===N.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(d,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,_=l.config,g=l.media;if(!d||!g)return;var m=a?a.stats:d.stats,L=a?a.duration:d.duration;if(m.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||g.paused||!g.playbackRate||!g.readyState)return;var y=performance.now()-m.loading.start,c=Math.abs(g.playbackRate);if(y<=500*L/c)return;var f=l.levels,u=l.minAutoLevel,o=f[d.level],x=m.total||Math.max(m.loaded,Math.round(L*o.maxBitrate/8)),v=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),S=(x-m.loaded)/v,M=g.currentTime,j=(K.BufferHelper.bufferInfo(g,M,_.maxBufferHole).end-M)/c;if(j>=2*L/c||S<=j)return;var G=Number.POSITIVE_INFINITY,V;for(V=d.level-1;V>u;V--){var O=f[V].maxBitrate;if(G=L*O/(8*.8*v),G<j)break}if(G>=S)return;var I=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+S.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(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:m})},C.onFragLoaded=function(d,a){var l=a.frag,h=a.part;if(l.type===N.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var _=h?h.stats:l.stats,g=h?h.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)+_.loaded,y=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:L,duration:y},m.realBitrate=Math.round(8*L/y)}if(l.bitrateTest){var c={stats:_,frag:l,part:h,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,c),l.bitrateTest=!1}}},C.onFragBuffered=function(d,a){var l=a.frag,h=a.part,_=h?h.stats:l.stats;if(_.aborted)return;if(l.type!==N.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var g=_.parsing.end-_.loading.start;this.bwEstimator.sample(g,_.loaded),_.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},C.onError=function(d,a){switch(a.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.maxAutoLevel,_=l.config,g=l.minAutoLevel,m=l.media,L=a?a.duration:d?d.duration:0,y=m?m.currentTime:0,c=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():_.abrEwmaDefaultEstimate,u=(K.BufferHelper.bufferInfo(m,y,_.maxBufferHole).end-y)/c,o=this.findBestLevel(f,g,h,u,_.abrBandWidthFactor,_.abrBandWidthUpFactor);if(o>=0)return o;D.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,_.maxStarvationDelay):_.maxStarvationDelay,v=_.abrBandWidthFactor,S=_.abrBandWidthUpFactor;if(!u){var M=this.bitrateTestDelay;if(M){var j=L?Math.min(L,_.maxLoadingDelay):_.maxLoadingDelay;x=j-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),v=S=1}}return o=this.findBestLevel(f,g,h,u+x,v,S),Math.max(o,0)},C.findBestLevel=function(d,a,l,h,_,g){for(var m,L=this.fragCurrent,y=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,u=f[c],o=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),x=u==null?void 0:u.codecSet,v=y?y.duration:L?L.duration:0,S=l;S>=a;S--){var M=f[S];if(!M||x&&M.codecSet!==x)continue;var j=M.details,G=(y?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||v,V=void 0;S<=c?V=_*d:V=g*d;var O=f[S].maxBitrate,I=O*G/V;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+O+"/"+G+"/"+h+"/"+I),V>O&&(!I||o&&!this.bitrateTestDelay||I<h))return S}return-1},A(T,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),T}();$.default=k},"./src/controller/audio-stream-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/polyfills/number.ts"),B=R("./src/controller/base-stream-controller.ts"),P=R("./src/events.ts"),K=R("./src/utils/buffer-helper.ts"),U=R("./src/controller/fragment-tracker.ts"),N=R("./src/types/level.ts"),D=R("./src/types/loader.ts"),b=R("./src/loader/fragment.ts"),A=R("./src/demux/chunk-cache.ts"),k=R("./src/demux/transmuxer-interface.ts"),T=R("./src/types/transmuxer.ts"),C=R("./src/controller/fragment-finders.ts"),E=R("./src/utils/discontinuities.ts"),d=R("./src/errors.ts"),a=R("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(L[f]=c[f])}return L},l.apply(this,arguments)}function h(L,y){L.prototype=Object.create(y.prototype),L.prototype.constructor=L,_(L,y)}function _(L,y){return _=Object.setPrototypeOf||function(f,u){return f.__proto__=u,f},_(L,y)}var g=100,m=function(L){h(y,L);function y(f,u){var o;return o=L.call(this,f,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 c=y.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var u=this.hls;u.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(P.Events.ERROR,this.onError,this),u.on(P.Events.BUFFER_RESET,this.onBufferReset,this),u.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var u=this.hls;u.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(P.Events.ERROR,this.onError,this),u.off(P.Events.BUFFER_RESET,this.onBufferReset,this),u.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(u,o){var x=o.frag,v=o.id,S=o.initPTS;if(v==="main"){var M=x.cc;this.initPTS[x.cc]=S,this.log("InitPTS for cc: "+M+" found from main: "+S),this.videoTrackCC=M,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=B.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,o>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},c.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var u,o=this.levels,x=this.trackId,v=o==null||((u=o[x])===null||u===void 0)?void 0:u.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var S,M=performance.now(),j=this.retryDate;(!j||M>=j||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var G=this.waitingData;if(G){var V=G.frag,O=G.part,I=G.cache,X=G.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var q=I.flush(),oe={frag:V,part:O,payload:q,networkDetails:null};this._handleFragmentLoadProgress(oe),X&&L.prototype._handleFragmentLoadComplete.call(this,oe)}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 ce=this.getLoadPosition(),Le=K.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),Ee=Object(C.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=B.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},c.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:u,x=o.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},c.doTickIdle=function(){var u,o,x=this.hls,v=this.levels,S=this.media,M=this.trackId,j=x.config;if(!v||!v[M])return;if(!S&&(this.startFragRequested||!j.startFragPrefetch))return;var G=v[M],V=G.details;if(!V||V.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(O===null)return;var I=O.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(I>=X&&!q)return;if(!q&&this._streamEnded(O,V)){x.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var oe=V.fragments,ce=oe[0].start,Le=O.end;if(q){var Ee=this.getLoadPosition();Le=Ee,V.PTSKnown&&Ee<ce&&((O.end>ce||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=ce+.05))}var we=this.getNextFragment(Le,V);if(!we){this.bufferFlushed=!0;return}((u=we.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((o=we.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(we,V):this.loadFragment(we,V,Le)},c.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return o===null?u:Math.max(u,o.len)},c.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(u,o){var x=o.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(v){return new N.Level(v)})},c.onAudioTrackSwitching=function(u,o){var x=!!o.url;this.trackId=o.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(g):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(u,o){this.mainDetails=o.details},c.onAudioTrackLoaded=function(u,o){var x,v=this.levels,S=o.details,M=o.id;if(!v){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var j=v[M],G=0;if(S.live||(x=j.details)!==null&&x!==void 0&&x.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!j.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(S,V),G=S.fragments[0].start):G=this.alignPlaylists(S,j.details)}j.details=S,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(j.details,G),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=B.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(u){var o,x=u.frag,v=u.part,S=u.payload,M=this.config,j=this.trackId,G=this.levels;if(!G){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var V=G[j];console.assert(V,"Audio track is defined on fragment load progress");var O=V.details;console.assert(O,"Audio track details are defined on fragment load progress");var I=M.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new k.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[x.cc],oe=(o=x.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var ce=!1,Le=v?v.index:-1,Ee=Le!==-1,we=new T.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,S.byteLength,Le,Ee);X.push(S,oe,I,"",x,v,O.totalduration,ce,we,q)}else{a.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+j);var Te=this.waitingData=this.waitingData||{frag:x,part:v,cache:new A.default,complete:!1},ye=Te.cache;ye.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(u,o){var x=o.tracks.audio;x&&(this.mediaBuffer=x.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},c.onFragBuffered=function(u,o){var x=o.frag,v=o.part;if(x.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(v?" p: "+v.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,v)},c.onError=function(u,o){switch(o.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,o);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=o.fatal?B.State.ERROR:B.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var x=!0,v=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);v&&v.len>.5&&(x=!this.reduceMaxBufferLength(v.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(u,o){var x=o.type;x===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(u){var o,x="audio",v=this.hls,S=u.remuxResult,M=u.chunkMeta,j=this.getCurrentContext(M);if(!j){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var G=j.frag,V=j.part,O=S.audio,I=S.text,X=S.id3,q=S.initSegment;if(this.fragContextChanged(G))return;if(this.state=B.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,G,M),v.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:x,tracks:q.tracks})),O){var oe=O.startPTS,ce=O.endPTS,Le=O.startDTS,Ee=O.endDTS;V&&(V.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:ce,startDTS:Le,endDTS:Ee}),G.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,oe,ce,Le,Ee),this.bufferFragmentData(O,G,V,M)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var we=l({frag:G,id:x},X);v.trigger(P.Events.FRAG_PARSING_METADATA,we)}if(I){var Te=l({frag:G,id:x},I);v.trigger(P.Events.FRAG_PARSING_USERDATA,Te)}},c._bufferInitSegment=function(u,o,x){if(this.state!==B.State.PARSING)return;u.video&&delete u.video;var v=u.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,u);var S=v.initSegment;if(S!=null&&S.byteLength){var M={type:"audio",frag:o,part:null,chunkMeta:x,parent:o.type,data:S};this.hls.trigger(P.Events.BUFFER_APPENDING,M)}this.tick()},c.loadFragment=function(u,o,x){var v=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||v===U.FragmentState.NOT_LOADED||v===U.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=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,o,x)))},c.completeAudioSwitch=function(){var u=this.hls,o=this.media,x=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(P.Events.AUDIO_TRACK_SWITCHED,{id:x})},y}(B.default);$.default=m},"./src/controller/audio-track-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts"),B=R("./src/errors.ts"),P=R("./src/controller/base-playlist-controller.ts"),K=R("./src/types/loader.ts");function U(k,T){for(var C=0;C<T.length;C++){var E=T[C];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function N(k,T,C){return T&&U(k.prototype,T),C&&U(k,C),k}function D(k,T){k.prototype=Object.create(T.prototype),k.prototype.constructor=k,b(k,T)}function b(k,T){return b=Object.setPrototypeOf||function(E,d){return E.__proto__=d,E},b(k,T)}var A=function(k){D(T,k);function T(E){var d;return d=k.call(this,E,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var C=T.prototype;return C.registerListeners=function(){var d=this.hls;d.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Z.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Z.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,k.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},C.onAudioTrackLoaded=function(d,a){var l=a.id,h=a.details,_=this.tracksInGroup[l];if(!_){this.warn("Invalid audio track id "+l);return}var g=_.details;_.details=a.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,g))},C.onLevelLoading=function(d,a){this.switchLevel(a.level)},C.onLevelSwitching=function(d,a){this.switchLevel(a.level)},C.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(g){return!l||g.groupId===l});this.selectDefaultTrack&&!h.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var _={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,_),this.selectInitialTrack()}},C.onError=function(d,a){if(k.prototype.onError.call(this,d,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)},C.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+d);var h=a[d],_=h.id,g=h.groupId,m=g===void 0?"":g,L=h.name,y=h.type,c=h.url;if(this.trackId=d,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:_,groupId:m,name:L,type:y,url:c}),h.details&&!h.details.live)return;var f=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(f)},C.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.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:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(d){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var h=a[l];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},C.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,h=a.groupId,_=a.url;if(d)try{_=d.addDirectives(_)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:_,id:l,groupId:h,deliveryDirectives:d||null})}},N(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),T}(P.default);$.default=A},"./src/controller/base-playlist-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return N});var Z=R("./src/polyfills/number.ts"),B=R("./src/types/level.ts"),P=R("./src/controller/level-helper.ts"),K=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),N=function(){function D(A,k){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,k+":"),this.warn=K.logger.warn.bind(K.logger,k+":"),this.hls=A}var b=D.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(k,T){T.fatal&&T.type===U.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(k,T){var C=T==null?void 0:T.renditionReports;if(C)for(var E=0;E<C.length;E++){var d=C[E],a=""+d.URI;if(a===k.substr(-a.length)){var l=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var _=Math.min(T.age-T.partTarget,T.targetduration);h!==void 0&&_>T.partTarget&&(h+=1)}if(Object(Z.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Z.isFiniteNumber)(h)?h:void 0,B.HlsSkip.No)}}},b.loadPlaylist=function(k){},b.shouldLoadTrack=function(k){return this.canLoad&&k&&!!k.url&&(!k.details||k.details.live)},b.playlistLoaded=function(k,T,C){var E=this,d=T.details,a=T.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||C!=null&&C.live){if(d.reloaded(C),C&&this.log("live playlist "+k+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),C&&d.fragments.length>0&&Object(P.mergeDetails)(C,d),!this.canLoad||!d.live)return;var h,_=void 0,g=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,L=d.lastPartSn,y=d.endSN,c=d.lastPartIndex,f=c!==-1,u=L===y,o=m?0:c;f?(_=u?y+1:L,g=u?o:c+1):_=y+1;var x=d.age,v=x+d.ageHeader,S=Math.min(v-d.partTarget,d.targetduration*1.5);if(S>0){if(C&&S>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+S+" with playlist age: "+d.age),S=0;else{var M=Math.floor(S/d.targetduration);if(_+=M,g!==void 0){var j=Math.round(S%d.targetduration/d.partTarget);g+=j}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+S+" skip sn "+M+" to part "+g)}d.tuneInGoal=S}if(h=this.getDeliveryDirectives(d,T.deliveryDirectives,_,g),m||!u){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,T.deliveryDirectives,_,g);var G=Object(P.computeReloadInterval)(d,a);_!==void 0&&d.canBlockReload&&(G-=d.partTarget||1),this.log("reload live playlist "+k+" in "+Math.round(G)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(h)},G)}else this.clearTimer()},b.getDeliveryDirectives=function(k,T,C,E){var d=Object(B.getSkipValue)(k,C);return T!=null&&T.skip&&k.deltaUpdateFailed&&(C=T.msn,E=T.part,d=B.HlsSkip.No),new B.HlsUrlParameters(C,E,d)},b.retryLoadingOrFail=function(k){var T=this,C=this.hls.config,E=this.retryCount<C.levelLoadingMaxRetry;if(E){var d;if(this.retryCount++,k.details.indexOf("LoadTimeOut")>-1&&(d=k.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+k.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+k.details+'"')}}else this.warn('cannot recover from error "'+k.details+'"'),this.clearTimer(),k.fatal=!0;return E},D}()},"./src/controller/base-stream-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"State",function(){return y}),R.d($,"default",function(){return c});var Z=R("./src/polyfills/number.ts"),B=R("./src/task-loop.ts"),P=R("./src/controller/fragment-tracker.ts"),K=R("./src/utils/buffer-helper.ts"),U=R("./src/utils/logger.ts"),N=R("./src/events.ts"),D=R("./src/errors.ts"),b=R("./src/types/transmuxer.ts"),A=R("./src/utils/mp4-tools.ts"),k=R("./src/utils/discontinuities.ts"),T=R("./src/controller/fragment-finders.ts"),C=R("./src/controller/level-helper.ts"),E=R("./src/loader/fragment-loader.ts"),d=R("./src/crypt/decrypter.ts"),a=R("./src/utils/time-ranges.ts"),l=R("./src/types/loader.ts");function h(f,u){for(var o=0;o<u.length;o++){var x=u[o];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}function _(f,u,o){return u&&h(f.prototype,u),o&&h(f,o),f}function g(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function m(f,u){f.prototype=Object.create(u.prototype),f.prototype.constructor=f,L(f,u)}function L(f,u){return L=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},L(f,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"},c=function(f){m(u,f);function u(x,v,S){var M;return M=f.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=y.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=S,M.log=U.logger.log.bind(U.logger,S+":"),M.warn=U.logger.warn.bind(U.logger,S+":"),M.hls=x,M.fragmentLoader=new E.default(x.config),M.fragmentTracker=v,M.config=x.config,M.decrypter=new d.default(x,x.config),x.on(N.Events.KEY_LOADED,M.onKeyLoaded,g(M)),M}var o=u.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(v){},o.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},o._streamEnded=function(v,S){var M=this.fragCurrent,j=this.fragmentTracker;if(!S.live&&M&&M.sn===S.endSN&&!v.nextStart){var G=j.getState(M);return G===P.FragmentState.PARTIAL||G===P.FragmentState.OK}return!1},o.onMediaAttached=function(v,S){var M=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(j.startPosition)},o.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.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 v=this.config,S=this.fragCurrent,M=this.media,j=this.mediaBuffer,G=this.state,V=M?M.currentTime:0,O=K.BufferHelper.bufferInfo(j||M,V,v.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+G),G===y.ENDED)this.resetLoadingState();else if(S&&!O.len){var I=v.maxFragLookUpTolerance,X=S.start-I,q=S.start+S.duration+I,oe=V>q;(V<X||oe)&&(oe&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=V),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(v,S){if(this.state!==y.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var M=this.levels[S.frag.level].details;M&&this.loadFragment(S.frag,M,S.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),f.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,f.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(v,S){this.log("Loading key for "+v.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=y.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(N.Events.KEY_LOADING,{frag:v})},o.loadFragment=function(v,S,M){this._loadFragForPlayback(v,S,M)},o._loadFragForPlayback=function(v,S,M){var j=this,G=function(O){if(j.fragContextChanged(v)){j.warn("Fragment "+v.sn+(O.part?" p: "+O.part.index:"")+" of level "+v.level+" was dropped during download."),j.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,j._handleFragmentLoadProgress(O)};this._doFragLoad(v,S,M,G).then(function(V){if(!V)return;j.fragLoadError=0;var O=j.state;if(j.fragContextChanged(v)){(O===y.FRAG_LOADING||O===y.BACKTRACKING||!j.fragCurrent&&O===y.PARSING)&&(j.fragmentTracker.removeFragment(v),j.state=y.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+v.sn+" of level "+v.level),j.hls.trigger(N.Events.FRAG_LOADED,V),j.state===y.BACKTRACKING)){j.fragmentTracker.backtrack(v,V),j.resetFragmentLoading(v);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(v)})},o.flushMainBuffer=function(v,S,M){if(M===void 0&&(M=null),!(v-S))return;var j={startOffset:v,endOffset:S,type:M};this.fragLoadError=0,this.hls.trigger(N.Events.BUFFER_FLUSHING,j)},o._loadInitSegment=function(v){var S=this;this._doFragLoad(v).then(function(M){if(!M||S.fragContextChanged(v)||!S.levels)throw new Error("init load aborted");return M}).then(function(M){var j=S.hls,G=M.payload,V=v.decryptdata;if(G&&G.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var O=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(G),V.key.buffer,V.iv.buffer).then(function(I){var X=self.performance.now();return j.trigger(N.Events.FRAG_DECRYPTED,{frag:v,payload:I,stats:{tstart:O,tdecrypt:X}}),M.payload=I,M})}return M}).then(function(M){var j=S.fragCurrent,G=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var O=V[v.level].details;console.assert(O,"Level details are defined when init segment is loaded");var I=v.stats;S.state=y.IDLE,S.fragLoadError=0,v.data=new Uint8Array(M.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),M.frag===j&&G.trigger(N.Events.FRAG_BUFFERED,{stats:I,frag:j,part:null,id:v.type}),S.tick()}).catch(function(M){S.warn(M),S.resetFragmentLoading(v)})},o.fragContextChanged=function(v){var S=this.fragCurrent;return!v||!S||v.level!==S.level||v.sn!==S.sn||v.urlId!==S.urlId},o.fragBufferedComplete=function(v,S){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+a.default.toString(K.BufferHelper.getBuffered(M))),this.state=y.IDLE,this.tick()},o._handleFragmentLoadComplete=function(v){var S=this.transmuxer;if(!S)return;var M=v.frag,j=v.part,G=v.partsLoaded,V=!G||G.length===0||G.some(function(I){return!I}),O=new b.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,j?j.index:-1,!V);S.flush(O)},o._handleFragmentLoadProgress=function(v){},o._doFragLoad=function(v,S,M,j){var G=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(v.start,M||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&j){M>v.end&&S.fragmentHint&&(v=S.fragmentHint);var O=this.getNextPart(V,v,M);if(O>-1){var I=V[O];return this.log("Loading part sn: "+v.sn+" p: "+I.index+" cc: "+v.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+O+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=y.FRAG_LOADING,this.hls.trigger(N.Events.FRAG_LOADING,{frag:v,part:V[O],targetBufferTime:M}),this.doFragPartsLoad(v,V,O,j).catch(function(X){return G.handleFragLoadError(X)})}else if(!v.url||this.loadedEndOfParts(V,M))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(M.toFixed(3))),Object(Z.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=y.FRAG_LOADING,this.hls.trigger(N.Events.FRAG_LOADING,{frag:v,targetBufferTime:M}),this.fragmentLoader.load(v,j).catch(function(X){return G.handleFragLoadError(X)})},o.doFragPartsLoad=function(v,S,M,j){var G=this;return new Promise(function(V,O){var I=[],X=function q(oe){var ce=S[oe];G.fragmentLoader.loadPart(v,ce,j).then(function(Le){I[ce.index]=Le;var Ee=Le.part;G.hls.trigger(N.Events.FRAG_LOADED,Le);var we=S[oe+1];if(we&&we.fragment===v)q(oe+1);else return V({frag:v,part:Ee,partsLoaded:I})}).catch(O)};X(M)})},o.handleFragLoadError=function(v){var S=v.data;return S&&S.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(N.Events.ERROR,S),null},o._handleTransmuxerFlush=function(v){var S=this.getCurrentContext(v);if(!S||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var M=S.frag,j=S.part,G=S.level,V=self.performance.now();M.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(M,j,G,v.partial)},o.getCurrentContext=function(v){var S=this.levels,M=v.level,j=v.sn,G=v.part;if(!S||!S[M])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+M+". The current chunk will not be buffered."),null;var V=S[M],O=G>-1?Object(C.getPartWith)(V,j,G):null,I=O?O.fragment:Object(C.getFragmentWithSN)(V,j,this.fragCurrent);return I?{frag:I,part:O,level:V}:null},o.bufferFragmentData=function(v,S,M,j){if(!v||this.state!==y.PARSING)return;var G=v.data1,V=v.data2,O=G;if(G&&V&&(O=Object(A.appendUint8Array)(G,V)),!O||!O.length)return;var I={type:v.type,frag:S,part:M,chunkMeta:j,parent:S.type,data:O};this.hls.trigger(N.Events.BUFFER_APPENDING,I),v.dropped&&v.independent&&!M&&this.flushBufferGap(S)},o.flushBufferGap=function(v){var S=this.media;if(!S)return;if(!K.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,v.start);return}var M=S.currentTime,j=K.BufferHelper.bufferInfo(S,M,0),G=v.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,G*.25),O=Math.max(Math.min(v.start-V,j.end-V),M+V);v.start-O>V&&this.flushMainBuffer(O,v.start)},o.getFwdBufferInfo=function(v,S){var M=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var G=K.BufferHelper.bufferInfo(v,j,M.maxBufferHole);if(G.len===0&&G.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,S);if(V&&G.nextStart<V.end)return K.BufferHelper.bufferInfo(v,j,Math.max(G.nextStart,M.maxBufferHole))}return G},o.getMaxBufferLength=function(v){var S=this.config,M;return v?M=Math.max(8*S.maxBufferSize/v,S.maxBufferLength):M=S.maxBufferLength,Math.min(M,S.maxMaxBufferLength)},o.reduceMaxBufferLength=function(v){var S=this.config,M=v||S.maxBufferLength;return S.maxMaxBufferLength>=M?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(v,S){var M,j,G=S.fragments,V=G.length;if(!V)return null;var O=this.config,I=G[0].start,X;if(S.live){var q=O.initialLiveManifestSize;if(V<q)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+q+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(S,G),this.startPosition=X?this.hls.liveSyncPosition||X.start:v)}else v<=I&&(X=G[0]);if(!X){var oe=O.lowLatencyMode?S.partEnd:S.fragmentEnd;X=this.getFragmentAtPosition(v,oe,S)}return(M=X)!==null&&M!==void 0&&M.initSegment&&!((j=X)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(v,S,M){for(var j=-1,G=!1,V=!0,O=0,I=v.length;O<I;O++){var X=v[O];if(V=V&&!X.independent,j>-1&&M<X.start)break;var q=X.loaded;!q&&(G||X.independent||V)&&X.fragment===S&&(j=O),G=q}return j},o.loadedEndOfParts=function(v,S){var M=v[v.length-1];return M&&S>M.start&&M.loaded},o.getInitialLiveFragment=function(v,S){var M=this.fragPrevious,j=null;if(M){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),j=Object(T.findFragmentByPDT)(S,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var G=M.sn+1;if(G>=v.startSN&&G<=v.endSN){var V=S[G-v.startSN];M.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(T.findFragWithCC)(S,M.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(j=this.getFragmentAtPosition(O,this.bitrateTest?v.fragmentEnd:v.edge,v))}return j},o.getFragmentAtPosition=function(v,S,M){var j=this.config,G=this.fragPrevious,V=M.fragments,O=M.endSN,I=M.fragmentHint,X=j.maxFragLookUpTolerance,q=!!(j.lowLatencyMode&&M.partList&&I);q&&I&&!this.bitrateTest&&(V=V.concat(I),O=I.sn);var oe;if(v<S){var ce=v>S-X?0:X;oe=Object(T.findFragmentByPTS)(G,V,v,ce)}else oe=V[V.length-1];if(oe){var Le=oe.sn-M.startSN,Ee=G&&oe.level===G.level,we=V[Le+1],Te=this.fragmentTracker.getState(oe);if(Te===P.FragmentState.BACKTRACKED){oe=null;for(var ye=Le;V[ye]&&this.fragmentTracker.getState(V[ye])===P.FragmentState.BACKTRACKED;)G?oe=V[ye--]:oe=V[--ye];oe||(oe=we)}else G&&oe.sn===G.sn&&!q&&(Ee&&(oe.sn<O&&this.fragmentTracker.getState(we)!==P.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+we.sn),oe=we):oe=null))}return oe},o.synchronizeToLiveEdge=function(v){var S=this.config,M=this.media;if(!M)return;var j=this.hls.liveSyncPosition,G=M.currentTime,V=v.fragments[0].start,O=v.edge,I=G>=V-S.maxFragLookUpTolerance&&G<=O;if(j!==null&&M.duration>j&&(G<j||!I)){var X=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*v.targetduration;(!I&&M.readyState<4||G<O-X)&&(this.loadedmetadata||(this.nextLoadPosition=j),M.readyState&&(this.warn("Playback: "+G.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+j.toFixed(3)),M.currentTime=j))}},o.alignPlaylists=function(v,S){var M=this.levels,j=this.levelLastLoaded,G=this.fragPrevious,V=j!==null?M[j]:null,O=v.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var I=v.fragments[0].start,X=!S,q=v.alignedSliding&&Object(Z.isFiniteNumber)(I);if(X||!q&&!I){Object(k.alignStream)(G,V,v);var oe=v.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+v.startSN+" prev-sn: "+(G?G.sn:"na")+" fragments: "+O),oe}return I},o.waitForCdnTuneIn=function(v){var S=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*S)},o.setStartPosition=function(v,S){var M=this.startPosition;if(M<S&&(M=-1),M===-1||this.lastCurrentTime===-1){var j=v.startTimeOffset;Object(Z.isFiniteNumber)(j)?(M=S+j,j<0&&(M+=v.totalduration),M=Math.min(Math.max(S,M),S+v.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+M),this.startPosition=M):v.live?M=this.hls.liveSyncPosition||S:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},o.getLoadPosition=function(){var v=this.media,S=0;return this.loadedmetadata&&v?S=v.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},o.handleFragLoadAborted=function(v,S){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(S?" part"+S.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},o.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=y.IDLE)},o.onFragmentOrKeyLoadError=function(v,S){if(S.fatal)return;var M=S.frag;if(!M||M.type!==v)return;var j=this.fragCurrent;console.assert(j&&M.sn===j.sn&&M.level===j.level&&M.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(M.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*G.fragLoadingRetryDelay,G.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+v+" "+M.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(v===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(U.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},o.afterBufferFlushed=function(v,S,M){if(!v)return;var j=K.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(S,j,M),this.state===y.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},o.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[v].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(v,S,M,j){var G=this,V=M.details;console.assert(!!V,"level.details must be defined");var O=Object.keys(v.elementaryStreams).reduce(function(I,X){var q=v.elementaryStreams[X];if(q){var oe=q.endPTS-q.startPTS;if(oe<=0)return G.warn("Could not parse fragment "+v.sn+" "+X+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),G.resetTransmuxer(),I||!1;var ce=j?0:Object(C.updateFragPTSDTS)(V,v,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return G.hls.trigger(N.Events.LEVEL_PTS_UPDATED,{details:V,level:M,drift:ce,type:X,frag:v,start:q.startPTS,end:q.endPTS}),!0}return I},!1);O?(this.state=y.PARSED,this.hls.trigger(N.Events.FRAG_PARSED,{frag:v,part:S})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},_(u,[{key:"state",get:function(){return this._state},set:function(v){var S=this._state;S!==v&&(this._state=v,this.log(S+"->"+v))}}]),u}(B.default)},"./src/controller/buffer-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var Z=R("./src/polyfills/number.ts"),B=R("./src/events.ts"),P=R("./src/utils/logger.ts"),K=R("./src/errors.ts"),U=R("./src/utils/buffer-helper.ts"),N=R("./src/utils/mediasource-helper.ts"),D=R("./src/loader/fragment.ts"),b=R("./src/controller/buffer-operation-queue.ts"),A=Object(N.getMediaSource)(),k=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function C(d){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=a.hls,h=a.media,_=a.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:h})),_&&_.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var E=C.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var a=this.hls;a.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(B.Events.BUFFER_RESET,this.onBufferReset,this),a.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(B.Events.BUFFER_EOS,this.onBufferEos,this),a.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(B.Events.FRAG_PARSED,this.onFragParsed,this),a.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(B.Events.BUFFER_RESET,this.onBufferReset,this),a.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(B.Events.BUFFER_EOS,this.onBufferEos,this),a.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(B.Events.FRAG_PARSED,this.onFragParsed,this),a.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(a,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(a,l){var h=this.media=l.media;if(h&&A){var _=this.mediaSource=new A;_.addEventListener("sourceopen",this._onMediaSourceOpen),_.addEventListener("sourceended",this._onMediaSourceEnded),_.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(_),this._objectUrl=h.src}},E.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(_){P.logger.warn("[buffer-controller]: onMediaDetaching: "+_.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(B.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var h=a.sourceBuffer[l];try{h&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[l]=void 0)}catch(_){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",_)}}),this._initSourceBuffer()},E.onBufferCodecs=function(a,l){var h=this,_=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(g){if(_){var m=h.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var L=l[g],y=L.codec,c=L.levelCodec,f=L.container,u=(m.levelCodec||m.codec).replace(k,"$1"),o=(c||y).replace(k,"$1");if(u!==o){var x=f+";codecs="+(c||y);h.appendChangeType(g,x)}}}else h.pendingTracks[g]=l[g]}),_)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(a,l){var h=this,_=this.operationQueue,g={execute:function(){var L=h.sourceBuffer[a];L&&(P.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),L.changeType(l)),_.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",L)}};_.append(g,a)},E.onBufferAppending=function(a,l){var h=this,_=this.hls,g=this.operationQueue,m=this.tracks,L=l.data,y=l.type,c=l.frag,f=l.part,u=l.chunkMeta,o=u.buffering[y],x=self.performance.now();o.start=x;var v=c.stats.buffering,S=f?f.stats.buffering:null;v.start===0&&(v.start=x),S&&S.start===0&&(S.start=x);var M=m.audio,j=y==="audio"&&u.id===1&&(M==null?void 0:M.container)==="audio/mpeg",G={execute:function(){if(o.executeStart=self.performance.now(),j){var O=h.sourceBuffer[y];if(O){var I=c.start-O.timestampOffset;Math.abs(I)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+I+") sn: "+c.sn+")"),O.timestampOffset=c.start)}}h.appendExecutor(L,y)},onStart:function(){},onComplete:function(){var O=self.performance.now();o.executeEnd=o.end=O,v.first===0&&(v.first=O),S&&S.first===0&&(S.first=O);var I=h.sourceBuffer,X={};for(var q in I)X[q]=U.BufferHelper.getBuffered(I[q]);h.appendError=0,h.hls.trigger(B.Events.BUFFER_APPENDED,{type:y,frag:c,part:f,chunkMeta:u,parent:c.type,timeRanges:X})},onError:function(O){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",O);var I={type:K.ErrorTypes.MEDIA_ERROR,parent:c.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=K.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,I.details=K.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>_.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+_.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),_.trigger(B.Events.ERROR,I)}};g.append(G,y)},E.onBufferFlushing=function(a,l){var h=this,_=this.operationQueue,g=function(L){return{execute:h.removeExecutor.bind(h,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(B.Events.BUFFER_FLUSHED,{type:L})},onError:function(c){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",c)}}};l.type?_.append(g(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){_.append(g(m),m)})},E.onFragParsed=function(a,l){var h=this,_=l.frag,g=l.part,m=[],L=g?g.elementaryStreams:_.elementaryStreams;L[D.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(L[D.ElementaryStreamTypes.AUDIO]&&m.push("audio"),L[D.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var f=self.performance.now();_.stats.buffering.end=f,g&&(g.stats.buffering.end=f);var u=g?g.stats:_.stats;h.hls.trigger(B.Events.FRAG_BUFFERED,{frag:_,part:g,stats:u,id:_.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+_.type+" level: "+_.level+" sn: "+_.sn),this.blockBuffers(y,m)},E.onFragChanged=function(a,l){this.flushBackBuffer()},E.onBufferEos=function(a,l){var h=this,_=this.getSourceBufferTypes().reduce(function(g,m){var L=h.sourceBuffer[m];return(!l.type||l.type===m)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!L||L.ended)},!0);_&&this.blockBuffers(function(){var g=h.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},E.onLevelUpdated=function(a,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var a=this.hls,l=this.details,h=this.media,_=this.sourceBuffer;if(!h||l===null)return;var g=this.getSourceBufferTypes();if(!g.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=h.currentTime,y=l.levelTargetDuration,c=Math.max(m,y),f=Math.floor(L/y)*y-c;g.forEach(function(u){var o=_[u];if(o){var x=U.BufferHelper.getBuffered(o);x.length>0&&f>x.start(0)&&(a.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),l.live&&a.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),a.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:u}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,h=this.media,_=this.mediaSource,g=a.fragments[0].start+a.totalduration,m=h.duration,L=Object(Z.isFiniteNumber)(_.duration)?_.duration:0;a.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),_.duration=Infinity,this.updateSeekableRange(a)):(g>L&&g>m||!Object(Z.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),_.duration=g)},E.updateSeekableRange=function(a){var l=this.mediaSource,h=a.fragments,_=h.length;if(_&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var g=Math.max(0,h[0].start),m=Math.max(g,g+a.totalduration);l.setLiveSeekableRange(g,m)}},E.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,_=Object.keys(h).length;if(_&&!a||_===2){this.createSourceBuffers(h),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(B.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}g.forEach(function(m){l.executeNext(m)})}},E.createSourceBuffers=function(a){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var _=0;for(var g in a)if(!l[g]){var m=a[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var L=m.levelCodec||m.codec,y=m.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var c=l[g]=h.addSourceBuffer(y),f=g;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[g]={buffer:c,codec:L,container:m.container,levelCodec:m.levelCodec,id:m.id},_++}catch(u){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:y})}}_&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(a){var l=this.operationQueue,h=l.current(a);h.onStart()},E._onSBUpdateEnd=function(a){var l=this.operationQueue,h=l.current(a);h.onComplete(),l.shiftAndExecuteNext(a)},E._onSBUpdateError=function(a,l){P.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(l)},E.removeExecutor=function(a,l,h){var _=this.media,g=this.mediaSource,m=this.operationQueue,L=this.sourceBuffer,y=L[a];if(!_||!g||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(a);return}var c=Object(Z.isFiniteNumber)(_.duration)?_.duration:Infinity,f=Object(Z.isFiniteNumber)(g.duration)?g.duration:Infinity,u=Math.max(0,l),o=Math.min(h,c,f);o>u?(P.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)},E.appendExecutor=function(a,l){var h=this.operationQueue,_=this.sourceBuffer,g=_[l];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}g.ended=!1,console.assert(!g.updating,l+" sourceBuffer must not be updating"),g.appendBuffer(a)},E.blockBuffers=function(a,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var _=this.operationQueue,g=l.map(function(m){return _.appendBlocker(m)});Promise.all(g).then(function(){a(),l.forEach(function(m){var L=h.sourceBuffer[m];(!L||!L.updating)&&_.shiftAndExecuteNext(m)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(a,l,h){var _=this.sourceBuffer[a];if(!_)return;var g=h.bind(this,a);this.listeners[a].push({event:l,listener:g}),_.addEventListener(l,g)},E.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(h){l.removeEventListener(h.event,h.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return B});var Z=R("./src/utils/logger.ts"),B=function(){function P(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var K=P.prototype;return K.append=function(N,D){var b=this.queues[D];b.push(N),b.length===1&&this.buffers[D]&&this.executeNext(D)},K.insertAbort=function(N,D){var b=this.queues[D];b.unshift(N),this.executeNext(D)},K.appendBlocker=function(N){var D,b=new Promise(function(k){D=k}),A={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,N),b},K.executeNext=function(N){var D=this.buffers,b=this.queues,A=D[N],k=b[N];if(k.length){var T=k[0];try{T.execute()}catch(C){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(C),(!A||!A.updating)&&(k.shift(),this.executeNext(N))}}},K.shiftAndExecuteNext=function(N){this.queues[N].shift(),this.executeNext(N)},K.current=function(N){return this.queues[N][0]},P}()},"./src/controller/cap-level-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts");function B(U,N){for(var D=0;D<N.length;D++){var b=N[D];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(U,b.key,b)}}function P(U,N,D){return N&&B(U.prototype,N),D&&B(U,D),U}var K=function(){function U(D){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=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var N=U.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,A){U.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},N.onMediaAttaching=function(b,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},N.onManifestParsed=function(b,A){var k=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,k.config.capLevelToPlayerSize&&A.video&&this.startCapping()},N.onBufferCodecs=function(b,A){var k=this.hls;k.config.capLevelToPlayerSize&&A.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 A=this.hls;A.autoLevelCapping=this.getMaxLevel(b.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},N.getMaxLevel=function(b){var A=this,k=this.hls.levels;if(!k.length)return-1;var T=k.filter(function(C,E){return U.isLevelAllowed(E,A.restrictedLevels)&&E<=b});return this.clientRect=null,U.getMaxLevelByMediaSize(T,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,A={width:0,height:0};if(b){var k=b.getBoundingClientRect();A.width=k.width,A.height=k.height,!A.width&&!A.height&&(A.width=k.right-k.left||b.width||0,A.height=k.bottom-k.top||b.height||0)}return this.clientRect=A,A},U.isLevelAllowed=function(b,A){return A===void 0&&(A=[]),A.indexOf(b)===-1},U.getMaxLevelByMediaSize=function(b,A,k){if(!b||!b.length)return-1;for(var T=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},C=b.length-1,E=0;E<b.length;E+=1){var d=b[E];if((d.width>=A||d.height>=k)&&T(d,b[E+1])){C=E;break}}return C},P(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(A){}return b}}]),U}();$.default=K},"./src/controller/cmcd-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var Z=R("./src/events.ts"),B=R("./src/types/cmcd.ts"),P=R("./src/utils/buffer-helper.ts"),K=R("./src/utils/logger.ts");function U(C,E){for(var d=0;d<E.length;d++){var a=E[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(C,a.key,a)}}function N(C,E,d){return E&&U(C.prototype,E),d&&U(C,d),C}function D(C,E){var d=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(d)return(d=d.call(C)).next.bind(d);if(Array.isArray(C)||(d=b(C))||E&&C&&typeof C.length=="number"){d&&(C=d);var a=0;return function(){return a>=C.length?{done:!0}:{done:!1,value:C[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(C,E){if(!C)return;if(typeof C=="string")return A(C,E);var d=Object.prototype.toString.call(C).slice(8,-1);if(d==="Object"&&C.constructor&&(d=C.constructor.name),d==="Map"||d==="Set")return Array.from(C);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(C,E)}function A(C,E){(E==null||E>C.length)&&(E=C.length);for(var d=0,a=new Array(E);d<E;d++)a[d]=C[d];return a}function k(){return k=Object.assign||function(C){for(var E=1;E<arguments.length;E++){var d=arguments[E];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(C[a]=d[a])}return C},k.apply(this,arguments)}var T=function(){function C(d){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(_){try{a.apply(_,{ot:B.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(g){K.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(_){try{var g=_.frag,m=a.hls.levels[g.level],L=a.getObjectType(g),y={d:g.duration*1e3,ot:L};(L===B.CMCDObjectType.VIDEO||L===B.CMCDObjectType.AUDIO||L==B.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=a.getTopBandwidth(L),y.bl=a.getBufferLength(L)),a.apply(_,y)}catch(c){K.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=d;var l=this.config=d.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||C.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var E=C.prototype;return E.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)},E.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()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(a,l){var h,_;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(_=l.tracks.video)===null||_===void 0?void 0:_.buffer},E.createData=function(){var a;return{v:B.CMCDVersion,sf:B.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}},E.apply=function(a,l){l===void 0&&(l={}),k(l,this.createData());var h=l.ot===B.CMCDObjectType.INIT||l.ot===B.CMCDObjectType.VIDEO||l.ot===B.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var _=C.toHeaders(l);if(!Object.keys(_).length)return;a.headers||(a.headers={}),k(a.headers,_)}else{var g=C.toQuery(l);if(!g)return;a.url=C.appendQueryToUri(a.url,g)}},E.getObjectType=function(a){var l=a.type;return l==="subtitle"?B.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?B.CMCDObjectType.INIT:l==="audio"?B.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(a){for(var l=0,h=a===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,_=D(h),g;!(g=_()).done;){var m=g.value;m.bitrate>l&&(l=m.bitrate)}return l>0?l:NaN},E.getBufferLength=function(a){var l=this.hls.media,h=a===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var _=P.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return _.len*1e3},E.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,h=a||this.config.loader;return function(){function _(m){this.loader=void 0,this.loader=new h(m)}var g=_.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,y,c){l(L),this.loader.load(L,y,c)},N(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},E.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,h=a||this.config.loader;return function(){function _(m){this.loader=void 0,this.loader=new h(m)}var g=_.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,y,c){l(L),this.loader.load(L,y,c)},N(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},C.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},C.serialize=function(a){for(var l=[],h=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},_=function(j){return Math.round(j)},g=function(j){return _(j/100)*100},m=function(j){return encodeURIComponent(j)},L={br:_,d:_,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:_},y=Object.keys(a||{}).sort(),c=D(y),f;!(f=c()).done;){var u=f.value,o=a[u];if(!h(o))continue;if(u==="v"&&o===1)continue;if(u=="pr"&&o===1)continue;var x=L[u];x&&(o=x(o));var v=typeof o,S=void 0;u==="ot"||u==="sf"||u==="st"?S=u+"="+o:v==="boolean"?S=u:v==="number"?S=u+"="+o:S=u+"="+JSON.stringify(o),l.push(S)}return l.join(",")},C.toHeaders=function(a){for(var l=Object.keys(a),h={},_=["Object","Request","Session","Status"],g=[{},{},{},{}],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 c=y[L],f=m[c]!=null?m[c]:1;g[f][c]=a[c]}for(var u=0;u<g.length;u++){var o=C.serialize(g[u]);o&&(h["CMCD-"+_[u]]=o)}return h},C.toQuery=function(a){return"CMCD="+encodeURIComponent(C.serialize(a))},C.appendQueryToUri=function(a,l){if(!l)return a;var h=a.includes("?")?"&":"?";return""+a+h+l},C}()},"./src/controller/eme-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts"),B=R("./src/errors.ts"),P=R("./src/utils/logger.ts"),K=R("./src/utils/mediakeys-helper.ts");function U(T,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(T,d.key,d)}}function N(T,C,E){return C&&U(T.prototype,C),E&&U(T,E),T}var D=3,b=function(C,E,d){var a={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),E.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[a]},A=function(C,E,d,a){switch(C){case K.KeySystems.WIDEVINE:return b(E,d,a);default:throw new Error("Unknown key-system: "+C)}},k=function(){function T(E){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=E,this._config=E.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 C=T.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._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)},C._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)},C.getLicenseServerUrl=function(d){switch(d){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},C._attemptKeySystemAccess=function(d,a,l){var h=this,_=A(d,a,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(d,_);this.mediaKeysPromise=g.then(function(m){return h._onMediaKeySystemAccessObtained(d,m)}),g.catch(function(m){P.logger.error('Failed to obtain key-system "'+d+'" access:',m)})},C._onMediaKeySystemAccessObtained=function(d,a){var l=this;P.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var _=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(g){return h.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),g});return _.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),_},C._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},C._onNewMediaKeySession=function(d){var a=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){a._onKeySessionMessage(d,l.message)},!1)},C._onKeySessionMessage=function(d,a){P.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},C.onMediaEncrypted=function(d){var a=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(_){if(!a._media)return;a._attemptSetMediaKeys(_),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},C._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(d,a){var l=this,h=this._mediaKeysList[0];if(!h){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var _=h.mediaKeysSession;if(!_){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,_.generateRequest(d,a).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),l.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(d,a,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,a,l);var _=this._licenseXhrSetup;if(_)try{_.call(this.hls,h,d),_=void 0}catch(g){P.logger.error(g)}try{h.readyState||h.open("POST",d,!0),_&&_.call(this.hls,h,d)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return h},C._onLicenseRequestReadyStageChange=function(d,a,l,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var _=d.response,g=this._licenseResponseCallback;if(g)try{_=g.call(this.hls,d,a)}catch(L){P.logger.error(L)}h(_)}else{if(P.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=D-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,h)}break}},C._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},C._requestLicense=function(d,a){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),_=this._createLicenseXhr(h,d,a);P.logger.log("Sending license request to URL: "+h);var g=this._generateLicenseRequestChallenge(l,d);_.send(g)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var l=a.levels.map(function(_){return _.audioCodec}).filter(function(_){return!!_}),h=a.levels.map(function(_){return _.videoCodec}).filter(function(_){return!!_});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,l,h)},N(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();$.default=k},"./src/controller/fps-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts"),B=R("./src/utils/logger.ts"),P=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 U=K.prototype;return U.setStreamController=function(D){this.streamController=D},U.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(D,b){var A=this.hls.config;if(A.capLevelOnFPSDrop){var k=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=k,k&&typeof k.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(D,b,A){var k=performance.now();if(b){if(this.lastTime){var T=k-this.lastTime,C=A-this.lastDroppedFrames,E=b-this.lastDecodedFrames,d=1e3*C/T,a=this.hls;if(a.trigger(Z.Events.FPS_DROP,{currentDropped:C,currentDecoded:E,totalDroppedFrames:A}),d>0&&C>a.config.fpsDroppedMonitoringThreshold*E){var l=a.currentLevel;B.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=k,this.lastDroppedFrames=A,this.lastDecodedFrames=b}},U.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var b=D.getVideoPlaybackQuality();this.checkFPS(D,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},K}();$.default=P},"./src/controller/fragment-finders.ts":function(le,$,R){"use strict";R.r($),R.d($,"findFragmentByPDT",function(){return P}),R.d($,"findFragmentByPTS",function(){return K}),R.d($,"fragmentWithinToleranceTest",function(){return U}),R.d($,"pdtWithinToleranceTest",function(){return N}),R.d($,"findFragWithCC",function(){return D});var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/binary-search.ts");function P(b,A,k){if(A===null||!Array.isArray(b)||!b.length||!Object(Z.isFiniteNumber)(A))return null;var T=b[0].programDateTime;if(A<(T||0))return null;var C=b[b.length-1].endProgramDateTime;if(A>=(C||0))return null;k=k||0;for(var E=0;E<b.length;++E){var d=b[E];if(N(A,k,d))return d}return null}function K(b,A,k,T){k===void 0&&(k=0),T===void 0&&(T=0);var C=null;if(b?C=A[b.sn-A[0].sn+1]||null:k===0&&A[0].start===0&&(C=A[0]),C&&U(k,T,C)===0)return C;var E=B.default.search(A,U.bind(null,k,T));return E||C}function U(b,A,k){b===void 0&&(b=0),A===void 0&&(A=0);var T=Math.min(A,k.duration+(k.deltaPTS?k.deltaPTS:0));return k.start+k.duration-T<=b?1:k.start-T>b&&k.start?-1:0}function N(b,A,k){var T=Math.min(A,k.duration+(k.deltaPTS?k.deltaPTS:0))*1e3,C=k.endProgramDateTime||0;return C-T>b}function D(b,A){return B.default.search(b,function(k){return k.cc<A?1:k.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,$,R){"use strict";R.r($),R.d($,"FragmentState",function(){return P}),R.d($,"FragmentTracker",function(){return K});var Z=R("./src/events.ts"),B=R("./src/types/loader.ts"),P;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(P||(P={}));var K=function(){function D(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var b=D.prototype;return b._registerListeners=function(){var k=this.hls;k.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var k=this.hls;k.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(k,T){if(T===B.PlaylistLevelType.MAIN){var C=this.activeFragment,E=this.activeParts;if(!C)return null;if(E)for(var d=E.length;d--;){var a=E[d],l=a?a.end:C.appendedPTS;if(a.start<=k&&l!==void 0&&k<=l)return d>9&&(this.activeParts=E.slice(d-9)),a}else if(C.start<=k&&C.appendedPTS!==void 0&&k<=C.appendedPTS)return C}return this.getBufferedFrag(k,T)},b.getBufferedFrag=function(k,T){for(var C=this.fragments,E=Object.keys(C),d=E.length;d--;){var a=C[E[d]];if((a==null?void 0:a.body.type)===T&&a.buffered){var l=a.body;if(l.start<=k&&k<=l.end)return l}}return null},b.detectEvictedFragments=function(k,T,C){var E=this;Object.keys(this.fragments).forEach(function(d){var a=E.fragments[d];if(!a)return;if(!a.buffered){a.body.type===C&&E.removeFragment(a.body);return}var l=a.range[k];if(!l)return;l.time.some(function(h){var _=!E.isTimeBuffered(h.startPTS,h.endPTS,T);return _&&E.removeFragment(a.body),_})})},b.detectPartialFragments=function(k){var T=this,C=this.timeRanges,E=k.frag,d=k.part;if(!C||E.sn==="initSegment")return;var a=N(E),l=this.fragments[a];if(!l)return;Object.keys(C).forEach(function(h){var _=E.elementaryStreams[h];if(!_)return;var g=C[h],m=d!==null||_.partial===!0;l.range[h]=T.getBufferedTimes(E,d,m,g)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},b.fragBuffered=function(k){var T=N(k),C=this.fragments[T];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},b.getBufferedTimes=function(k,T,C,E){for(var d={time:[],partial:C},a=T?T.start:k.start,l=T?T.end:k.end,h=k.minEndPTS||l,_=k.maxStartPTS||a,g=0;g<E.length;g++){var m=E.start(g)-this.bufferPadding,L=E.end(g)+this.bufferPadding;if(_>=m&&h<=L){d.time.push({startPTS:Math.max(a,E.start(g)),endPTS:Math.min(l,E.end(g))});break}else if(a<L&&l>m)d.partial=!0,d.time.push({startPTS:Math.max(a,E.start(g)),endPTS:Math.min(l,E.end(g))});else if(l<=m)break}return d},b.getPartialFragment=function(k){var T=null,C,E,d,a=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(_){var g=h[_];if(!g)return;U(g)&&(E=g.body.start-l,d=g.body.end+l,k>=E&&k<=d&&(C=Math.min(k-E,d-k),a<=C&&(T=g.body,a=C)))}),T},b.getState=function(k){var T=N(k),C=this.fragments[T];return C?C.buffered?U(C)?P.PARTIAL:P.OK:C.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},b.backtrack=function(k,T){var C=N(k),E=this.fragments[C];if(!E||E.backtrack)return null;var d=E.backtrack=T||E.loaded;return E.loaded=null,d},b.getBacktrackData=function(k){var T=N(k),C=this.fragments[T];if(C){var E,d=C.backtrack;if(d!=null&&(E=d.payload)!==null&&E!==void 0&&E.byteLength)return d;this.removeFragment(k)}return null},b.isTimeBuffered=function(k,T,C){for(var E,d,a=0;a<C.length;a++){if(E=C.start(a)-this.bufferPadding,d=C.end(a)+this.bufferPadding,k>=E&&T<=d)return!0;if(T<=E)return!1}return!1},b.onFragLoaded=function(k,T){var C=T.frag,E=T.part;if(C.sn==="initSegment"||C.bitrateTest||E)return;var d=N(C);this.fragments[d]={body:C,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(k,T){var C=this,E=T.frag,d=T.part,a=T.timeRanges;if(E.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=E,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var _=a[h];if(C.detectEvictedFragments(h,_),!d)for(var g=0;g<_.length;g++)E.appendedPTS=Math.max(_.end(g),E.appendedPTS||0)})},b.onFragBuffered=function(k,T){this.detectPartialFragments(T)},b.hasFragment=function(k){var T=N(k);return!!this.fragments[T]},b.removeFragmentsInRange=function(k,T,C){var E=this;Object.keys(this.fragments).forEach(function(d){var a=E.fragments[d];if(!a)return;if(a.buffered){var l=a.body;l.type===C&&l.start<T&&l.end>k&&E.removeFragment(l)}})},b.removeFragment=function(k){var T=N(k);k.stats.loaded=0,k.clearElementaryStreamInfo(),delete this.fragments[T]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function U(D){var b,A;return D.buffered&&(((b=D.range.video)===null||b===void 0?void 0:b.partial)||((A=D.range.audio)===null||A===void 0?void 0:A.partial))}function N(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"STALL_MINIMUM_DURATION_MS",function(){return U}),R.d($,"MAX_START_GAP_JUMP",function(){return N}),R.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),R.d($,"SKIP_BUFFER_RANGE_START",function(){return b}),R.d($,"default",function(){return A});var Z=R("./src/utils/buffer-helper.ts"),B=R("./src/errors.ts"),P=R("./src/events.ts"),K=R("./src/utils/logger.ts"),U=250,N=2,D=.1,b=.05,A=function(){function k(C,E,d,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=C,this.media=E,this.fragmentTracker=d,this.hls=a}var T=k.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(E){var d=this.config,a=this.media,l=this.stalled,h=a.currentTime,_=a.seeking,g=this.seeking&&!_,m=!this.seeking&&_;if(this.seeking=_,h!==E){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;K.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Z.BufferHelper.getBuffered(a).length)return;var y=Z.BufferHelper.bufferInfo(a,h,0),c=y.len>0,f=y.nextStart||0;if(!c&&!f)return;if(_){var u=y.len>N,o=!f||f-h>N&&!this.fragmentTracker.getPartialFragment(h);if(u||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,v=Math.max(f,y.start||0)-h,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=S==null||((x=S.details)===null||x===void 0)?void 0:x.live,j=M?S.details.targetduration*2:N;if(v>0&&v<=j){this._trySkipBufferHole(null);return}}var G=self.performance.now();if(l===null){this.stalled=G;return}var V=G-l;!_&&V>=U&&this._reportStall(y.len);var O=Z.BufferHelper.bufferInfo(a,h,d.maxBufferHole);this._tryFixBufferStall(O,V)},T._tryFixBufferStall=function(E,d){var a=this.config,l=this.fragmentTracker,h=this.media,_=h.currentTime,g=l.getPartialFragment(_);if(g){var m=this._trySkipBufferHole(g);if(m)return}E.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(E){var d=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="+E+")"),d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},T._trySkipBufferHole=function(E){for(var d=this.config,a=this.hls,l=this.media,h=l.currentTime,_=0,g=Z.BufferHelper.getBuffered(l),m=0;m<g.length;m++){var L=g.start(m);if(h+d.maxBufferHole>=_&&h<L){var y=Math.max(L+b,l.currentTime+D);return K.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+y),this.moved=!0,this.stalled=null,l.currentTime=y,E&&a.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+y,frag:E}),y}_=g.end(m)}return 0},T._tryNudgeBuffer=function(){var E=this.config,d=this.hls,a=this.media,l=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<E.nudgeMaxRetry){var _=l+h*E.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+l+" to "+_),a.currentTime=_,d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+E.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},k}()},"./src/controller/id3-track-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts"),B=R("./src/utils/texttrack-utils.ts"),P=R("./src/demux/id3.ts"),K=.25,U=function(){function N(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var D=N.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var A=this.hls;A.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var A=this.hls;A.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(A,k){this.media=k.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(A){if(!this.media)return;for(var k=0;k<A.length;k++){var T=A[k];if(T.kind==="metadata"&&T.label==="id3")return Object(B.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(A,k){if(!this.media)return;var T=k.frag,C=k.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<C.length;d++){var a=P.getID3Frames(C[d].data);if(a){var l=C[d].pts,h=d<C.length-1?C[d+1].pts:T.end,_=h-l;_<=0&&(h=l+K);for(var g=0;g<a.length;g++){var m=a[g];if(!P.isTimeStampFrame(m)){var L=new E(l,h,"");L.value=m,this.id3Track.addCue(L)}}}}},D.onBufferFlushing=function(A,k){var T=k.startOffset,C=k.endOffset,E=k.type;if(!E||E==="audio"){var d=this.id3Track;d&&Object(B.removeCuesInRange)(d,T,C)}},N}();$.default=U},"./src/controller/latency-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return N});var Z=R("./src/errors.ts"),B=R("./src/events.ts"),P=R("./src/utils/logger.ts");function K(D,b){for(var A=0;A<b.length;A++){var k=b[A];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(D,k.key,k)}}function U(D,b,A){return b&&K(D.prototype,b),A&&K(D,A),D}var N=function(){function D(A){var k=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 k.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var b=D.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},b.onMediaAttached=function(k,T){this.media=T.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(k,T){var C=T.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(k,T){if(T.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var k=this.media,T=this.levelDetails;if(!k||!T)return;this.currentTime=k.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var E=this.config,d=E.lowLatencyMode,a=E.maxLiveSyncPlaybackRate;if(!d||a===1)return;var l=this.targetLatency;if(l===null)return;var h=C-l,_=Math.min(this.maxLatency,l+T.targetduration),g=h<_;if(T.live&&g&&h>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,a)),L=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;k.playbackRate=Math.min(m,Math.max(1,L))}else k.playbackRate!==1&&k.playbackRate!==0&&(k.playbackRate=1)},b.estimateLiveEdge=function(){var k=this.levelDetails;return k===null?null:k.edge+k.age},b.computeLatency=function(){var k=this.estimateLiveEdge();return k===null?null:k-this.currentTime},U(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var k=this.config,T=this.levelDetails;return k.liveMaxLatencyDuration!==void 0?k.liveMaxLatencyDuration:T?k.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var k=this.levelDetails;if(k===null)return null;var T=k.holdBack,C=k.partHoldBack,E=k.targetduration,d=this.config,a=d.liveSyncDuration,l=d.liveSyncDurationCount,h=d.lowLatencyMode,_=this.hls.userConfig,g=h&&C||T;(_.liveSyncDuration||_.liveSyncDurationCount||g===0)&&(g=a!==void 0?a:l*E);var m=E,L=1;return g+Math.min(this.stallCount*L,m)}},{key:"liveSyncPosition",get:function(){var k=this.estimateLiveEdge(),T=this.targetLatency,C=this.levelDetails;if(k===null||T===null||C===null)return null;var E=C.edge,d=k-T-this.edgeStalled,a=E-C.totalduration,l=E-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(a,d),l)}},{key:"drift",get:function(){var k=this.levelDetails;return k===null?1:k.drift}},{key:"edgeStalled",get:function(){var k=this.levelDetails;if(k===null)return 0;var T=(this.config.lowLatencyMode&&k.partTarget||k.targetduration)*3;return Math.max(k.age-T,0)}},{key:"forwardBufferLength",get:function(){var k=this.media,T=this.levelDetails;if(!k||!T)return 0;var C=k.buffered.length;return C?k.buffered.end(C-1):T.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return d});var Z=R("./src/types/level.ts"),B=R("./src/events.ts"),P=R("./src/errors.ts"),K=R("./src/utils/codecs.ts"),U=R("./src/controller/level-helper.ts"),N=R("./src/controller/base-playlist-controller.ts"),D=R("./src/types/loader.ts");function b(){return b=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var _ in h)Object.prototype.hasOwnProperty.call(h,_)&&(a[_]=h[_])}return a},b.apply(this,arguments)}function A(a,l){for(var h=0;h<l.length;h++){var _=l[h];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function k(a,l,h){return l&&A(a.prototype,l),h&&A(a,h),a}function T(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,C(a,l)}function C(a,l){return C=Object.setPrototypeOf||function(_,g){return _.__proto__=g,_},C(a,l)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){T(l,a);function l(_){var g;return g=a.call(this,_,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var h=l.prototype;return h._registerListeners=function(){var g=this.hls;g.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(B.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var g=this.hls;g.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(B.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var g=this._levels;g.forEach(function(m){m.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(g,m){var L=[],y=[],c=[],f,u={},o,x=!1,v=!1,S=!1;if(m.levels.forEach(function(V){var O=V.attrs;x=x||!!(V.width&&V.height),v=v||!!V.videoCodec,S=S||!!V.audioCodec,E&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var I=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;o=u[I],o?o.url.push(V.url):(o=new Z.Level(V),u[I]=o,L.push(o)),O&&(O.AUDIO&&Object(U.addGroupId)(o,"audio",O.AUDIO),O.SUBTITLES&&Object(U.addGroupId)(o,"text",O.SUBTITLES))}),(x||v)&&S&&(L=L.filter(function(V){var O=V.videoCodec,I=V.width,X=V.height;return!!O||!!(I&&X)})),L=L.filter(function(V){var O=V.audioCodec,I=V.videoCodec;return(!O||Object(K.isCodecSupportedInMp4)(O,"audio"))&&(!I||Object(K.isCodecSupportedInMp4)(I,"video"))}),m.audioTracks&&(y=m.audioTracks.filter(function(V){return!V.audioCodec||Object(K.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(y)),m.subtitles&&(c=m.subtitles,Object(U.assignTrackIdsByGroup)(c)),L.length>0){f=L[0].bitrate,L.sort(function(V,O){return V.bitrate-O.bitrate}),this._levels=L;for(var M=0;M<L.length;M++)if(L[M].bitrate===f){this._firstLevel=M,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+f);break}var j=S&&!v,G={levels:L,audioTracks:y,subtitleTracks:c,firstLevel:this._firstLevel,stats:m.stats,audio:S,video:v,altAudio:!j&&y.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,G),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(g,m){if(a.prototype.onError.call(this,g,m),m.fatal)return;var L=m.context,y=this._levels[this.currentLevelIndex];if(L&&(L.type===D.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&L.groupId===y.audioGroupIds[y.urlId]||L.type===D.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&L.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,u;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(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 P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(f=!1),u=L.level),c=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,c=!0;break}u!==void 0&&this.recoverLevel(m,u,c,f)},h.recoverLevel=function(g,m,L,y){var c=g.details,f=this._levels[m];if(f.loadError++,L){var u=this.retryLoadingOrFail(g);if(u)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var o=f.url.length;if(o>1&&f.loadError<o)g.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var x=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(c+": switch to "+x),g.levelRetry=!0,this.hls.nextAutoLevel=x)}}},h.redundantFailover=function(g){var m=this._levels[g],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(c){c.urlId=y}),this.level=g}},h.onFragLoaded=function(g,m){var L=m.frag;if(L!==void 0&&L.type===D.PlaylistLevelType.MAIN){var y=this._levels[L.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},h.onLevelLoaded=function(g,m){var L,y=m.level,c=m.details,f=this._levels[y];if(!f){var u;this.warn("Invalid level index "+y),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(c.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,f.details)):(L=m.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(c.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(g,m){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var y=-1,c=this.hls.audioTracks[m.id].groupId,f=0;f<L.audioGroupIds.length;f++)if(L.audioGroupIds[f]===c){y=f;break}y!==L.urlId&&(L.urlId=y,this.startLoad())}},h.loadPlaylist=function(g){var m=this.currentLevelIndex,L=this._levels[m];if(this.canLoad&&L&&L.url.length>0){var y=L.urlId,c=L.url[y];if(g)try{c=g.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+y+" "+c),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:c,level:m,id:y,deliveryDirectives:g||null})}},h.removeLevel=function(g,m){var L=function(f,u){return u!==m},y=this._levels.filter(function(c,f){return f!==g?!0:c.url.length>1&&m!==void 0?(c.url=c.url.filter(L),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(L)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(L)),c.urlId=0,!0):!1}).map(function(c,f){var u=c.details;return u!=null&&u.fragments&&u.fragments.forEach(function(o){o.level=f}),c});this._levels=y,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:y})},k(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===g&&(m=L[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=L.length){var y=g<0;if(this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:y,reason:"invalid level idx"}),y)return;g=Math.min(g,L.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=L[c],u=L[g];this.log("switching to level "+g+" from "+c),this.currentLevelIndex=g;var o=b({},u,{level:g,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete o._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,o);var x=u.details;if(!x||x.live){var v=this.switchParams(u.uri,f==null?void 0:f.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),l}(N.default)},"./src/controller/level-helper.ts":function(le,$,R){"use strict";R.r($),R.d($,"addGroupId",function(){return P}),R.d($,"assignTrackIdsByGroup",function(){return K}),R.d($,"updatePTS",function(){return U}),R.d($,"updateFragPTSDTS",function(){return D}),R.d($,"mergeDetails",function(){return b}),R.d($,"mapPartIntersection",function(){return A}),R.d($,"mapFragmentIntersection",function(){return k}),R.d($,"adjustSliding",function(){return T}),R.d($,"addSliding",function(){return C}),R.d($,"computeReloadInterval",function(){return E}),R.d($,"getFragmentWithSN",function(){return d}),R.d($,"getPartWith",function(){return a});var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/logger.ts");function P(l,h,_){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(_);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(_);break}}function K(l){var h={};l.forEach(function(_){var g=_.groupId||"";_.id=h[g]=h[g]||0,h[g]++})}function U(l,h,_){var g=l[h],m=l[_];N(g,m)}function N(l,h){var _=h.startPTS;if(Object(Z.isFiniteNumber)(_)){var g=0,m;h.sn>l.sn?(g=_-l.start,m=l):(g=l.start-_,m=h),m.duration!==g&&(m.duration=g)}else if(h.sn>l.sn){var L=l.cc===h.cc;L&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function D(l,h,_,g,m,L){var y=g-_;y<=0&&(B.logger.warn("Fragment should have a positive duration",h),g=_+h.duration,L=m+h.duration);var c=_,f=g,u=h.startPTS,o=h.endPTS;if(Object(Z.isFiniteNumber)(u)){var x=Math.abs(u-_);Object(Z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(x,h.deltaPTS):h.deltaPTS=x,c=Math.max(_,u),_=Math.min(_,u),m=Math.min(m,h.startDTS),f=Math.min(g,o),g=Math.max(g,o),L=Math.max(L,h.endDTS)}h.duration=g-_;var v=_-h.start;h.appendedPTS=g,h.start=h.startPTS=_,h.maxStartPTS=c,h.startDTS=m,h.endPTS=g,h.minEndPTS=f,h.endDTS=L;var S=h.sn;if(!l||S<l.startSN||S>l.endSN)return 0;var M,j=S-l.startSN,G=l.fragments;for(G[j]=h,M=j;M>0;M--)N(G[M],G[M-1]);for(M=j;M<G.length-1;M++)N(G[M],G[M+1]);return l.fragmentHint&&N(G[G.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,v}function b(l,h){for(var _=null,g=l.fragments,m=g.length-1;m>=0;m--){var L=g[m].initSegment;if(L){_=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var y=0,c;if(k(l,h,function(M,j){M.relurl&&(y=M.cc-j.cc),Object(Z.isFiniteNumber)(M.startPTS)&&Object(Z.isFiniteNumber)(M.endPTS)&&(j.start=j.startPTS=M.startPTS,j.startDTS=M.startDTS,j.appendedPTS=M.appendedPTS,j.maxStartPTS=M.maxStartPTS,j.endPTS=M.endPTS,j.endDTS=M.endDTS,j.minEndPTS=M.minEndPTS,j.duration=M.endPTS-M.startPTS,j.duration&&(c=j),h.PTSKnown=h.alignedSliding=!0),j.elementaryStreams=M.elementaryStreams,j.loader=M.loader,j.stats=M.stats,j.urlId=M.urlId,M.initSegment&&(j.initSegment=M.initSegment,_=M.initSegment)}),_){var f=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;f.forEach(function(M){var j;(!M.initSegment||M.initSegment.relurl===((j=_)===null||j===void 0?void 0:j.relurl))&&(M.initSegment=_)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(M){return!M}),h.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=h.skippedSegments;u--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var o=h.fragments;if(y){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<o.length;x++)o[x].cc+=y}h.skippedSegments&&(h.startCC=h.fragments[0].cc),A(l.partList,h.partList,function(M,j){j.elementaryStreams=M.elementaryStreams,j.stats=M.stats}),c?D(h,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):T(l,h),o.length&&(h.totalduration=h.edge-o[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var v=h.advancedDateTime;if(h.advanced&&v){var S=h.edge;h.driftStart||(h.driftStartTime=v,h.driftStart=S),h.driftEndTime=v,h.driftEnd=S}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function A(l,h,_){if(l&&h)for(var g=0,m=0,L=l.length;m<=L;m++){var y=l[m],c=h[m+g];y&&c&&y.index===c.index&&y.fragment.sn===c.fragment.sn?_(y,c):g--}}function k(l,h,_){for(var g=h.skippedSegments,m=Math.max(l.startSN,h.startSN)-h.startSN,L=(l.fragmentHint?1:0)+(g?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,y=h.startSN-l.startSN,c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=m;u<=L;u++){var o=f[y+u],x=c[u];g&&!x&&u<g&&(x=h.fragments[u]=o),o&&x&&_(o,x)}}function T(l,h){var _=h.startSN+h.skippedSegments-l.startSN,g=l.fragments;if(_<0||_>=g.length)return;C(h,g[_].start)}function C(l,h){if(h){for(var _=l.fragments,g=l.skippedSegments;g<_.length;g++)_[g].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function E(l,h){var _=1e3*l.levelTargetDuration,g=_/2,m=l.age,L=m>0&&m<_*3,y=h.loading.end-h.loading.start,c,f=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;c=Math.max(Math.min(g,y*2),u),l.availabilityDelay=(l.availabilityDelay||0)+c}else c=g;else L?(f=Math.min(f||_/2,m),l.availabilityDelay=f,c=f+_-m):c=_-y;return Math.round(c)}function d(l,h,_){if(!l||!l.details)return null;var g=l.details,m=g.fragments[h-g.startSN];return m||(m=g.fragmentHint,m&&m.sn===h?m:h<g.startSN&&_&&_.sn===h?_:null)}function a(l,h,_){if(!l||!l.details)return null;var g=l.details.partList;if(g)for(var m=g.length;m--;){var L=g[m];if(L.index===_&&L.fragment.sn===h)return L}return null}},"./src/controller/stream-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return g});var Z=R("./src/polyfills/number.ts"),B=R("./src/controller/base-stream-controller.ts"),P=R("./src/is-supported.ts"),K=R("./src/events.ts"),U=R("./src/utils/buffer-helper.ts"),N=R("./src/controller/fragment-tracker.ts"),D=R("./src/types/loader.ts"),b=R("./src/loader/fragment.ts"),A=R("./src/demux/transmuxer-interface.ts"),k=R("./src/types/transmuxer.ts"),T=R("./src/controller/gap-controller.ts"),C=R("./src/errors.ts"),E=R("./src/utils/logger.ts");function d(m,L){for(var y=0;y<L.length;y++){var c=L[y];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(m,c.key,c)}}function a(m,L,y){return L&&d(m.prototype,L),y&&d(m,y),m}function l(m,L){m.prototype=Object.create(L.prototype),m.prototype.constructor=m,h(m,L)}function h(m,L){return h=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},h(m,L)}var _=100,g=function(m){l(L,m);function L(c,f){var u;return u=m.call(this,c,f,"[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 f=this.hls;f.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(K.Events.ERROR,this.onError,this),f.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var f=this.hls;f.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(K.Events.ERROR,this.onError,this),f.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(f){if(this.levels){var u=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(_),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=o.startLevel;x===-1&&(o.config.testBandwidth?(x=0,this.bitrateTest=!0):x=o.nextAutoLevel),this.level=o.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),f=u),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var f,u=this.levels,o=this.level,x=u==null||((f=u[o])===null||f===void 0)?void 0:f.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var v,S=self.performance.now(),M=this.retryDate;(!M||S>=M||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var f,u,o=this.hls,x=this.levelLastLoaded,v=this.levels,S=this.media,M=o.config,j=o.nextLoadLevel;if(x===null||!S&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[j])return;var G=v[j];this.level=o.nextLoadLevel=j;var V=G.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=B.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,D.PlaylistLevelType.MAIN);if(O===null)return;var I=O.len,X=this.getMaxBufferLength(G.maxBitrate);if(I>=X)return;if(this._streamEnded(O,V)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,q),this.state=B.State.ENDED;return}var oe=O.end,ce=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var Le=ce.sn-V.startSN;Le>1&&(ce=V.fragments[Le-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===N.FragmentState.OK&&this.nextLoadPosition>oe){var Ee=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Ee,D.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,V)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((f=ce.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((u=ce.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ce,V):this.loadFragment(ce,V,oe)},y.loadFragment=function(f,u,o){var x,v=this.fragmentTracker.getState(f);if(this.fragCurrent=f,v===N.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(f);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else v=N.FragmentState.NOT_LOADED}v===N.FragmentState.NOT_LOADED||v===N.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,f,u,o)):v===N.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(f){var u=this.fragmentTracker.getAppendedFrag(f,D.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},y.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,D.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var f=this.levels,u=this.media;if(u!=null&&u.readyState){var o,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&f){var v=this.hls.nextLoadLevel,S=f[v],M=this.fragLastKbps;M&&this.fragCurrent?o=this.fragCurrent.duration*S.maxBitrate/(1e3*M)+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,O=G.duration,I=Math.max(j.end,V+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(f,u){m.prototype.flushMainBuffer.call(this,f,u,this.altAudio?"video":null)},y.onMediaAttached=function(f,u){m.prototype.onMediaAttached.call(this,f,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 T.default(this.config,o,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.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 f=this.media,u=f?f.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(f,u){var o=!1,x=!1,v;u.levels.forEach(function(S){v=S.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(o=!0),v.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=o&&x&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},y.onLevelLoading=function(f,u){var o=this.levels;if(!o||this.state!==B.State.IDLE)return;var x=o[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=B.State.WAITING_LEVEL)},y.onLevelLoaded=function(f,u){var o,x=this.levels,v=u.level,S=u.details,M=S.totalduration;if(!x){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+M);var j=this.fragCurrent;j&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==u.level&&j.loader&&(this.state=B.State.IDLE,j.loader.abort()));var G=x[v],V=0;if(S.live||(o=G.details)!==null&&o!==void 0&&o.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;V=this.alignPlaylists(S,G.details)}if(G.details=S,this.levelLastLoaded=v,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:S,level:v}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=B.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},y._handleFragmentLoadProgress=function(f){var u,o=f.frag,x=f.part,v=f.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var M=S[o.level],j=M.details;if(!j){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var G=M.videoCodec,V=j.PTSKnown||!j.live,O=(u=o.initSegment)===null||u===void 0?void 0:u.data,I=this._getAudioCodec(M),X=this.transmuxer=this.transmuxer||new A.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=x?x.index:-1,oe=q!==-1,ce=new k.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,v.byteLength,q,oe),Le=this.initPTS[o.cc];X.push(v,O,I,G,o,x,j.totalduration,V,ce,Le)},y.onAudioTrackSwitching=function(f,u){var o=this.altAudio,x=!!u.url,v=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;o&&M.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:v})}},y.onAudioTrackSwitched=function(f,u){var o=u.id,x=!!this.hls.audioTracks[o].url;if(x){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=x,this.tick()},y.onBufferCreated=function(f,u){var o=u.tracks,x,v,S=!1;for(var M in o){var j=o[M];if(j.id==="main"){if(v=M,x=j,M==="video"){var G=o[M];G&&(this.videoBuffer=G.buffer)}}else S=!0}S&&x?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(f,u){var o=u.frag,x=u.part;if(o&&o.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(x?" p: "+x.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var v=x?x.stats:o.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,x)},y.onError=function(f,u){switch(u.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,u);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=B.State.ERROR):!u.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var o=!0,x=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);x&&x.len>.5&&(o=!this.reduceMaxBufferLength(x.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 f=this.media,u=this.gapController;if(!f||!u||!f.readyState)return;var o=U.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(f,u){var o=u.type;if(o!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(o===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,o,D.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(f,u){this.levels=u.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var f=this.media,u=f.currentTime,o=this.startPosition;if(o>=0&&u<o){if(f.seeking){E.logger.log("could not seek to "+o+", already seeking at "+u);return}var x=U.BufferHelper.getBuffered(f),v=x.length?x.start(0):0,S=v-o;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+S+" to match buffer start"),o+=S,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+u),f.currentTime=o}},y._getAudioCodec=function(f){var u=this.config.defaultAudioCodec||f.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(f){var u=this;this._doFragLoad(f).then(function(o){var x=u.hls;if(!o||x.nextLoadLevel||u.fragContextChanged(f))return;u.fragLoadError=0,u.state=B.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var v=f.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),x.trigger(K.Events.FRAG_LOADED,o)})},y._handleTransmuxComplete=function(f){var u,o="main",x=this.hls,v=f.remuxResult,S=f.chunkMeta,M=this.getCurrentContext(S);if(!M){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var j=M.frag,G=M.part,V=M.level,O=v.video,I=v.text,X=v.id3,q=v.initSegment,oe=this.altAudio?void 0:v.audio;if(this.fragContextChanged(j))return;if(this.state=B.State.PARSING,q){q.tracks&&(this._bufferInitSegment(V,q.tracks,j,S),x.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:o,tracks:q.tracks}));var ce=q.initPTS,Le=q.timescale;Object(Z.isFiniteNumber)(ce)&&(this.initPTS[j.cc]=ce,x.trigger(K.Events.INIT_PTS_FOUND,{frag:j,id:o,initPTS:ce,timescale:Le}))}if(O&&v.independent!==!1){if(V.details){var Ee=O.startPTS,we=O.endPTS,Te=O.startDTS,ye=O.endDTS;if(G)G.elementaryStreams[O.type]={startPTS:Ee,endPTS:we,startDTS:Te,endDTS:ye};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var fe=this.getLoadPosition()+this.config.maxBufferHole;if(fe<Ee){this.backtrack(j);return}j.setElementaryStreamInfo(O.type,j.start,we,j.start,ye,!0)}j.setElementaryStreamInfo(O.type,Ee,we,Te,ye),this.bufferFragmentData(O,j,G,S)}}else if(v.independent===!1){this.backtrack(j);return}if(oe){var se=oe.startPTS,te=oe.endPTS,ue=oe.startDTS,ne=oe.endDTS;G&&(G.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:te,startDTS:ue,endDTS:ne}),j.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,se,te,ue,ne),this.bufferFragmentData(oe,j,G,S)}if(X!=null&&(u=X.samples)!==null&&u!==void 0&&u.length){var _e={frag:j,id:o,samples:X.samples};x.trigger(K.Events.FRAG_PARSING_METADATA,_e)}if(I){var Re={frag:j,id:o,samples:I.samples};x.trigger(K.Events.FRAG_PARSING_USERDATA,Re)}},y._bufferInitSegment=function(f,u,o,x){var v=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var S=u.audio,M=u.video,j=u.audiovideo;if(S){var G=f.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(G&&(G.indexOf("mp4a.40.5")!==-1?G="mp4a.40.2":G="mp4a.40.5"),S.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(G="mp4a.40.5")),V.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(G="mp4a.40.2",this.log("Android: force audio codec to "+G)),f.audioCodec&&f.audioCodec!==G&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+G+'"'),S.levelCodec=G,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(G||"")+"/"+(f.audioCodec||"")+"/"+S.codec+"]")}M&&(M.levelCodec=f.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+M.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(O){var I=u[O],X=I.initSegment;X!=null&&X.byteLength&&v.hls.trigger(K.Events.BUFFER_APPENDING,{type:O,data:X,frag:o,part:null,chunkMeta:x,parent:o.type})}),this.tick()},y.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var u=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,u?this.resetFragmentLoading(f):this.state=B.State.BACKTRACKING},y.checkFragmentChanged=function(){var f=this.media,u=null;if(f&&f.readyState>1&&f.seeking===!1){var o=f.currentTime;if(U.BufferHelper.isBuffered(f,o)?u=this.getAppendedFrag(o):U.BufferHelper.isBuffered(f,o+.1)&&(u=this.getAppendedFrag(o+.1)),u){var x=this.fragPlaying,v=u.level;(!x||u.sn!==x.sn||x.level!==v||u.urlId!==x.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==v)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=u)}}},a(L,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var u=this.getAppendedFrag(f.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var u=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"SubtitleStreamController",function(){return l});var Z=R("./src/events.ts"),B=R("./src/utils/logger.ts"),P=R("./src/utils/buffer-helper.ts"),K=R("./src/controller/fragment-finders.ts"),U=R("./src/utils/discontinuities.ts"),N=R("./src/controller/level-helper.ts"),D=R("./src/controller/fragment-tracker.ts"),b=R("./src/controller/base-stream-controller.ts"),A=R("./src/types/loader.ts"),k=R("./src/types/level.ts");function T(h,_){for(var g=0;g<_.length;g++){var m=_[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}function C(h,_,g){return _&&T(h.prototype,_),g&&T(h,g),h}function E(h,_){h.prototype=Object.create(_.prototype),h.prototype.constructor=h,d(h,_)}function d(h,_){return d=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},d(h,_)}var a=500,l=function(h){E(_,h);function _(m,L){var y;return y=h.call(this,m,L,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var g=_.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._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)},g._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)},g.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(a),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(L,y){this.mainDetails=y.details},g.onSubtitleFragProcessed=function(L,y){var c=y.frag,f=y.success;if(this.fragPrevious=c,this.state=b.State.IDLE,!f)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var o,x=c.start,v=0;v<u.length;v++)if(x>=u[v].start&&x<=u[v].end){o=u[v];break}var S=c.start+c.duration;o?o.end=S:(o={start:x,end:S},u.push(o)),this.fragmentTracker.fragBuffered(c)},g.onBufferFlushing=function(L,y){var c=y.startOffset,f=y.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,o=this.levels;if(!o.length||!o[u]||!o[u].details)return;var x=o[u].details,v=x.targetduration,S=f-v;if(S<=0)return;y.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(M){for(var j=0;j<M.length;){if(M[j].end<=S){M.shift();continue}else if(M[j].start<S)M[j].start=S;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(c,S,A.PlaylistLevelType.SUBTITLE)}},g.onError=function(L,y){var c,f=y.frag;if(!f||f.type!==A.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},g.onSubtitleTracksUpdated=function(L,y){var c=this,f=y.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(u){return new k.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){c.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(L,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(a)},g.onSubtitleTrackLoaded=function(L,y){var c,f=y.details,u=y.id,o=this.currentTrackId,x=this.levels;if(!x.length)return;var v=x[o];if(u>=x.length||u!==o||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=v.details)!==null&&c!==void 0&&c.live){var S=this.mainDetails;if(f.deltaUpdateFailed||!S)return;var M=S.fragments[0];if(!v.details)f.hasProgramDateTime&&S.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(f,S):M&&Object(N.addSliding)(f,M.start);else{var j=this.alignPlaylists(f,v.details);j===0&&M&&Object(N.addSliding)(f,M.start)}}if(v.details=f,this.levelLastLoaded=u,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var G=Object(K.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);G||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(L){var y=L.frag,c=L.payload,f=y.decryptdata,u=this.hls;if(this.fragContextChanged(y))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(x){var v=performance.now();u.trigger(Z.Events.FRAG_DECRYPTED,{frag:y,payload:x,stats:{tstart:o,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var L,y=this.currentTrackId,c=this.levels;if(!c.length||!c[y]||!c[y].details)return;var f=c[y].details,u=f.targetduration,o=this.config,x=this.media,v=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,o.maxBufferHole),S=v.end,M=v.len,j=this.getMaxBufferLength()+u;if(M>j)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var G=f.fragments,V=G.length,O=f.edge,I,X=this.fragPrevious;if(S<O){var q=o.maxFragLookUpTolerance;X&&f.hasProgramDateTime&&(I=Object(K.findFragmentByPDT)(G,X.endProgramDateTime,q)),I||(I=Object(K.findFragmentByPTS)(X,G,S,q),!I&&X&&X.start<G[0].start&&(I=G[0]))}else I=G[V-1];(L=I)!==null&&L!==void 0&&L.encrypted?(B.logger.log("Loading key for "+I.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===D.FragmentState.NOT_LOADED&&this.loadFragment(I,f,S)}},g.loadFragment=function(L,y,c){this.fragCurrent=L,h.prototype.loadFragment.call(this,L,y,c)},C(_,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),_}(b.default)},"./src/controller/subtitle-track-controller.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/events.ts"),B=R("./src/utils/texttrack-utils.ts"),P=R("./src/controller/base-playlist-controller.ts"),K=R("./src/types/loader.ts");function U(T,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(T,d.key,d)}}function N(T,C,E){return C&&U(T.prototype,C),E&&U(T,E),T}function D(T,C){T.prototype=Object.create(C.prototype),T.prototype.constructor=T,b(T,C)}function b(T,C){return b=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},b(T,C)}var A=function(T){D(C,T);function C(d){var a;return a=T.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var E=C.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},E.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)},E.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)},E.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)},E.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},E.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=k(this.media.textTracks);a.forEach(function(l){Object(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},E.onSubtitleTrackLoaded=function(a,l){var h=l.id,_=l.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+h);return}var L=m.details;m.details=l.details,this.log("subtitle track "+h+" loaded ["+_.startSN+"-"+_.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,L))},E.onLevelLoading=function(a,l){this.switchLevel(l.level)},E.onLevelSwitching=function(a,l){this.switchLevel(l.level)},E.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var _=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(y){return!h||y.groupId===h});this.tracksInGroup=g;var m=this.findTrackId(_==null?void 0:_.name)||this.findTrackId();this.groupId=h;var L={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,L),m!==-1&&this.setSubtitleTrack(m,_)}},E.findTrackId=function(a){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var _=l[h];if((!this.selectDefaultTrack||_.default)&&(!a||a===_.name))return _.id}return-1},E.onError=function(a,l){if(T.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)},E.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,_=l.groupId,g=l.url;if(a)try{g=a.addDirectives(g)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:g,id:h,groupId:_,deliveryDirectives:a||null})}},E.toggleTrackModes=function(a){var l=this,h=this.media,_=this.subtitleDisplay,g=this.trackId;if(!h)return;var m=k(h.textTracks),L=m.filter(function(f){return f.groupId===l.groupId});if(a===-1)[].slice.call(m).forEach(function(f){f.mode="disabled"});else{var y=L[g];y&&(y.mode="disabled")}var c=L[a];c&&(c.mode=_?"showing":"hidden")},E.setSubtitleTrack=function(a,l){var h,_=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=_[a])!==null&&h!==void 0&&h.details)||a<-1||a>=_.length)return;this.clearTimer();var g=_[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,g){var m=g.id,L=g.groupId,y=L===void 0?"":L,c=g.name,f=g.type,u=g.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:c,type:f,url:u});var o=this.switchParams(g.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=k(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")a=h;else if(l[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},N(C,[{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)}}]),C}(P.default);function k(T){for(var C=[],E=0;E<T.length;E++){var d=T[E];d.kind==="subtitles"&&d.label&&C.push(T[E])}return C}$.default=A},"./src/controller/timeline-controller.ts":function(le,$,R){"use strict";R.r($),R.d($,"TimelineController",function(){return k});var Z=R("./src/polyfills/number.ts"),B=R("./src/events.ts"),P=R("./src/utils/cea-608-parser.ts"),K=R("./src/utils/output-filter.ts"),U=R("./src/utils/webvtt-parser.ts"),N=R("./src/utils/texttrack-utils.ts"),D=R("./src/utils/imsc1-ttml-parser.ts"),b=R("./src/types/loader.ts"),A=R("./src/utils/logger.ts"),k=function(){function d(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=E(),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 h=new K.default(this,"textTrack1"),_=new K.default(this,"textTrack2"),g=new K.default(this,"textTrack3"),m=new K.default(this,"textTrack4");this.cea608Parser1=new P.default(1,h,_),this.cea608Parser2=new P.default(3,g,m)}l.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(B.Events.FRAG_LOADING,this.onFragLoading,this),l.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=d.prototype;return a.destroy=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(B.Events.FRAG_LOADING,this.onFragLoading,this),h.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,_,g,m,L){for(var y=!1,c=L.length;c--;){var f=L[c],u=C(f[0],f[1],_,g);if(u>=0&&(f[0]=Math.min(f[0],_),f[1]=Math.max(f[1],g),y=!0,u/(g-_)>.5))return}if(y||L.push([_,g]),this.config.renderTextTracksNatively){var o=this.captionsTracks[h];this.Cues.newCue(o,_,g,m)}else{var x=this.Cues.newCue(null,_,g,m);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:x,track:h})}},a.onInitPtsFound=function(h,_){var g=this,m=_.frag,L=_.id,y=_.initPTS,c=_.timescale,f=this.unparsedVttFrags;L==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(u){g.onFragLoaded(B.Events.FRAG_LOADED,u)}))},a.getExistingTrack=function(h){var _=this.media;if(_)for(var g=0;g<_.textTracks.length;g++){var m=_.textTracks[g];if(m[h])return m}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var _=this.captionsProperties,g=this.captionsTracks,m=this.media,L=_[h],y=L.label,c=L.languageCode,f=this.getExistingTrack(h);if(f)g[h]=f,Object(N.clearCurrentCues)(g[h]),Object(N.sendAddTrackEvent)(g[h],m);else{var u=this.createTextTrack("captions",y,c);u&&(u[h]=!0,g[h]=u)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var _=this.captionsProperties[h];if(!_)return;var g=_.label,m={_id:h,label:g,kind:"captions",default:_.media?!!_.media.default:!1,closedCaptions:_.media};this.nonNativeCaptionsTracks[h]=m,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},a.createTextTrack=function(h,_,g){var m=this.media;return m?m.addTextTrack(h,_,g):void 0},a.onMediaAttaching=function(h,_){this.media=_.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(_){Object(N.clearCurrentCues)(h[_]),delete h[_]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),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 h=this.media;if(!h)return;var _=h.textTracks;if(_)for(var g=0;g<_.length;g++)Object(N.clearCurrentCues)(_[g])},a.onSubtitleTracksUpdated=function(h,_){var g=this;this.textTracks=[];var m=_.subtitleTracks||[],L=m.some(function(u){return u.textCodec===D.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 c=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,o){var x;if(o<c.length){for(var v=null,S=0;S<c.length;S++)if(T(c[S],u)){v=c[S];break}v&&(x=v)}x?Object(N.clearCurrentCues)(x):(x=g.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,g.textTracks.push(x))})}else if(!y&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},a.onManifestLoaded=function(h,_){var g=this;this.config.enableCEA708Captions&&_.captions&&_.captions.forEach(function(m){var L=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!L)return;var y="textTrack"+L[1],c=g.captionsProperties[y];if(!c)return;c.label=m.name,m.lang&&(c.languageCode=m.lang),c.media=m})},a.onFragLoading=function(h,_){var g=this.cea608Parser1,m=this.cea608Parser2,L=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(g&&m))return;if(_.frag.type===b.PlaylistLevelType.MAIN){var c,f,u=_.frag.sn,o=(c=_==null||((f=_.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;u===L+1||u===L&&o===y+1||(g.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=o}},a.onFragLoaded=function(h,_){var g=_.frag,m=_.payload,L=this.initPTS,y=this.unparsedVttFrags;if(g.type===b.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(Z.isFiniteNumber)(L[g.cc])){y.push(_),L.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var c=g.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[g.level],u=this.vttCCs;u[g.cc]||(u[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),f&&f.textCodec===D.IMSC1_CODEC?this._parseIMSC1(g,m):this._parseVTTs(g,m,u)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,_){var g=this,m=this.hls;Object(D.parseIMSC1)(_,this.initPTS[h.cc],this.timescale[h.cc],function(L){g._appendCues(L,h.level),m.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(L){A.logger.log("Failed to parse IMSC1: "+L),m.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:L})})},a._parseVTTs=function(h,_,g){var m=this,L=this.hls;Object(U.parseWebVTT)(_,this.initPTS[h.cc],this.timescale[h.cc],g,h.cc,h.start,function(y){m._appendCues(y,h.level),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(y){m._fallbackToIMSC1(h,_),A.logger.log("Failed to parse VTT cue: "+y),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:y})})},a._fallbackToIMSC1=function(h,_){var g=this,m=this.tracks[h.level];m.textCodec||Object(D.parseIMSC1)(_,this.initPTS[h.cc],this.timescale[h.cc],function(){m.textCodec=D.IMSC1_CODEC,g._parseIMSC1(h,_)},function(){m.textCodec="wvtt"})},a._appendCues=function(h,_){var g=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[_];if(m.mode==="disabled")return;h.forEach(function(c){return Object(N.addCueToTrack)(m,c)})}else{var L=this.tracks[_],y=L.default?"default":"subtitles"+_;g.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:h,track:y})}},a.onFragDecrypted=function(h,_){var g=_.frag;if(g.type===b.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(_);return}this.onFragLoaded(B.Events.FRAG_LOADED,_)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,_){var g=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(g&&m))return;for(var L=0;L<_.samples.length;L++){var y=_.samples[L].bytes;if(y){var c=this.extractCea608Data(y);g.addData(_.samples[L].pts,c[0]),m.addData(_.samples[L].pts,c[1])}}},a.onBufferFlushing=function(h,_){var g=_.startOffset,m=_.endOffset,L=_.endOffsetSubtitles,y=_.type,c=this.media;if(!c||c.currentTime<m)return;if(!y||y==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(o){return Object(N.removeCuesInRange)(f[o],g,m)})}if(this.config.renderTextTracksNatively&&(g===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(o){return Object(N.removeCuesInRange)(u[o],g,L)})}},a.extractCea608Data=function(h){for(var _=h[0]&31,g=2,m=[[],[]],L=0;L<_;L++){var y=h[g++],c=127&h[g++],f=127&h[g++],u=(4&y)!==0,o=3&y;if(c===0&&f===0)continue;u&&((o===0||o===1)&&(m[o].push(c),m[o].push(f)))}return m},d}();function T(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function C(d,a,l,h){return Math.min(a,h)-Math.max(d,l)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return Z});var Z=function(){function B(K,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=U}var P=B.prototype;return P.decrypt=function(U,N){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},N,U)},B}()},"./src/crypt/aes-decryptor.ts":function(le,$,R){"use strict";R.r($),R.d($,"removePadding",function(){return B}),R.d($,"default",function(){return P});var Z=R("./src/utils/typed-array.ts");function B(K){var U=K.byteLength,N=U&&new DataView(K.buffer).getUint8(U-1);return N?Object(Z.sliceUint8)(K,0,U-N):K}var P=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 U=K.prototype;return U.uint8ArrayToUint32Array_=function(D){for(var b=new DataView(D),A=new Uint32Array(4),k=0;k<4;k++)A[k]=b.getUint32(k*4);return A},U.initTable=function(){var D=this.sBox,b=this.invSBox,A=this.subMix,k=A[0],T=A[1],C=A[2],E=A[3],d=this.invSubMix,a=d[0],l=d[1],h=d[2],_=d[3],g=new Uint32Array(256),m=0,L=0,y=0;for(y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(y=0;y<256;y++){var c=L^L<<1^L<<2^L<<3^L<<4;c=c>>>8^c&255^99,D[m]=c,b[c]=m;var f=g[m],u=g[f],o=g[u],x=g[c]*257^c*16843008;k[m]=x<<24|x>>>8,T[m]=x<<16|x>>>16,C[m]=x<<8|x>>>24,E[m]=x,x=o*16843009^u*65537^f*257^m*16843008,a[c]=x<<24|x>>>8,l[c]=x<<16|x>>>16,h[c]=x<<8|x>>>24,_[c]=x,m?(m=f^g[g[g[o^f]]],L^=g[g[L]]):m=L=1}},U.expandKey=function(D){for(var b=this.uint8ArrayToUint32Array_(D),A=!0,k=0;k<b.length&&A;)A=b[k]===this.key[k],k++;if(A)return;this.key=b;var T=this.keySize=b.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var C=this.ksRows=(T+6+1)*4,E,d,a=this.keySchedule=new Uint32Array(C),l=this.invKeySchedule=new Uint32Array(C),h=this.sBox,_=this.rcon,g=this.invSubMix,m=g[0],L=g[1],y=g[2],c=g[3],f,u;for(E=0;E<C;E++){if(E<T){f=a[E]=b[E];continue}u=f,E%T===0?(u=u<<8|u>>>24,u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255],u^=_[E/T|0]<<24):T>6&&E%T===4&&(u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255]),a[E]=f=(a[E-T]^u)>>>0}for(d=0;d<C;d++)E=C-d,d&3?u=a[E]:u=a[E-4],d<4||E<=4?l[d]=u:l[d]=m[h[u>>>24]]^L[h[u>>>16&255]]^y[h[u>>>8&255]]^c[h[u&255]],l[d]=l[d]>>>0},U.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},U.decrypt=function(D,b,A){for(var k=this.keySize+6,T=this.invKeySchedule,C=this.invSBox,E=this.invSubMix,d=E[0],a=E[1],l=E[2],h=E[3],_=this.uint8ArrayToUint32Array_(A),g=_[0],m=_[1],L=_[2],y=_[3],c=new Int32Array(D),f=new Int32Array(c.length),u,o,x,v,S,M,j,G,V,O,I,X,q,oe,ce=this.networkToHostOrderSwap;b<c.length;){for(V=ce(c[b]),O=ce(c[b+1]),I=ce(c[b+2]),X=ce(c[b+3]),S=V^T[0],M=X^T[1],j=I^T[2],G=O^T[3],q=4,oe=1;oe<k;oe++)u=d[S>>>24]^a[M>>16&255]^l[j>>8&255]^h[G&255]^T[q],o=d[M>>>24]^a[j>>16&255]^l[G>>8&255]^h[S&255]^T[q+1],x=d[j>>>24]^a[G>>16&255]^l[S>>8&255]^h[M&255]^T[q+2],v=d[G>>>24]^a[S>>16&255]^l[M>>8&255]^h[j&255]^T[q+3],S=u,M=o,j=x,G=v,q=q+4;u=C[S>>>24]<<24^C[M>>16&255]<<16^C[j>>8&255]<<8^C[G&255]^T[q],o=C[M>>>24]<<24^C[j>>16&255]<<16^C[G>>8&255]<<8^C[S&255]^T[q+1],x=C[j>>>24]<<24^C[G>>16&255]<<16^C[S>>8&255]<<8^C[M&255]^T[q+2],v=C[G>>>24]<<24^C[S>>16&255]<<16^C[M>>8&255]<<8^C[j&255]^T[q+3],f[b]=ce(u^g),f[b+1]=ce(v^m),f[b+2]=ce(x^L),f[b+3]=ce(o^y),g=V,m=O,L=I,y=X,b=b+4}return f.buffer},K}()},"./src/crypt/decrypter.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return b});var Z=R("./src/crypt/aes-crypto.ts"),B=R("./src/crypt/fast-aes-key.ts"),P=R("./src/crypt/aes-decryptor.ts"),K=R("./src/utils/logger.ts"),U=R("./src/utils/mp4-tools.ts"),N=R("./src/utils/typed-array.ts"),D=16,b=function(){function A(T,C,E){var d=E===void 0?{}:E,a=d.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=T,this.config=C,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(_){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var k=A.prototype;return k.destroy=function(){this.observer=null},k.isSync=function(){return this.config.enableSoftwareAES},k.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var E=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(E):E},k.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},k.decrypt=function(C,E,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),E,d);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),E,d).then(a)},k.softwareDecrypt=function(C,E,d){var a=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(C=Object(U.appendUint8Array)(h,C),this.remainderData=null);var _=this.getValidChunk(C);if(!_.length)return null;a&&(d=a);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(E);var m=l;return this.currentResult=g.decrypt(_.buffer,0,d),this.currentIV=Object(N.sliceUint8)(_,-16).buffer,m||null},k.webCryptoDecrypt=function(C,E,d){var a=this,l=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new B.default(l,E)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var _=new Z.default(l,d);return _.decrypt(C.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,C,E,d)})},k.onWebCryptoError=function(C,E,d,a){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,d,a)},k.getValidChunk=function(C){var E=C,d=C.length-C.length%D;return d!==C.length&&(E=Object(N.sliceUint8)(C,0,d),this.remainderData=Object(N.sliceUint8)(C,d)),E},k.logOnce=function(C){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return Z});var Z=function(){function B(K,U){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=U}var P=B.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/demux/base-audio-demuxer.ts"),B=R("./src/demux/adts.ts"),P=R("./src/utils/logger.ts"),K=R("./src/demux/id3.ts");function U(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,N(b,A)}function N(b,A){return N=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},N(b,A)}var D=function(b){U(A,b);function A(T,C){var E;return E=b.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=T,E.config=C,E}var k=A.prototype;return k.resetInitSegment=function(C,E,d){b.prototype.resetInitSegment.call(this,C,E,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var E=K.getID3Data(C,0)||[],d=E.length,a=C.length;d<a;d++)if(B.probe(C,d))return P.logger.log("ADTS sync word found !"),!0;return!1},k.canParse=function(C,E){return B.canParse(C,E)},k.appendFrame=function(C,E,d){B.initTrackConfig(C,this.observer,E,d,C.manifestCodec);var a=B.appendFrame(C,E,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},A}(Z.default);D.minProbeByteLength=9,$.default=D},"./src/demux/adts.ts":function(le,$,R){"use strict";R.r($),R.d($,"getAudioConfig",function(){return K}),R.d($,"isHeaderPattern",function(){return U}),R.d($,"getHeaderLength",function(){return N}),R.d($,"getFullFrameLength",function(){return D}),R.d($,"canGetFrameLength",function(){return b}),R.d($,"isHeader",function(){return A}),R.d($,"canParse",function(){return k}),R.d($,"probe",function(){return T}),R.d($,"initTrackConfig",function(){return C}),R.d($,"getFrameDuration",function(){return E}),R.d($,"parseFrameHeader",function(){return d}),R.d($,"appendFrame",function(){return a});var Z=R("./src/utils/logger.ts"),B=R("./src/errors.ts"),P=R("./src/events.ts");function K(l,h,_,g){var m,L,y,c,f=navigator.userAgent.toLowerCase(),u=g,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((h[_+2]&192)>>>6)+1;var x=(h[_+2]&60)>>>2;if(x>o.length-1){l.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return y=(h[_+2]&1)<<2,y|=(h[_+3]&192)>>>6,Z.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+x),/firefox/i.test(f)?x>=6?(m=5,c=new Array(4),L=x-3):(m=2,c=new Array(2),L=x):f.indexOf("android")!==-1?(m=2,c=new Array(2),L=x):(m=5,c=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&x>=6?L=x-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(x>=6&&y===1||/vivaldi/i.test(f))||!g&&y===1)&&(m=2,c=new Array(2)),L=x)),c[0]=m<<3,c[0]|=(x&14)>>1,c[1]|=(x&1)<<7,c[1]|=y<<3,m===5&&(c[1]|=(L&14)>>1,c[2]=(L&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:o[x],channelCount:y,codec:"mp4a.40."+m,manifestCodec:u}}function U(l,h){return l[h]===255&&(l[h+1]&246)===240}function N(l,h){return l[h+1]&1?7:9}function D(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function b(l,h){return h+5<l.length}function A(l,h){return h+1<l.length&&U(l,h)}function k(l,h){return b(l,h)&&U(l,h)&&D(l,h)<=l.length-h}function T(l,h){if(A(l,h)){var _=N(l,h);if(h+_>=l.length)return!1;var g=D(l,h);if(g<=_)return!1;var m=h+g;return m===l.length||A(l,m)}return!1}function C(l,h,_,g,m){if(!l.samplerate){var L=K(h,_,g,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 E(l){return 1024*9e4/l}function d(l,h,_,g,m){var L=N(l,h),y=D(l,h);if(y-=L,y>0){var c=_+g*m;return{headerLength:L,frameLength:y,stamp:c}}}function a(l,h,_,g,m){var L=E(l.samplerate),y=d(h,_,g,m,L);if(y){var c=y.frameLength,f=y.headerLength,u=y.stamp,o=f+c,x=Math.max(0,_+o-h.length),v;x?(v=new Uint8Array(o-f),v.set(h.subarray(_+f,h.length),0)):v=h.subarray(_+f,_+o);var S={unit:v,pts:u};return x||l.samples.push(S),{sample:S,length:o,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(le,$,R){"use strict";R.r($),R.d($,"initPTSFn",function(){return D});var Z=R("./src/polyfills/number.ts"),B=R("./src/demux/id3.ts"),P=R("./src/demux/dummy-demuxed-track.ts"),K=R("./src/utils/mp4-tools.ts"),U=R("./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 A=b.prototype;return A.resetInitSegment=function(T,C,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(T,C){return!1},A.appendFrame=function(T,C,E){},A.demux=function(T,C){this.cachedData&&(T=Object(K.appendUint8Array)(this.cachedData,T),this.cachedData=null);var E=B.getID3Data(T,0),d=E?E.length:0,a,l,h=this._audioTrack,_=this._id3Track,g=E?B.getTimeStamp(E):void 0,m=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(g,C)),E&&E.length>0&&_.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),l=this.initPTS;d<m;){if(this.canParse(T,d)){var L=this.appendFrame(h,T,d);L?(this.frameIndex++,l=L.sample.pts,d+=L.length,a=d):d=m}else B.canParse(T,d)?(E=B.getID3Data(T,d),_.samples.push({pts:l,dts:l,data:E}),d+=E.length,a=d):d++;if(d===m&&a!==m){var y=Object(U.sliceUint8)(T,a);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:h,avcTrack:Object(P.dummyTrack)(),id3Track:_,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(T,C,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(T){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},b}(),D=function(A,k){return Object(Z.isFiniteNumber)(A)?A*90:k*9e4};$.default=N},"./src/demux/chunk-cache.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return Z});var Z=function(){function P(){this.chunks=[],this.dataLength=0}var K=P.prototype;return K.push=function(N){this.chunks.push(N),this.dataLength+=N.length},K.flush=function(){var N=this.chunks,D=this.dataLength,b;if(N.length)N.length===1?b=N[0]:b=B(N,D);else return new Uint8Array(0);return this.reset(),b},K.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function B(P,K){for(var U=new Uint8Array(K),N=0,D=0;D<P.length;D++){var b=P[D];U.set(b,N),N+=b.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(le,$,R){"use strict";R.r($),R.d($,"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(le,$,R){"use strict";R.r($);var Z=R("./src/utils/logger.ts"),B=function(){function P(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var K=P.prototype;return K.loadWord=function(){var N=this.data,D=this.bytesAvailable,b=N.byteLength-D,A=new Uint8Array(4),k=Math.min(4,D);if(k===0)throw new Error("no bytes available");A.set(N.subarray(b,b+k)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=k*8,this.bytesAvailable-=k},K.skipBits=function(N){var D;this.bitsAvailable>N?(this.word<<=N,this.bitsAvailable-=N):(N-=this.bitsAvailable,D=N>>3,N-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=N,this.bitsAvailable-=N)},K.readBits=function(N){var D=Math.min(this.bitsAvailable,N),b=this.word>>>32-D;return N>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=N-D,D>0&&this.bitsAvailable?b<<D|this.readBits(D):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 D=8,b=8,A,k=0;k<N;k++)b!==0&&(A=this.readEG(),b=(D+A+256)%256),D=b===0?D:b},K.readSPS=function(){var N=0,D=0,b=0,A=0,k,T,C,E=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),_=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);E();var L=E();if(d(5),h(3),E(),g(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var y=a();if(y===3&&h(1),g(),g(),h(1),l())for(T=y!==3?8:12,C=0;C<T;C++)l()&&(C<6?m(16):m(64))}g();var c=a();if(c===0)a();else if(c===1)for(h(1),_(),_(),k=a(),C=0;C<k;C++)_();g(),h(1);var f=a(),u=a(),o=d(1);o===0&&h(1),h(1),l()&&(N=a(),D=a(),b=a(),A=a());var x=[1,1];if(l()&&l()){var v=E();switch(v){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((f+1)*16-N*2-D*2),height:(2-o)*(u+1)*16-(o?2:4)*(b+A),pixelRatio:x}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();$.default=B},"./src/demux/id3.ts":function(le,$,R){"use strict";R.r($),R.d($,"isHeader",function(){return Z}),R.d($,"isFooter",function(){return B}),R.d($,"getID3Data",function(){return P}),R.d($,"canParse",function(){return U}),R.d($,"getTimeStamp",function(){return N}),R.d($,"isTimeStampFrame",function(){return D}),R.d($,"getID3Frames",function(){return A}),R.d($,"decodeFrame",function(){return k}),R.d($,"utf8ArrayToStr",function(){return a}),R.d($,"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)))},B=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)))},P=function(m,L){for(var y=L,c=0;Z(m,L);){c+=10;var f=K(m,L+6);c+=f,B(m,L+10)&&(c+=10),L+=c}return c>0?m.subarray(y,y+c):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},U=function(m,L){return Z(m,L)&&K(m,L+6)+10<=m.length-L},N=function(m){for(var L=A(m),y=0;y<L.length;y++){var c=L[y];if(D(c))return d(c)}return},D=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),c=10;return{type:L,size:y,data:m.subarray(c,c+y)}},A=function(m){for(var L=0,y=[];Z(m,L);){var c=K(m,L+6);L+=10;for(var f=L+c;L+8<f;){var u=b(m.subarray(L)),o=k(u);o&&y.push(o),L+=u.size+10}B(m,L)&&(L+=10)}return y},k=function(m){return m.type==="PRIV"?T(m):m.type[0]==="W"?E(m):C(m)},T=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}},C=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 c=a(m.data.subarray(L));return{key:m.type,info:y,data:c}}var f=a(m.data.subarray(1));return{key:m.type,data:f}},E=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 c=a(m.data.subarray(L));return{key:m.type,info:y,data:c}}var f=a(m.data);return{key:m.type,data:f}},d=function(m){if(m.data.byteLength===8){var L=new Uint8Array(m.data),y=L[3]&1,c=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return c/=45,y&&(c+=4772185884e-2),Math.round(c)}return},a=function(m,L){L===void 0&&(L=!1);var y=_();if(y){var c=y.decode(m);if(L){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var u=m.length,o,x,v,S="",M=0;M<u;){if(o=m[M++],o===0&&L)return S;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:S+=String.fromCharCode(o);break;case 12:case 13:x=m[M++],S+=String.fromCharCode((o&31)<<6|x&63);break;case 14:x=m[M++],v=m[M++],S+=String.fromCharCode((o&15)<<12|(x&63)<<6|(v&63)<<0);break;default:}}return S},l={decodeTextFrame:C},h;function _(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/demux/base-audio-demuxer.ts"),B=R("./src/demux/id3.ts"),P=R("./src/utils/logger.ts"),K=R("./src/demux/mpegaudio.ts");function U(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,N(b,A)}function N(b,A){return N=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},N(b,A)}var D=function(b){U(A,b);function A(){return b.apply(this,arguments)||this}var k=A.prototype;return k.resetInitSegment=function(C,E,d){b.prototype.resetInitSegment.call(this,C,E,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var E=B.getID3Data(C,0)||[],d=E.length,a=C.length;d<a;d++)if(K.probe(C,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},k.canParse=function(C,E){return K.canParse(C,E)},k.appendFrame=function(C,E,d){return this.initPTS===null?void 0:K.appendFrame(C,E,d,this.initPTS,this.frameIndex)},A}(Z.default);D.minProbeByteLength=4,$.default=D},"./src/demux/mp4demuxer.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/utils/mp4-tools.ts"),B=R("./src/demux/dummy-demuxed-track.ts"),P=function(){function K(N,D){this.remainderData=null,this.config=void 0,this.config=D}var U=K.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},K.probe=function(D){return Object(Z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},U.demux=function(D){var b=D,A=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(Z.appendUint8Array)(this.remainderData,D));var k=Object(Z.segmentValidRange)(b);this.remainderData=k.remainder,A.samples=k.valid||new Uint8Array}else A.samples=b;return{audioTrack:Object(B.dummyTrack)(),avcTrack:A,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},U.flush=function(){var D=Object(B.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:D,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},U.demuxSampleAes=function(D,b,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},K}();P.minProbeByteLength=1024,$.default=P},"./src/demux/mpegaudio.ts":function(le,$,R){"use strict";R.r($),R.d($,"appendFrame",function(){return N}),R.d($,"parseHeader",function(){return D}),R.d($,"isHeaderPattern",function(){return b}),R.d($,"isHeader",function(){return A}),R.d($,"canParse",function(){return k}),R.d($,"probe",function(){return T});var Z=null,B=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function N(C,E,d,a,l){if(d+24>E.length)return;var h=D(E,d);if(h&&d+h.frameLength<=E.length){var _=h.samplesPerFrame*9e4/h.sampleRate,g=a+l*_,m={unit:E.subarray(d,d+h.frameLength),pts:g,dts:g};return C.config=[],C.channelCount=h.channelCount,C.samplerate=h.sampleRate,C.samples.push(m),{sample:m,length:h.frameLength,missing:0}}}function D(C,E){var d=C[E+1]>>3&3,a=C[E+1]>>1&3,l=C[E+2]>>4&15,h=C[E+2]>>2&3;if(d!==1&&l!==0&&l!==15&&h!==3){var _=C[E+2]>>1&1,g=C[E+3]>>6,m=d===3?3-a:a===3?3:4,L=B[m*14+l-1]*1e3,y=d===3?0:d===2?1:2,c=P[y*3+h],f=g===3?1:2,u=K[d][a],o=U[a],x=u*8*o,v=Math.floor(u*L/c+_)*o;if(Z===null){var S=navigator.userAgent||"",M=S.match(/Chrome\/(\d+)/i);Z=M?parseInt(M[1]):0}var j=!!Z&&Z<=87;return j&&a===2&&L>=224e3&&g===0&&(C[E+3]=C[E+3]|128),{sampleRate:c,channelCount:f,frameLength:v,samplesPerFrame:x}}}function b(C,E){return C[E]===255&&(C[E+1]&224)===224&&(C[E+1]&6)!==0}function A(C,E){return E+1<C.length&&b(C,E)}function k(C,E){var d=4;return b(C,E)&&d<=C.length-E}function T(C,E){if(E+1<C.length&&b(C,E)){var d=4,a=D(C,E),l=d;a!=null&&a.frameLength&&(l=a.frameLength);var h=E+l;return h===C.length||A(C,h)}return!1}},"./src/demux/sample-aes.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/crypt/decrypter.ts"),B=R("./src/demux/tsdemuxer.ts"),P=function(){function K(N,D,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new Z.default(N,D,{removePKCS7Padding:!1})}var U=K.prototype;return U.decryptBuffer=function(D,b){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,b)},U.decryptAacSample=function(D,b,A,k){var T=D[b].unit,C=T.subarray(16,T.length-T.length%16),E=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),d=this;this.decryptBuffer(E,function(a){var l=new Uint8Array(a);T.set(l,16),k||d.decryptAacSamples(D,b+1,A)})},U.decryptAacSamples=function(D,b,A){for(;;b++){if(b>=D.length){A();return}if(D[b].unit.length<32)continue;var k=this.decrypter.isSync();if(this.decryptAacSample(D,b,A,k),!k)return}},U.getAvcEncryptedData=function(D){for(var b=Math.floor((D.length-48)/160)*16+16,A=new Int8Array(b),k=0,T=32;T<=D.length-16;T+=160,k+=16)A.set(D.subarray(T,T+16),k);return A},U.getAvcDecryptedUnit=function(D,b){for(var A=new Uint8Array(b),k=0,T=32;T<=D.length-16;T+=160,k+=16)D.set(A.subarray(k,k+16),T);return D},U.decryptAvcSample=function(D,b,A,k,T,C){var E=Object(B.discardEPB)(T.data),d=this.getAvcEncryptedData(E),a=this;this.decryptBuffer(d.buffer,function(l){T.data=a.getAvcDecryptedUnit(E,l),C||a.decryptAvcSamples(D,b,A+1,k)})},U.decryptAvcSamples=function(D,b,A,k){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,A=0){if(b>=D.length){k();return}for(var T=D[b].units;!(A>=T.length);A++){var C=T[A];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(D,b,A,k,C,E),!E)return}}},K}();$.default=P},"./src/demux/transmuxer-interface.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var Z=R("./node_modules/webworkify-webpack/index.js"),B=R.n(Z),P=R("./src/events.ts"),K=R("./src/demux/transmuxer.ts"),U=R("./src/utils/logger.ts"),N=R("./src/errors.ts"),D=R("./src/utils/mediasource-helper.ts"),b=R("./node_modules/eventemitter3/index.js"),A=R.n(b),k=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function C(d,a,l,h){var _=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=a,this.onTransmuxComplete=l,this.onFlush=h;var g=d.config,m=function(u,o){o=o||{},o.frag=_.frag,o.id=_.id,d.trigger(u,o)};this.observer=new b.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var L={mp4:k.isTypeSupported("video/mp4"),mpeg:k.isTypeSupported("audio/mpeg"),mp3:k.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var c;try{c=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){d.trigger(P.Events.ERROR,{type:N.ErrorTypes.OTHER_ERROR,details:N.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:L,vendor:y,id:a,config:JSON.stringify(g)})}catch(f){U.logger.warn("Error in worker:",f),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new K.default(this.observer,L,g,y,a),this.worker=null}}else this.transmuxer=new K.default(this.observer,L,g,y,a)}var E=C.prototype;return E.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 h=this.observer;h&&h.removeAllListeners(),this.observer=null},E.push=function(a,l,h,_,g,m,L,y,c,f){var u=this;c.transmuxing.start=self.performance.now();var o=this.transmuxer,x=this.worker,v=m?m.start:g.start,S=g.decryptdata,M=this.frag,j=!(M&&g.cc===M.cc),G=!(M&&c.level===M.level),V=M?c.sn-M.sn:-1,O=this.part?c.part-this.part.index:1,I=!G&&(V===1||V===0&&O===1),X=self.performance.now();(G||V||g.stats.parsing.start===0)&&(g.stats.parsing.start=X),m&&(O||!I)&&(m.stats.parsing.start=X);var q=new K.TransmuxState(j,I,y,G,v);if(!I||j){U.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
discontinuity: `+j+`
trackSwitch: `+G+`
contiguous: `+I+`
accurateTimeOffset: `+y+`
timeOffset: `+v);var oe=new K.TransmuxConfig(h,_,l,L,f);this.configureTransmuxer(oe)}if(this.frag=g,this.part=m,x)x.postMessage({cmd:"demux",data:a,decryptdata:S,chunkMeta:c,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var ce=o.push(a,S,c,q);Object(K.isPromise)(ce)?ce.then(function(Le){u.handleTransmuxComplete(Le)}):this.handleTransmuxComplete(ce)}},E.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,_=this.worker;if(_)_.postMessage({cmd:"flush",chunkMeta:a});else if(h){var g=h.flush(a);Object(K.isPromise)(g)?g.then(function(m){l.handleFlushResult(m,a)}):this.handleFlushResult(g,a)}},E.handleFlushResult=function(a,l){var h=this;a.forEach(function(_){h.handleTransmuxComplete(_)}),this.onFlush(l)},E.onWorkerMessage=function(a){var l=a.data,h=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,h.trigger(l.event,l.data);break}}},E.configureTransmuxer=function(a){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},E.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},C}()},"./src/demux/transmuxer-worker.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return N});var Z=R("./src/demux/transmuxer.ts"),B=R("./src/events.ts"),P=R("./src/utils/logger.ts"),K=R("./node_modules/eventemitter3/index.js"),U=R.n(K);function N(T){var C=new K.EventEmitter,E=function(a,l){T.postMessage({event:a,data:l})};C.on(B.Events.FRAG_DECRYPTED,E),C.on(B.Events.ERROR,E),T.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);T.transmuxer=new Z.default(C,a.typeSupported,l,a.vendor,a.id),Object(P.enableLogs)(l.debug),E("init",null);break}case"configure":{T.transmuxer.configure(a.config);break}case"demux":{var h=T.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Z.isPromise)(h)?h.then(function(m){D(T,m)}):D(T,h);break}case"flush":{var _=a.chunkMeta,g=T.transmuxer.flush(_);Object(Z.isPromise)(g)?g.then(function(m){A(T,m,_)}):A(T,g,_);break}default:break}})}function D(T,C){if(k(C.remuxResult))return;var E=[],d=C.remuxResult,a=d.audio,l=d.video;a&&b(E,a),l&&b(E,l),T.postMessage({event:"transmuxComplete",data:C},E)}function b(T,C){C.data1&&T.push(C.data1.buffer),C.data2&&T.push(C.data2.buffer)}function A(T,C,E){C.forEach(function(d){D(T,d)}),T.postMessage({event:"flush",data:E})}function k(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return l}),R.d($,"isPromise",function(){return g}),R.d($,"TransmuxConfig",function(){return m}),R.d($,"TransmuxState",function(){return L});var Z=R("./src/events.ts"),B=R("./src/errors.ts"),P=R("./src/crypt/decrypter.ts"),K=R("./src/demux/aacdemuxer.ts"),U=R("./src/demux/mp4demuxer.ts"),N=R("./src/demux/tsdemuxer.ts"),D=R("./src/demux/mp3demuxer.ts"),b=R("./src/remux/mp4-remuxer.ts"),A=R("./src/remux/passthrough-remuxer.ts"),k=R("./src/demux/chunk-cache.ts"),T=R("./src/utils/mp4-tools.ts"),C=R("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(y){C.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var d=[{demux:N.default,remux:b.default},{demux:U.default,remux:A.default},{demux:K.default,remux:b.default},{demux:D.default,remux:b.default}],a=1024;d.forEach(function(y){var c=y.demux;a=Math.max(a,c.minProbeByteLength)});var l=function(){function y(f,u,o,x,v){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 k.default,this.observer=f,this.typeSupported=u,this.config=o,this.vendor=x,this.id=v}var c=y.prototype;return c.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},c.push=function(u,o,x,v){var S=this,M=x.transmuxing;M.executeStart=E();var j=new Uint8Array(u),G=this.cache,V=this.config,O=this.currentTransmuxState,I=this.transmuxConfig;v&&(this.currentTransmuxState=v);var X=h(j,o);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(V.enableSoftwareAES){var oe=q.softwareDecrypt(j,X.key.buffer,X.iv.buffer);if(!oe)return M.executeEnd=E(),_(x);j=new Uint8Array(oe)}else return this.decryptionPromise=q.webCryptoDecrypt(j,X.key.buffer,X.iv.buffer).then(function(ke){var Ne=S.push(ke,null,x);return S.decryptionPromise=null,Ne}),this.decryptionPromise}var ce=v||O,Le=ce.contiguous,Ee=ce.discontinuity,we=ce.trackSwitch,Te=ce.accurateTimeOffset,ye=ce.timeOffset,fe=I.audioCodec,se=I.videoCodec,te=I.defaultInitPts,ue=I.duration,ne=I.initSegmentData;if((Ee||we)&&this.resetInitSegment(ne,fe,se,ue),Ee&&this.resetInitialTimestamp(te),Le||this.resetContiguity(),this.needsProbing(j,Ee,we)){if(G.dataLength){var _e=G.flush();j=Object(T.appendUint8Array)(_e,j)}this.configureTransmuxer(j,I)}var Re=this.transmux(j,X,ye,Te,x),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,M.executeEnd=E(),Re},c.flush=function(u){var o=this,x=u.transmuxing;x.executeStart=E();var v=this.decrypter,S=this.cache,M=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return o.flush(u)});var G=[],V=M.timeOffset;if(v){var O=v.flush();O&&G.push(this.push(O,null,u))}var I=S.dataLength;S.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return I>=a&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=E(),[_(u)];var oe=X.flush(V);return g(oe)?oe.then(function(ce){return o.flushRemux(G,ce,u),G}):(this.flushRemux(G,oe,u),G)},c.flushRemux=function(u,o,x){var v=o.audioTrack,S=o.avcTrack,M=o.id3Track,j=o.textTrack,G=this.currentTransmuxState,V=G.accurateTimeOffset,O=G.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var I=this.remuxer.remux(v,S,M,j,O,V,!0,this.id);u.push({remuxResult:I,chunkMeta:x}),x.transmuxing.executeEnd=E()},c.resetInitialTimestamp=function(u){var o=this.demuxer,x=this.remuxer;if(!o||!x)return;o.resetTimeStamp(u),x.resetTimeStamp(u)},c.resetContiguity=function(){var u=this.demuxer,o=this.remuxer;if(!u||!o)return;u.resetContiguity(),o.resetNextTimestamp()},c.resetInitSegment=function(u,o,x,v){var S=this.demuxer,M=this.remuxer;if(!S||!M)return;S.resetInitSegment(o,x,v),M.resetInitSegment(u,o,x)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(u,o,x,v,S){var M;return o&&o.method==="SAMPLE-AES"?M=this.transmuxSampleAes(u,o,x,v,S):M=this.transmuxUnencrypted(u,x,v,S),M},c.transmuxUnencrypted=function(u,o,x,v){var S=this.demuxer.demux(u,o,!1,!this.config.progressive),M=S.audioTrack,j=S.avcTrack,G=S.id3Track,V=S.textTrack,O=this.remuxer.remux(M,j,G,V,o,x,!1,this.id);return{remuxResult:O,chunkMeta:v}},c.transmuxSampleAes=function(u,o,x,v,S){var M=this;return this.demuxer.demuxSampleAes(u,o,x).then(function(j){var G=M.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,x,v,!1,M.id);return{remuxResult:G,chunkMeta:S}})},c.configureTransmuxer=function(u,o){for(var x=this.config,v=this.observer,S=this.typeSupported,M=this.vendor,j=o.audioCodec,G=o.defaultInitPts,V=o.duration,O=o.initSegmentData,I=o.videoCodec,X,q=0,oe=d.length;q<oe;q++)if(d[q].demux.probe(u)){X=d[q];break}X||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:U.default,remux:A.default});var ce=this.demuxer,Le=this.remuxer,Ee=X.remux,we=X.demux;(!Le||!(Le instanceof Ee))&&(this.remuxer=new Ee(v,x,S,M)),(!ce||!(ce instanceof we))&&(this.demuxer=new we(v,x,S),this.probe=we.probe),this.resetInitSegment(O,j,I,V),this.resetInitialTimestamp(G)},c.needsProbing=function(u,o,x){return!this.demuxer||!this.remuxer||o||x},c.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new P.default(this.observer,this.config)),u},y}();function h(y,c){var f=null;return y.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var _=function(c){return{remuxResult:{},chunkMeta:c}};function g(y){return"then"in y&&y.then instanceof Function}var m=function(c,f,u,o,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=u,this.duration=o,this.defaultInitPts=x},L=function(c,f,u,o,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=u,this.trackSwitch=o,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(le,$,R){"use strict";R.r($),R.d($,"discardEPB",function(){return _});var Z=R("./src/demux/adts.ts"),B=R("./src/demux/mpegaudio.ts"),P=R("./src/demux/exp-golomb.ts"),K=R("./src/demux/id3.ts"),U=R("./src/demux/sample-aes.ts"),N=R("./src/events.ts"),D=R("./src/utils/mp4-tools.ts"),b=R("./src/utils/logger.ts"),A=R("./src/errors.ts"),k={video:1,audio:2,id3:3,text:4},T=function(){function g(L,y,c){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=c}g.probe=function(y){var c=g.syncOffset(y);return c<0?!1:(c&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},g.syncOffset=function(y){for(var c=Math.min(1e3,y.length-3*188),f=0;f<c;){if(y[f]===71&&y[f+188]===71&&y[f+2*188]===71)return f;f++}return-1},g.createTrack=function(y,c){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:k[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?c:void 0}};var m=g.prototype;return m.resetInitSegment=function(y,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",f),this._audioTrack=g.createTrack("audio",f),this._id3Track=g.createTrack("id3",f),this._txtTrack=g.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=c,this._duration=f},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,c=this._avcTrack,f=this._id3Track;y&&(y.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,c,f,u){f===void 0&&(f=!1),u===void 0&&(u=!1),f||(this.sampleAes=null);var o,x=this._avcTrack,v=this._audioTrack,S=this._id3Track,M=x.pid,j=x.pesData,G=v.pid,V=S.pid,O=v.pesData,I=S.pesData,X=!1,q=this.pmtParsed,oe=this._pmtId,ce=y.length;if(this.remainderData&&(y=Object(D.appendUint8Array)(this.remainderData,y),ce=y.length,this.remainderData=null),ce<188&&!u)return this.remainderData=y,{audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};var Le=Math.max(0,g.syncOffset(y));ce-=(ce+Le)%188,ce<y.byteLength&&!u&&(this.remainderData=new Uint8Array(y.buffer,ce,y.buffer.byteLength-ce));for(var Ee=Le;Ee<ce;Ee+=188)if(y[Ee]===71){var we=!!(y[Ee+1]&64),Te=((y[Ee+1]&31)<<8)+y[Ee+2],ye=(y[Ee+3]&48)>>4,fe=void 0;if(ye>1){if(fe=Ee+5+y[Ee+4],fe===Ee+188)continue}else fe=Ee+4;switch(Te){case M:we&&(j&&(o=a(j))&&this.parseAVCPES(o,!1),j={data:[],size:0}),j&&(j.data.push(y.subarray(fe,Ee+188)),j.size+=Ee+188-fe);break;case G:we&&(O&&(o=a(O))&&(v.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),O={data:[],size:0}),O&&(O.data.push(y.subarray(fe,Ee+188)),O.size+=Ee+188-fe);break;case V:we&&(I&&(o=a(I))&&this.parseID3PES(o),I={data:[],size:0}),I&&(I.data.push(y.subarray(fe,Ee+188)),I.size+=Ee+188-fe);break;case 0:we&&(fe+=y[fe]+1),oe=this._pmtId=E(y,fe);break;case oe:{we&&(fe+=y[fe]+1);var se=d(y,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);M=se.avc,M>0&&(x.pid=M),G=se.audio,G>0&&(v.pid=G,v.isAAC=se.isAAC),V=se.id3,V>0&&(S.pid=V),X&&!q&&(b.logger.log("reparse from beginning"),X=!1,Ee=Le-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=j,v.pesData=O,S.pesData=I;var te={audioTrack:v,avcTrack:x,id3Track:S,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(te),te},m.flush=function(){var y=this.remainderData;this.remainderData=null;var c;return y?c=this.demux(y,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},m.extractRemainingSamples=function(y){var c=y.audioTrack,f=y.avcTrack,u=y.id3Track,o=f.pesData,x=c.pesData,v=u.pesData,S;o&&(S=a(o))?(this.parseAVCPES(S,!0),f.pesData=null):f.pesData=o,x&&(S=a(x))?(c.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),c.pesData=null):(x!=null&&x.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=x),v&&(S=a(v))?(this.parseID3PES(S),u.pesData=null):u.pesData=v},m.demuxSampleAes=function(y,c,f){var u=this.demux(y,f,!0,!this.config.progressive),o=this.sampleAes=new U.default(this.observer,this.config,c);return this.decrypt(u,o)},m.decrypt=function(y,c){return new Promise(function(f){var u=y.audioTrack,o=y.avcTrack;u.samples&&u.isAAC?c.decryptAacSamples(u.samples,0,function(){o.samples?c.decryptAvcSamples(o.samples,0,0,function(){f(y)}):f(y)}):o.samples&&c.decryptAvcSamples(o.samples,0,0,function(){f(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,c){var f=this,u=this._avcTrack,o=this.parseAVCNALu(y.data),x=!1,v=this.avcSample,S,M=!1;y.data=null,v&&o.length&&!u.audFound&&(l(v,u),v=this.avcSample=C(!1,y.pts,y.dts,"")),o.forEach(function(j){switch(j.type){case 1:{S=!0,v||(v=f.avcSample=C(!0,y.pts,y.dts,"")),x&&(v.debug+="NDR "),v.frame=!0;var G=j.data;if(M&&G.length>4){var V=new P.default(G).readSliceType();(V===2||V===4||V===7||V===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=f.avcSample=C(!0,y.pts,y.dts,"")),x&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,x&&v&&(v.debug+="SEI ");var O=new P.default(_(j.data));O.readUByte();for(var I=0,X=0,q=!1,oe=0;!q&&O.bytesAvailable>1;){I=0;do oe=O.readUByte(),I+=oe;while(oe===255);X=0;do oe=O.readUByte(),X+=oe;while(oe===255);if(I===4&&O.bytesAvailable!==0){q=!0;var ce=O.readUByte();if(ce===181){var Le=O.readUShort();if(Le===49){var Ee=O.readUInt();if(Ee===1195456820){var we=O.readUByte();if(we===3){for(var Te=O.readUByte(),ye=O.readUByte(),fe=31&Te,se=[Te,ye],te=0;te<fe;te++)se.push(O.readUByte()),se.push(O.readUByte()),se.push(O.readUByte());h(f._txtTrack.samples,{type:3,pts:y.pts,bytes:se})}}}}}else if(I===5&&O.bytesAvailable!==0){if(q=!0,X>16){for(var ue=[],ne=0;ne<16;ne++)ue.push(O.readUByte().toString(16)),(ne===3||ne===5||ne===7||ne===9)&&ue.push("-");for(var _e=X-16,Re=new Uint8Array(_e),xe=0;xe<_e;xe++)Re[xe]=O.readUByte();h(f._txtTrack.samples,{pts:y.pts,payloadType:I,uuid:ue.join(""),userData:Object(K.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if(X<O.bytesAvailable)for(var ke=0;ke<X;ke++)O.readUByte()}break}case 7:if(S=!0,M=!0,x&&v&&(v.debug+="SPS "),!u.sps){var Ne=new P.default(j.data),He=Ne.readSPS();u.width=He.width,u.height=He.height,u.pixelRatio=He.pixelRatio,u.sps=[j.data],u.duration=f._duration;for(var Fe=j.data.subarray(1,4),Me="avc1.",Oe=0;Oe<3;Oe++){var Ye=Fe[Oe].toString(16);Ye.length<2&&(Ye="0"+Ye),Me+=Ye}u.codec=Me}break;case 8:S=!0,x&&v&&(v.debug+="PPS "),u.pps||(u.pps=[j.data]);break;case 9:S=!1,u.audFound=!0,v&&l(v,u),v=f.avcSample=C(!1,y.pts,y.dts,x?"AUD ":"");break;case 12:S=!1;break;default:S=!1,v&&(v.debug+="unknown NAL "+j.type+" ");break}if(v&&S){var Ze=v.units;Ze.push(j)}}),c&&v&&(l(v,u),this.avcSample=null)},m.getLastNalUnit=function(){var y,c=this.avcSample,f;if(!c||c.units.length===0){var u=this._avcTrack.samples;c=u[u.length-1]}if((y=c)!==null&&y!==void 0&&y.units){var o=c.units;f=o[o.length-1]}return f},m.parseAVCNALu=function(y){var c=y.byteLength,f=this._avcTrack,u=f.naluState||0,o=u,x=[],v=0,S,M,j,G=-1,V=0;for(u===-1&&(G=0,V=y[0]&31,u=0,v=1);v<c;){if(S=y[v++],!u){u=S?0:1;continue}if(u===1){u=S?0:2;continue}if(!S)u=3;else if(S===1){if(G>=0){var O={data:y.subarray(G,v-u-1),type:V};x.push(O)}else{var I=this.getLastNalUnit();if(I&&(o&&v<=4-o&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-o))),M=v-u-1,M>0)){var X=new Uint8Array(I.data.byteLength+M);X.set(I.data,0),X.set(y.subarray(0,M),I.data.byteLength),I.data=X,I.state=0}}v<c?(j=y[v]&31,G=v,V=j,u=0):u=-1}else u=0}if(G>=0&&u>=0){var q={data:y.subarray(G,c),type:V,state:u};x.push(q)}if(x.length===0){var oe=this.getLastNalUnit();if(oe){var ce=new Uint8Array(oe.data.byteLength+y.byteLength);ce.set(oe.data,0),ce.set(y,oe.data.byteLength),oe.data=ce}}return f.naluState=u,x},m.parseAACPES=function(y){var c=0,f=this._audioTrack,u=this.aacOverFlow,o=y.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,v=Math.min(u.missing,x),S=x-v;u.sample.unit.set(o.subarray(0,v),S),f.samples.push(u.sample),c=u.missing}var M,j;for(M=c,j=o.length;M<j-1&&!Z.isHeader(o,M);M++);if(M!==c){var G,V;if(M<j-1?(G="AAC PES did not start with ADTS header,offset:"+M,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:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:G}),V)return}Z.initTrackConfig(f,this.observer,o,M,this.audioCodec);var O;if(y.pts!==void 0)O=y.pts;else if(u){var I=Z.getFrameDuration(f.samplerate);O=u.sample.pts+I}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;M<j;)if(Z.isHeader(o,M)){if(M+5<j){var q=Z.appendFrame(f,o,M,O,X);if(q)if(q.missing)this.aacOverFlow=q;else{M+=q.length,X++;continue}}break}else M++},m.parseMPEGPES=function(y){var c=y.data,f=c.length,u=0,o=0,x=y.pts;if(x===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<f;)if(B.isHeader(c,o)){var v=B.appendFrame(this._audioTrack,c,o,x,u);if(v)o+=v.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)},g}();T.minProbeByteLength=188;function C(g,m,L,y){return{key:g,frame:!1,pts:m,dts:L,units:[],debug:y,length:0}}function E(g,m){return(g[m+10]&31)<<8|g[m+11]}function d(g,m,L,y){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(g[m+1]&15)<<8|g[m+2],u=m+3+f-4,o=(g[m+10]&15)<<8|g[m+11];for(m+=12+o;m<u;){var x=(g[m+1]&31)<<8|g[m+2];switch(g[m]){case 207:if(!y){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=x);break;case 21:c.id3===-1&&(c.id3=x);break;case 219:if(!y){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=x);break;case 3:case 4:L?c.audio===-1&&(c.audio=x,c.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+=((g[m+3]&15)<<8|g[m+4])+5}return c}function a(g){var m=0,L,y,c,f,u,o=g.data;if(!g||g.size===0)return null;for(;o[0].length<19&&o.length>1;){var x=new Uint8Array(o[0].length+o[1].length);x.set(o[0]),x.set(o[1],o[0].length),o[0]=x,o.splice(1,1)}L=o[0];var v=(L[0]<<16)+(L[1]<<8)+L[2];if(v===1){if(y=(L[4]<<8)+L[5],y&&y>g.size-6)return null;var S=L[7];S&192&&(f=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,S&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,f-u>60*9e4&&(b.logger.warn(Math.round((f-u)/9e4)+"s delta between PTS and DTS, align them"),f=u)):u=f),c=L[8];var M=c+9;if(g.size<=M)return null;g.size-=M;for(var j=new Uint8Array(g.size),G=0,V=o.length;G<V;G++){L=o[G];var O=L.byteLength;if(M)if(M>O){M-=O;continue}else L=L.subarray(M),O-=M,M=0;j.set(L,m),m+=O}return y&&(y-=c+3),{data:j,pts:f,dts:u,len:y}}return null}function l(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var L=m.samples,y=L.length;if(y){var c=L[y-1];g.pts=c.pts,g.dts=c.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&b.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function h(g,m){var L=g.length;if(L>0){if(m.pts>=g[L-1].pts)g.push(m);else for(var y=L-1;y>=0;y--)if(m.pts<g[y].pts){g.splice(y,0,m);break}}else g.push(m)}function _(g){for(var m=g.byteLength,L=[],y=1;y<m-2;)g[y]===0&&g[y+1]===0&&g[y+2]===3?(L.push(y+2),y+=2):y++;if(L.length===0)return g;var c=m-L.length,f=new Uint8Array(c),u=0;for(y=0;y<c;u++,y++)u===L[0]&&(u++,L.shift()),f[y]=g[u];return f}$.default=T},"./src/errors.ts":function(le,$,R){"use strict";R.r($),R.d($,"ErrorTypes",function(){return Z}),R.d($,"ErrorDetails",function(){return B});var Z;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Z||(Z={}));var B;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(le,$,R){"use strict";R.r($),R.d($,"Events",function(){return Z});var Z;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return g});var Z=R("./node_modules/url-toolkit/src/url-toolkit.js"),B=R.n(Z),P=R("./src/loader/playlist-loader.ts"),K=R("./src/loader/key-loader.ts"),U=R("./src/controller/id3-track-controller.ts"),N=R("./src/controller/latency-controller.ts"),D=R("./src/controller/level-controller.ts"),b=R("./src/controller/fragment-tracker.ts"),A=R("./src/controller/stream-controller.ts"),k=R("./src/is-supported.ts"),T=R("./src/utils/logger.ts"),C=R("./src/config.ts"),E=R("./node_modules/eventemitter3/index.js"),d=R.n(E),a=R("./src/events.ts"),l=R("./src/errors.ts");function h(m,L){for(var y=0;y<L.length;y++){var c=L[y];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(m,c.key,c)}}function _(m,L,y){return L&&h(m.prototype,L),y&&h(m,y),m}var g=function(){m.isSupported=function(){return Object(k.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 E.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 c=this.config=Object(C.mergeConfig)(m.DefaultConfig,y);this.userConfig=y,Object(T.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(C.enableStreamingMode)(c);var f=c.abrController,u=c.bufferController,o=c.capLevelController,x=c.fpsController,v=this.abrController=new f(this),S=this.bufferController=new u(this),M=this.capLevelController=new o(this),j=new x(this),G=new P.default(this),V=new K.default(this),O=new U.default(this),I=this.levelController=new D.default(this),X=new b.FragmentTracker(this),q=this.streamController=new A.default(this,X);M.setStreamController(q),j.setStreamController(q);var oe=[I,q];this.networkControllers=oe;var ce=[G,V,v,S,M,j,O,X];this.audioTrackController=this.createController(c.audioTrackController,null,oe),this.createController(c.audioStreamController,X,oe),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,oe),this.createController(c.subtitleStreamController,X,oe),this.createController(c.timelineController,null,ce),this.emeController=this.createController(c.emeController,null,ce),this.cmcdController=this.createController(c.cmcdController,null,ce),this.latencyController=this.createController(N.default,null,ce),this.coreComponents=ce}var L=m.prototype;return L.createController=function(c,f,u){if(c){var o=f?new c(this,f):new c(this);return u&&u.push(o),o}return null},L.on=function(c,f,u){u===void 0&&(u=this),this._emitter.on(c,f,u)},L.once=function(c,f,u){u===void 0&&(u=this),this._emitter.once(c,f,u)},L.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},L.off=function(c,f,u,o){u===void 0&&(u=this),this._emitter.off(c,f,u,o)},L.listeners=function(c){return this._emitter.listeners(c)},L.emit=function(c,f,u){return this._emitter.emit(c,f,u)},L.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(u){T.logger.error("An internal error happened while handling event "+c+'. 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:c,error:u})}return!1},L.listenerCount=function(c){return this._emitter.listenerCount(c)},L.destroy=function(){T.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},L.attachMedia=function(c){T.logger.log("attachMedia"),this._media=c,this.trigger(a.Events.MEDIA_ATTACHING,{media:c})},L.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(c){this.stopLoad();var f=this.media,u=this.url,o=this.url=Z.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});T.logger.log("loadSource:"+o),f&&u&&u!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(a.Events.MANIFEST_LOADING,{url:c})},L.startLoad=function(c){c===void 0&&(c=-1),T.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},L.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},L.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){T.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},L.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},_(m,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){T.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){T.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){T.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){T.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){T.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(T.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var u=c.length,o=0;o<u;o++)if(c[o].maxBitrate>f)return o;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,u;return f===-1&&c&&c.length?u=c.length-1:u=f,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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:C.hlsDefaultConfig},set:function(c){m.defaultConfig=c}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(le,$,R){"use strict";R.r($),R.d($,"isSupported",function(){return P}),R.d($,"changeTypeSupported",function(){return K});var Z=R("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var U=Object(Z.getMediaSource)();if(!U)return!1;var N=B(),D=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!N||N.prototype&&typeof N.prototype.appendBuffer=="function"&&typeof N.prototype.remove=="function";return!!D&&!!b}function K(){var U,N=B();return typeof(N==null||((U=N.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return T}),R.d($,"LoadError",function(){return E});var Z=R("./src/polyfills/number.ts"),B=R("./src/errors.ts");function P(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,b(d,a)}function K(d){var a=typeof Map=="function"?new Map:void 0;return K=function(h){if(h===null||!D(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,_)}function _(){return U(h,arguments,A(this).constructor)}return _.prototype=Object.create(h.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),b(_,h)},K(d)}function U(d,a,l){return N()?U=Reflect.construct:U=function(_,g,m){var L=[null];L.push.apply(L,g);var y=Function.bind.apply(_,L),c=new y;return m&&b(c,m.prototype),c},U.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(d){return!1}}function D(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function b(d,a){return b=Object.setPrototypeOf||function(h,_){return h.__proto__=_,h},b(d,a)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(d)}var k=Math.pow(2,17),T=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,_){var g=this,m=h.url;if(!m)return Promise.reject(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var L=this.config,y=L.fLoader,c=L.loader;return new Promise(function(f,u){g.loader&&g.loader.destroy();var o=g.loader=h.loader=y?new y(L):new c(L),x=C(h),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};h.stats=o.stats,o.load(x,v,{onSuccess:function(M,j,G,V){g.resetLoader(h,o),f({frag:h,part:null,payload:M.data,networkDetails:V})},onError:function(M,j,G){g.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:M,networkDetails:G}))},onAbort:function(M,j,G){g.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:G}))},onTimeout:function(M,j,G){g.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:G}))},onProgress:function(M,j,G,V){_&&_({frag:h,part:null,payload:G,networkDetails:V})}})})},a.loadPart=function(h,_,g){var m=this;this.abort();var L=this.config,y=L.fLoader,c=L.loader;return new Promise(function(f,u){m.loader&&m.loader.destroy();var o=m.loader=h.loader=y?new y(L):new c(L),x=C(h,_),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};_.stats=o.stats,o.load(x,v,{onSuccess:function(M,j,G,V){m.resetLoader(h,o),m.updateStatsFromPart(h,_);var O={frag:h,part:_,payload:M.data,networkDetails:V};g(O),f(O)},onError:function(M,j,G){m.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:_,response:M,networkDetails:G}))},onAbort:function(M,j,G){h.stats.aborted=_.stats.aborted,m.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:_,networkDetails:G}))},onTimeout:function(M,j,G){m.resetLoader(h,o),u(new E({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:_,networkDetails:G}))}})})},a.updateStatsFromPart=function(h,_){var g=h.stats,m=_.stats,L=m.total;if(g.loaded+=m.loaded,L){var y=Math.round(h.duration/_.duration),c=Math.min(Math.round(g.loaded/L),y),f=y-c,u=f*Math.round(g.loaded/c);g.total=g.loaded+u}else g.total=Math.max(g.loaded,g.total);var o=g.loading,x=m.loading;o.start?o.first+=x.first-x.start:(o.start=x.start,o.first=x.first),o.end=x.end},a.resetLoader=function(h,_){h.loader=null,this.loader===_&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),_.destroy()},d}();function C(d,a){a===void 0&&(a=null);var l=a||d,h={frag:d,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},_=l.byteRangeStartOffset,g=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(_)&&Object(Z.isFiniteNumber)(g)&&(h.rangeStart=_,h.rangeEnd=g),h}var E=function(d){P(a,d);function a(l){for(var h,_=arguments.length,g=new Array(_>1?_-1:0),m=1;m<_;m++)g[m-1]=arguments[m];return h=d.call.apply(d,[this].concat(g))||this,h.data=void 0,h.data=l,h}return a}(K(Error))},"./src/loader/fragment.ts":function(le,$,R){"use strict";R.r($),R.d($,"ElementaryStreamTypes",function(){return T}),R.d($,"BaseSegment",function(){return C}),R.d($,"Fragment",function(){return E}),R.d($,"Part",function(){return d});var Z=R("./src/polyfills/number.ts"),B=R("./node_modules/url-toolkit/src/url-toolkit.js"),P=R.n(B),K=R("./src/utils/logger.ts"),U=R("./src/loader/level-key.ts"),N=R("./src/loader/load-stats.ts");function D(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,b(a,l)}function b(a,l){return b=Object.setPrototypeOf||function(_,g){return _.__proto__=g,_},b(a,l)}function A(a,l){for(var h=0;h<l.length;h++){var _=l[h];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function k(a,l,h){return l&&A(a.prototype,l),h&&A(a,h),a}var T;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(T||(T={}));var C=function(){function a(h){var _;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(_={},_[T.AUDIO]=null,_[T.VIDEO]=null,_[T.AUDIOVIDEO]=null,_),this.baseurl=h}var l=a.prototype;return l.setByteRange=function(_,g){var m=_.split("@",2),L=[];m.length===1?L[0]=g?g.byteRangeEndOffset:0:L[0]=parseInt(m[1]),L[1]=parseInt(m[0])+L[0],this._byteRange=L},k(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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(_){this._url=_}}]),a}(),E=function(a){D(l,a);function l(_,g){var m;return m=a.call(this,g)||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=_,m}var h=l.prototype;return h.createInitializationVector=function(g){for(var m=new Uint8Array(16),L=12;L<16;L++)m[L]=g>>8*(15-L)&255;return m},h.setDecryptDataFromLevelKey=function(g,m){var L=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(L=U.LevelKey.fromURI(g.uri),L.method=g.method,L.iv=this.createInitializationVector(m),L.keyFormat="identity"),L},h.setElementaryStreamInfo=function(g,m,L,y,c,f){f===void 0&&(f=!1);var u=this.elementaryStreams,o=u[g];if(!o){u[g]={startPTS:m,endPTS:L,startDTS:y,endDTS:c,partial:f};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,c)},h.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[T.AUDIO]=null,g[T.VIDEO]=null,g[T.AUDIOVIDEO]=null},k(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var g=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),l}(C),d=function(a){D(l,a);function l(h,_,g,m,L){var y;y=a.call(this,g)||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=h.decimalFloatingPoint("DURATION"),y.gap=h.bool("GAP"),y.independent=h.bool("INDEPENDENT"),y.relurl=h.enumeratedString("URI"),y.fragment=_,y.index=m;var c=h.enumeratedString("BYTERANGE");return c&&y.setByteRange(c,L),L&&(y.fragOffset=L.fragOffset+L.duration),y}return k(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 _=this.elementaryStreams;return!!(_.audio||_.video||_.audiovideo)}}]),l}(C)},"./src/loader/key-loader.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return K});var Z=R("./src/events.ts"),B=R("./src/errors.ts"),P=R("./src/utils/logger.ts"),K=function(){function U(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var N=U.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 A=this.loaders[b];A&&A.destroy()}this.loaders={}},N.onKeyLoading=function(b,A){var k=A.frag,T=k.type,C=this.loaders[T];if(!k.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=k.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(C&&(P.logger.warn("abort previous key loader for type:"+T),C.abort()),!E){P.logger.warn("key uri is falsy");return}var a=d.loader,l=k.loader=this.loaders[T]=new a(d);this.decrypturl=E,this.decryptkey=null;var h={url:E,frag:k,responseType:"arraybuffer"},_={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,_,g)}else this.decryptkey&&(k.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:k}))},N.loadsuccess=function(b,A,k){var T=k.frag;if(!T.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(b.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:T})},N.loaderror=function(b,A){var k=A.frag,T=k.loader;T&&T.abort(),delete this.loaders[k.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:k,response:b})},N.loadtimeout=function(b,A){var k=A.frag,T=k.loader;T&&T.abort(),delete this.loaders[k.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:k})},U}()},"./src/loader/level-details.ts":function(le,$,R){"use strict";R.r($),R.d($,"LevelDetails",function(){return U});var Z=R("./src/polyfills/number.ts");function B(N,D){for(var b=0;b<D.length;b++){var A=D[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(N,A.key,A)}}function P(N,D,b){return D&&B(N.prototype,D),b&&B(N,b),N}var K=10,U=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 D=N.prototype;return D.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var k=this.lastPartSn-A.lastPartSn,T=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!T||!!k,this.advanced=this.endSN>A.endSN||k>0||k===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(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 A=this.driftEndTime-this.driftStartTime;if(A>0){var k=this.driftEnd-this.driftStart;return k*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),N}()},"./src/loader/level-key.ts":function(le,$,R){"use strict";R.r($),R.d($,"LevelKey",function(){return U});var Z=R("./node_modules/url-toolkit/src/url-toolkit.js"),B=R.n(Z);function P(N,D){for(var b=0;b<D.length;b++){var A=D[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(N,A.key,A)}}function K(N,D,b){return D&&P(N.prototype,D),b&&P(N,b),N}var U=function(){N.fromURL=function(b,A){return new N(b,A)},N.fromURI=function(b){return new N(b)};function N(D,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)(D,b,{alwaysNormalize:!0}):this._uri=D}return K(N,[{key:"uri",get:function(){return this._uri}}]),N}()},"./src/loader/load-stats.ts":function(le,$,R){"use strict";R.r($),R.d($,"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(le,$,R){"use strict";R.r($),R.d($,"default",function(){return l});var Z=R("./src/polyfills/number.ts"),B=R("./node_modules/url-toolkit/src/url-toolkit.js"),P=R.n(B),K=R("./src/loader/fragment.ts"),U=R("./src/loader/level-details.ts"),N=R("./src/loader/level-key.ts"),D=R("./src/utils/attr-list.ts"),b=R("./src/utils/logger.ts"),A=R("./src/utils/codecs.ts"),k=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,T=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function a(L){var y,c;return d.test((y=(c=B.parseURL(L))===null||c===void 0?void 0:c.path)!=null?y:"")}var l=function(){function L(){}return L.findGroup=function(c,f){for(var u=0;u<c.length;u++){var o=c[u];if(o.id===f)return o}},L.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var u=f.shift()+".";return u+=parseInt(f.shift()).toString(16),u+=("000"+parseInt(f.shift()).toString(16)).substr(-4),u}return c},L.resolve=function(c,f){return B.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(c,f){var u=[],o={},x=!1;k.lastIndex=0;for(var v;(v=k.exec(c))!=null;)if(v[1]){var S=new D.AttrList(v[1]),M={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:L.resolve(v[2],f)},j=S.decimalResolution("RESOLUTION");j&&(M.width=j.width,M.height=j.height),h((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=L.convertAVC1ToAVCOTI(M.videoCodec)),u.push(M)}else if(v[3]){var G=new D.AttrList(v[3]);G["DATA-ID"]&&(x=!0,o[G["DATA-ID"]]=G)}return{levels:u,sessionData:x?o:null}},L.parseMasterPlaylistMedia=function(c,f,u,o){o===void 0&&(o=[]);var x,v=[],S=0;for(T.lastIndex=0;(x=T.exec(c))!==null;){var M=new D.AttrList(x[1]);if(M.TYPE===u){var j={attrs:M,bitrate:0,id:S++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:u,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?L.resolve(M.URI,f):""};if(o.length){var G=L.findGroup(o,j.groupId)||o[0];_(j,G,"audioCodec"),_(j,G,"textCodec")}v.push(j)}}return v},L.parseLevelPlaylist=function(c,f,u,o,x){var v=new U.LevelDetails(f),S=v.fragments,M=null,j=0,G=0,V=0,O=0,I=null,X=new K.Fragment(o,f),q,oe,ce,Le=-1,Ee=!1;for(C.lastIndex=0,v.m3u8=c;(q=C.exec(c))!==null;){Ee&&(Ee=!1,X=new K.Fragment(o,f),X.start=V,X.sn=j,X.cc=O,X.level=u,M&&(X.initSegment=M,X.rawProgramDateTime=M.rawProgramDateTime));var we=q[1];if(we){X.duration=parseFloat(we);var Te=(" "+q[2]).slice(1);X.title=Te||null,X.tagList.push(Te?["INF",we,Te]:["INF",we])}else if(q[3])Object(Z.isFiniteNumber)(X.duration)&&(X.start=V,ce&&(X.levelkey=ce),X.sn=j,X.level=u,X.cc=O,X.urlId=x,S.push(X),X.relurl=(" "+q[3]).slice(1),m(X,I),I=X,V+=X.duration,j++,G=0,Ee=!0);else if(q[4]){var ye=(" "+q[4]).slice(1);I?X.setByteRange(ye,I):X.setByteRange(ye)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Le===-1&&(Le=S.length);else{if(q=q[0].match(E),!q){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<q.length&&!(typeof q[oe]!="undefined");oe++);var fe=(" "+q[oe]).slice(1),se=(" "+q[oe+1]).slice(1),te=q[oe+2]?(" "+q[oe+2]).slice(1):"";switch(fe){case"PLAYLIST-TYPE":v.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":j=v.startSN=parseInt(se);break;case"SKIP":{var ue=new D.AttrList(se),ne=ue.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ne)){v.skippedSegments=ne;for(var _e=ne;_e--;)S.unshift(null);j+=ne}var Re=ue.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(v.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(se);break;case"VERSION":v.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(se||te)&&X.tagList.push(te?[se,te]:[se]);break;case"DIS":O++;case"GAP":X.tagList.push([fe]);break;case"BITRATE":X.tagList.push([fe,se]);break;case"DISCONTINUITY-SEQ":O=parseInt(se);break;case"KEY":{var xe,ke=new D.AttrList(se),Ne=ke.enumeratedString("METHOD"),He=ke.URI,Fe=ke.hexadecimalInteger("IV"),Me=ke.enumeratedString("KEYFORMATVERSIONS"),Oe=ke.enumeratedString("KEYID"),Ye=(xe=ke.enumeratedString("KEYFORMAT"))!=null?xe:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(Ye)>-1){b.logger.warn("Keyformat "+Ye+" is not supported from the manifest");continue}else if(Ye!=="identity")continue;Ne&&(ce=N.LevelKey.fromURL(f,He),He&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ne)>=0&&(ce.method=Ne,ce.keyFormat=Ye,Oe&&(ce.keyID=Oe),Me&&(ce.keyFormatVersions=Me),ce.iv=Fe));break}case"START":{var Ve=new D.AttrList(se),je=Ve.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(je)&&(v.startTimeOffset=je);break}case"MAP":{var rt=new D.AttrList(se);X.relurl=rt.URI,rt.BYTERANGE&&X.setByteRange(rt.BYTERANGE),X.level=u,X.sn="initSegment",ce&&(X.levelkey=ce),X.initSegment=null,M=X,Ee=!0;break}case"SERVER-CONTROL":{var Je=new D.AttrList(se);v.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var tt=new D.AttrList(se);v.partTarget=tt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=v.partList;Pe||(Pe=v.partList=[]);var lt=G>0?Pe[Pe.length-1]:void 0,at=G++,Be=new K.Part(new D.AttrList(se),X,f,at,lt);Pe.push(Be),X.duration+=Be.duration;break}case"PRELOAD-HINT":{var Xe=new D.AttrList(se);v.preloadHint=Xe;break}case"RENDITION-REPORT":{var Ce=new D.AttrList(se);v.renditionReports=v.renditionReports||[],v.renditionReports.push(Ce);break}default:b.logger.warn("line parsed but not handled: "+q);break}}}I&&!I.relurl?(S.pop(),V-=I.duration,v.partList&&(v.fragmentHint=I)):v.partList&&(m(X,I),X.cc=O,v.fragmentHint=X);var ve=S.length,be=S[0],ie=S[ve-1];if(V+=v.skippedSegments*v.targetduration,V>0&&ve&&ie){v.averagetargetduration=V/ve;var ae=ie.sn;v.endSN=ae!=="initSegment"?ae:0,be&&(v.startCC=be.cc,be.initSegment||v.fragments.every(function(de){return de.relurl&&a(de.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new K.Fragment(o,f),X.relurl=ie.relurl,X.level=u,X.sn="initSegment",be.initSegment=X,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(V+=v.fragmentHint.duration),v.totalduration=V,v.endCC=O,Le>0&&g(S,Le),v},L}();function h(L,y){["video","audio","text"].forEach(function(c){var f=L.filter(function(o){return Object(A.isCodecType)(o,c)});if(f.length){var u=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});y[c+"Codec"]=u.length>0?u[0]:f[0],L=L.filter(function(o){return f.indexOf(o)===-1})}}),y.unknownCodecs=L}function _(L,y,c){var f=y[c];f&&(L[c]=f)}function g(L,y){for(var c=L[y],f=y;f--;){var u=L[f];if(!u)return;u.programDateTime=c.programDateTime-u.duration*1e3,c=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(le,$,R){"use strict";R.r($);var Z=R("./src/polyfills/number.ts"),B=R("./src/events.ts"),P=R("./src/errors.ts"),K=R("./src/utils/logger.ts"),U=R("./src/utils/mp4-tools.ts"),N=R("./src/loader/m3u8-parser.ts"),D=R("./src/types/loader.ts"),b=R("./src/utils/attr-list.ts");function A(C){var E=C.type;switch(E){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function k(C,E){var d=C.url;return(d===void 0||d.indexOf("data:")===0)&&(d=E.url),d}var T=function(){function C(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var E=C.prototype;return E.registerListeners=function(){var a=this.hls;a.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(a){var l=this.hls.config,h=l.pLoader,_=l.loader,g=h||_,m=new g(l);return a.loader=m,this.loaders[a.type]=m,m},E.getInternalLoader=function(a){return this.loaders[a.type]},E.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},E.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(a,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},E.onLevelLoading=function(a,l){var h=l.id,_=l.level,g=l.url,m=l.deliveryDirectives;this.load({id:h,groupId:null,level:_,responseType:"text",type:D.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},E.onAudioTrackLoading=function(a,l){var h=l.id,_=l.groupId,g=l.url,m=l.deliveryDirectives;this.load({id:h,groupId:_,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},E.onSubtitleTrackLoading=function(a,l){var h=l.id,_=l.groupId,g=l.url,m=l.deliveryDirectives;this.load({id:h,groupId:_,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},E.load=function(a){var l,h=this.hls.config,_=this.getInternalLoader(a);if(_){var g=_.context;if(g&&g.url===a.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),_.abort()}var m,L,y,c;switch(a.type){case D.PlaylistContextType.MANIFEST:m=h.manifestLoadingMaxRetry,L=h.manifestLoadingTimeOut,y=h.manifestLoadingRetryDelay,c=h.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:m=0,L=h.levelLoadingTimeOut;break;default:m=h.levelLoadingMaxRetry,L=h.levelLoadingTimeOut,y=h.levelLoadingRetryDelay,c=h.levelLoadingMaxRetryTimeout;break}if(_=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var f;if(a.type===D.PlaylistContextType.LEVEL&&a.level!==null?f=this.hls.levels[a.level].details:a.type===D.PlaylistContextType.AUDIO_TRACK&&a.id!==null?f=this.hls.audioTracks[a.id].details:a.type===D.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(f=this.hls.subtitleTracks[a.id].details),f){var u=f.partTarget,o=f.targetduration;u&&o&&(L=Math.min(Math.max(u*3,o*.8)*1e3,L))}}var x={timeout:L,maxRetry:m,retryDelay:y,maxRetryDelay:c,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};_.load(a,x,v)},E.loadsuccess=function(a,l,h,_){if(_===void 0&&(_=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,l,h,_);return}this.resetInternalLoader(h.type);var g=a.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",_);return}l.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,h,_):this.handleMasterPlaylist(a,l,h,_)},E.loaderror=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,a)},E.loadtimeout=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},E.handleMasterPlaylist=function(a,l,h,_){var g=this.hls,m=a.data,L=k(a,h),y=N.default.parseMasterPlaylist(m,L),c=y.levels,f=y.sessionData;if(!c.length){this.handleManifestParsingError(a,h,"no level found in manifest",_);return}var u=c.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),o=c.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),x=N.default.parseMasterPlaylistMedia(m,L,"AUDIO",u),v=N.default.parseMasterPlaylistMedia(m,L,"SUBTITLES",o),S=N.default.parseMasterPlaylistMedia(m,L,"CLOSED-CAPTIONS");if(x.length){var M=x.some(function(j){return!j.url});!M&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}g.trigger(B.Events.MANIFEST_LOADED,{levels:c,audioTracks:x,subtitles:v,captions:S,url:L,stats:l,networkDetails:_,sessionData:f})},E.handleTrackOrLevelPlaylist=function(a,l,h,_){var g=this.hls,m=h.id,L=h.level,y=h.type,c=k(a,h),f=Object(Z.isFiniteNumber)(m)?m:0,u=Object(Z.isFiniteNumber)(L)?L:f,o=A(h),x=N.default.parseLevelPlaylist(a.data,c,u,o,f);if(!x.fragments.length){g.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(y===D.PlaylistContextType.MANIFEST){var v={attrs:new b.AttrList({}),bitrate:0,details:x,name:"",url:c};g.trigger(B.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:c,stats:l,networkDetails:_,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var S,M=(S=x.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:M,isSidxRequest:!0,type:y,level:L,levelDetails:x,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=x,this.handlePlaylistLoaded(a,l,h,_)},E.handleSidxRequest=function(a,l){var h=Object(U.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var _=h.references,g=l.levelDetails;_.forEach(function(m,L){var y=m.info,c=g.fragments[L];c.byteRange.length===0&&c.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),c.initSegment&&c.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(a,l,h,_){this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===D.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:l,networkDetails:_})},E.handleNetworkError=function(a,l,h,_){h===void 0&&(h=!1),K.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var g=P.ErrorDetails.UNKNOWN,m=!1,L=this.getInternalLoader(a);switch(a.type){case D.PlaylistContextType.MANIFEST:g=h?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case D.PlaylistContextType.LEVEL:g=h?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.AUDIO_TRACK:g=h?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:g=h?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}L&&this.resetInternalLoader(a.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:a.url,loader:L,context:a,networkDetails:l};_&&(y.response=_),this.hls.trigger(B.Events.ERROR,y)},E.handlePlaylistLoaded=function(a,l,h,_){var g=h.type,m=h.level,L=h.id,y=h.groupId,c=h.loader,f=h.levelDetails,u=h.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",_);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(g){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:f,level:m||0,id:L||0,stats:l,networkDetails:_,deliveryDirectives:u});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:f,id:L||0,groupId:y||"",stats:l,networkDetails:_,deliveryDirectives:u});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:f,id:L||0,groupId:y||"",stats:l,networkDetails:_,deliveryDirectives:u});break}},C}();$.default=T},"./src/polyfills/number.ts":function(le,$,R){"use strict";R.r($),R.d($,"isFiniteNumber",function(){return Z}),R.d($,"MAX_SAFE_INTEGER",function(){return B});var Z=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,$,R){"use strict";R.r($);var Z=function(){function B(){}return B.getSilentFrame=function(K,U){switch(K){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},B}();$.default=Z},"./src/remux/mp4-generator.ts":function(le,$,R){"use strict";R.r($);var Z=Math.pow(2,32)-1,B=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in P.types)P.types.hasOwnProperty(U)&&(P.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var 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]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:N,audio:D};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var k=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,k,C,k,T),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,b))},P.box=function(U){for(var N=8,D=arguments.length,b=new Array(D>1?D-1:0),A=1;A<D;A++)b[A-1]=arguments[A];for(var k=b.length,T=k;k--;)N+=b[k].byteLength;var C=new Uint8Array(N);for(C[0]=N>>24&255,C[1]=N>>16&255,C[2]=N>>8&255,C[3]=N&255,C.set(U,4),k=0,N=8;k<T;k++)C.set(b[k],N),N+=b[k].byteLength;return C},P.hdlr=function(U){return P.box(P.types.hdlr,P.HDLR_TYPES[U])},P.mdat=function(U){return P.box(P.types.mdat,U)},P.mdhd=function(U,N){N*=U;var D=Math.floor(N/(Z+1)),b=Math.floor(N%(Z+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},P.mdia=function(U){return P.box(P.types.mdia,P.mdhd(U.timescale,U.duration),P.hdlr(U.type),P.minf(U))},P.mfhd=function(U){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},P.minf=function(U){return U.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(U)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(U))},P.moof=function(U,N,D){return P.box(P.types.moof,P.mfhd(U),P.traf(D,N))},P.moov=function(U){for(var N=U.length,D=[];N--;)D[N]=P.trak(U[N]);return P.box.apply(null,[P.types.moov,P.mvhd(U[0].timescale,U[0].duration)].concat(D).concat(P.mvex(U)))},P.mvex=function(U){for(var N=U.length,D=[];N--;)D[N]=P.trex(U[N]);return P.box.apply(null,[P.types.mvex].concat(D))},P.mvhd=function(U,N){N*=U;var D=Math.floor(N/(Z+1)),b=Math.floor(N%(Z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&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 P.box(P.types.mvhd,A)},P.sdtp=function(U){var N=U.samples||[],D=new Uint8Array(4+N.length),b,A;for(b=0;b<N.length;b++)A=N[b].flags,D[b+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,D)},P.stbl=function(U){return P.box(P.types.stbl,P.stsd(U),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(U){var N=[],D=[],b,A,k;for(b=0;b<U.sps.length;b++)A=U.sps[b],k=A.byteLength,N.push(k>>>8&255),N.push(k&255),N=N.concat(Array.prototype.slice.call(A));for(b=0;b<U.pps.length;b++)A=U.pps[b],k=A.byteLength,D.push(k>>>8&255),D.push(k&255),D=D.concat(Array.prototype.slice.call(A));var T=P.box(P.types.avcC,new Uint8Array([1,N[3],N[4],N[5],252|3,224|U.sps.length].concat(N).concat([U.pps.length]).concat(D))),C=U.width,E=U.height,d=U.pixelRatio[0],a=U.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C>>8&255,C&255,E>>8&255,E&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]),T,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,a>>24,a>>16&255,a>>8&255,a&255])))},P.esds=function(U){var N=U.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(U.config).concat([6,1,2]))},P.mp4a=function(U){var N=U.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,N>>8&255,N&255,0,0]),P.box(P.types.esds,P.esds(U)))},P.mp3=function(U){var N=U.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,N>>8&255,N&255,0,0]))},P.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(U)):P.box(P.types.stsd,P.STSD,P.mp4a(U)):P.box(P.types.stsd,P.STSD,P.avc1(U))},P.tkhd=function(U){var N=U.id,D=U.duration*U.timescale,b=U.width,A=U.height,k=Math.floor(D/(Z+1)),T=Math.floor(D%(Z+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,T>>24,T>>16&255,T>>8&255,T&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,A>>8&255,A&255,0,0]))},P.traf=function(U,N){var D=P.sdtp(U),b=U.id,A=Math.floor(N/(Z+1)),k=Math.floor(N%(Z+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,k>>24,k>>16&255,k>>8&255,k&255])),P.trun(U,D.length+16+20+8+16+8+8),D)},P.trak=function(U){return U.duration=U.duration||4294967295,P.box(P.types.trak,P.tkhd(U),P.mdia(U))},P.trex=function(U){var N=U.id;return P.box(P.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]))},P.trun=function(U,N){var D=U.samples||[],b=D.length,A=12+16*b,k=new Uint8Array(A),T,C,E,d,a,l;for(N+=8+A,k.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),T=0;T<b;T++)C=D[T],E=C.duration,d=C.size,a=C.flags,l=C.cts,k.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*T);return P.box(P.types.trun,k)},P.initSegment=function(U){P.types||P.init();var N=P.moov(U),D=new Uint8Array(P.FTYP.byteLength+N.byteLength);return D.set(P.FTYP),D.set(N,P.FTYP.byteLength),D},P}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,$.default=B},"./src/remux/mp4-remuxer.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return l}),R.d($,"normalizePts",function(){return h});var Z=R("./src/polyfills/number.ts"),B=R("./src/remux/aac-helper.ts"),P=R("./src/remux/mp4-generator.ts"),K=R("./src/events.ts"),U=R("./src/errors.ts"),N=R("./src/utils/logger.ts"),D=R("./src/types/loader.ts"),b=R("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(L){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(L[f]=c[f])}return L},A.apply(this,arguments)}var k=10*1e3,T=1024,C=1152,E=null,d=null,a=!1,l=function(){function L(c,f,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=c,this.config=f,this.typeSupported=u,this.ISGenerated=!1,E===null){var x=navigator.userAgent||"",v=x.match(/Chrome\/(\d+)/i);E=v?parseInt(v[1]):0}if(d===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);d=S?parseInt(S[1]):0}a=!!E&&E<75||!!d&&d<600}var y=L.prototype;return y.destroy=function(){},y.resetTimeStamp=function(f){N.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},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(f){var u=!1,o=f.reduce(function(x,v){var S=v.pts-x;return S<-4294967296?(u=!0,h(x,v.pts)):S>0?x:v.pts},f[0].pts);return u&&N.logger.debug("PTS rollover detected"),o},y.remux=function(f,u,o,x,v,S,M,j){var G,V,O,I,X,q,oe=v,ce=v,Le=f.pid>-1,Ee=u.pid>-1,we=u.samples.length,Te=f.samples.length>0,ye=we>1,fe=(!Le||Te)&&(!Ee||ye)||this.ISGenerated||M;if(fe){this.ISGenerated||(O=this.generateIS(f,u,v));var se=this.isVideoContiguous,te=-1;if(ye&&(te=_(u.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,te>0){N.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+we+" video samples due to a missing keyframe");var ue=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(te),u.dropped+=te,ce+=(u.samples[0].pts-ue)/(u.timescale||9e4)}else te===-1&&(N.logger.warn("[mp4-remuxer]: No keyframe found out of "+we+" video samples"),q=!1);if(this.ISGenerated){if(Te&&ye){var ne=this.getVideoStartPts(u.samples),_e=h(f.samples[0].pts,ne)-ne,Re=_e/u.inputTimeScale;oe+=Math.max(0,Re),ce+=Math.max(0,-Re)}if(Te){if(f.samplerate||(N.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(f,u,v)),V=this.remuxAudio(f,oe,this.isAudioContiguous,S,Ee||ye||j===D.PlaylistLevelType.AUDIO?ce:void 0),ye){var xe=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(N.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(f,u,v)),G=this.remuxVideo(u,ce,se,xe)}}else ye&&(G=this.remuxVideo(u,ce,se,0));G&&(G.firstKeyFrame=te,G.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,v)),x.samples.length&&(I=this.remuxText(x,v))),{audio:V,video:G,initSegment:O,independent:q,text:I,id3:X}},y.generateIS=function(f,u,o){var x=f.samples,v=u.samples,S=this.typeSupported,M={},j=!Object(Z.isFiniteNumber)(this._initPTS),G="audio/mp4",V,O,I;if(j&&(V=O=Infinity),f.config&&x.length&&(f.timescale=f.samplerate,f.isAAC||(S.mpeg?(G="audio/mpeg",f.codec=""):S.mp3&&(f.codec="mp3")),M.audio={id:"audio",container:G,codec:f.codec,initSegment:!f.isAAC&&S.mpeg?new Uint8Array(0):P.default.initSegment([f]),metadata:{channelCount:f.channelCount}},j&&(I=f.inputTimeScale,V=O=x[0].pts-Math.round(I*o))),u.sps&&u.pps&&v.length&&(u.timescale=u.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:P.default.initSegment([u]),metadata:{width:u.width,height:u.height}},j)){I=u.inputTimeScale;var X=this.getVideoStartPts(v),q=Math.round(I*o);O=Math.min(O,h(v[0].dts,X)-q),V=Math.min(V,X-q)}if(Object.keys(M).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=O),{tracks:M,initPTS:V,timescale:I}},y.remuxVideo=function(f,u,o,x){var v=f.inputTimeScale,S=f.samples,M=[],j=S.length,G=this._initPTS,V=this.nextAvcDts,O=8,I,X,q,oe=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,Le=0,Ee=!1;if(!o||V===null){var we=u*v,Te=S[0].pts-h(S[0].dts,S[0].pts);V=we-Te}for(var ye=0;ye<j;ye++){var fe=S[ye];if(fe.pts=h(fe.pts-G,V),fe.dts=h(fe.dts-G,V),fe.dts>fe.pts){var se=9e4*.2;Le=Math.max(Math.min(Le,fe.pts-fe.dts),-1*se)}fe.dts<S[ye>0?ye-1:ye].dts&&(Ee=!0)}Ee&&S.sort(function(wt,Ct){var dt=wt.dts-Ct.dts,Bt=wt.pts-Ct.pts;return dt||Bt}),X=S[0].dts,q=S[S.length-1].dts;var te=Math.round((q-X)/(j-1));if(Le<0){if(Le<te*-2){N.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-te,!0)+" ms");for(var ue=Le,ne=0;ne<j;ne++)S[ne].dts=ue=Math.max(ue,S[ne].pts-te),S[ne].pts=Math.max(ue,S[ne].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 _e=0;_e<j;_e++)S[_e].dts=S[_e].dts+Le}X=S[0].dts}if(o){var Re=X-V,xe=Re>te,ke=Re<-1;if(xe||ke){xe?N.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):N.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),X=V;var Ne=S[0].pts-Re;S[0].dts=X,S[0].pts=Ne,N.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(Ne,!0)+"/"+Object(b.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(Re,!0)+" ms")}}a&&(X=Math.max(0,X));for(var He=0,Fe=0,Me=0;Me<j;Me++){for(var Oe=S[Me],Ye=Oe.units,Ze=Ye.length,Ve=0,je=0;je<Ze;je++)Ve+=Ye[je].data.length;Fe+=Ve,He+=Ze,Oe.length=Ve,Oe.dts=Math.max(Oe.dts,X),Oe.pts=Math.max(Oe.pts,Oe.dts,0),oe=Math.min(Oe.pts,oe),ce=Math.max(Oe.pts,ce)}q=S[j-1].dts;var rt=Fe+4*He+8,Je;try{Je=new Uint8Array(rt)}catch(wt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var tt=new DataView(Je.buffer);tt.setUint32(0,rt),Je.set(P.default.types.mdat,4);for(var Pe=0;Pe<j;Pe++){for(var lt=S[Pe],at=lt.units,Be=0,Xe=0,Ce=at.length;Xe<Ce;Xe++){var ve=at[Xe],be=ve.data,ie=ve.data.byteLength;tt.setUint32(O,ie),O+=4,Je.set(be,O),O+=ie,Be+=4+ie}if(Pe<j-1)I=S[Pe+1].dts-lt.dts;else{var ae=this.config,de=lt.dts-S[Pe>0?Pe-1:Pe].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(ae.maxBufferHole*v),Se=(x?oe+x*v:this.nextAudioPts)-lt.pts;Se>me?(I=Se-de,I<0&&(I=de),N.logger.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=de}else I=de}var Ie=Math.round(lt.pts-lt.dts);M.push(new g(lt.key,I,Be,Ie))}if(M.length&&E&&E<70){var ze=M[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=q+I,this.isVideoContiguous=!0;var ot=P.default.moof(f.sequenceNumber++,X,A({},f,{samples:M})),gt="video",pt={data1:ot,data2:Je,startPTS:oe/v,endPTS:(ce+I)/v,startDTS:X/v,endDTS:V/v,type:gt,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),pt},y.remuxAudio=function(f,u,o,x,v){var S=f.inputTimeScale,M=f.samplerate?f.samplerate:S,j=S/M,G=f.isAAC?T:C,V=G*j,O=this._initPTS,I=!f.isAAC&&this.typeSupported.mpeg,X=[],q=f.samples,oe=I?0:8,ce=this.nextAudioPts||-1,Le=u*S;if(this.isAudioContiguous=o=o||q.length&&ce>0&&(x&&Math.abs(Le-ce)<9e3||Math.abs(h(q[0].pts-O,Le)-ce)<20*V),q.forEach(function(be){be.pts=h(be.pts-O,Le)}),!o||ce<0){if(q=q.filter(function(be){return be.pts>=0}),!q.length)return;v===0?ce=0:x?ce=Math.max(0,Le):ce=q[0].pts}if(f.isAAC)for(var Ee=v!==void 0,we=this.config.maxAudioFramesDrift,Te=0,ye=ce;Te<q.length;Te++){var fe=q[Te],se=fe.pts,te=se-ye,ue=Math.abs(1e3*te/S);if(te<=-we*V&&Ee)Te===0&&(N.logger.warn("Audio frame @ "+(se/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/S)+" ms."),this.nextAudioPts=ce=ye=se);else if(te>=we*V&&ue<k&&Ee){var ne=Math.round(te/V);ye=se-ne*V,ye<0&&(ne--,ye+=V),Te===0&&(this.nextAudioPts=ce=ye),N.logger.warn("[mp4-remuxer]: Injecting "+ne+" audio frame @ "+(ye/S).toFixed(3)+"s due to "+Math.round(1e3*te/S)+" ms gap.");for(var _e=0;_e<ne;_e++){var Re=Math.max(ye,0),xe=B.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);xe||(N.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=fe.unit.subarray()),q.splice(Te,0,{unit:xe,pts:Re}),ye+=V,Te++}}fe.pts=ye,ye+=V}for(var ke=null,Ne=null,He,Fe=0,Me=q.length;Me--;)Fe+=q[Me].unit.byteLength;for(var Oe=0,Ye=q.length;Oe<Ye;Oe++){var Ze=q[Oe],Ve=Ze.unit,je=Ze.pts;if(Ne!==null){var rt=X[Oe-1];rt.duration=Math.round((je-Ne)/j)}else if(o&&f.isAAC&&(je=ce),ke=je,Fe>0){Fe+=oe;try{He=new Uint8Array(Fe)}catch(be){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!I){var Je=new DataView(He.buffer);Je.setUint32(0,Fe),He.set(P.default.types.mdat,4)}}else return;He.set(Ve,oe);var tt=Ve.byteLength;oe+=tt,X.push(new g(!0,G,tt,0)),Ne=je}var Pe=X.length;if(!Pe)return;var lt=X[X.length-1];this.nextAudioPts=ce=Ne+j*lt.duration;var at=I?new Uint8Array(0):P.default.moof(f.sequenceNumber++,ke/j,A({},f,{samples:X}));f.samples=[];var Be=ke/S,Xe=ce/S,Ce="audio",ve={data1:at,data2:He,startPTS:Be,endPTS:Xe,startDTS:Be,endDTS:Xe,type:Ce,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(He.length,"MDAT length must not be zero"),ve},y.remuxEmptyAudio=function(f,u,o,x){var v=f.inputTimeScale,S=f.samplerate?f.samplerate:v,M=v/S,j=this.nextAudioPts,G=(j!==null?j:x.startDTS*v)+this._initDTS,V=x.endDTS*v+this._initDTS,O=M*T,I=Math.ceil((V-G)/O),X=B.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(N.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){N.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],oe=0;oe<I;oe++){var ce=G+oe*O;q.push({unit:X,pts:ce,dts:ce})}return f.samples=q,this.remuxAudio(f,u,o,!1)},y.remuxID3=function(f,u){var o=f.samples.length;if(!o)return;for(var x=f.inputTimeScale,v=this._initPTS,S=this._initDTS,M=0;M<o;M++){var j=f.samples[M];j.pts=h(j.pts-v,u*x)/x,j.dts=h(j.dts-S,u*x)/x}var G=f.samples;return f.samples=[],{samples:G}},y.remuxText=function(f,u){var o=f.samples.length;if(!o)return;for(var x=f.inputTimeScale,v=this._initPTS,S=0;S<o;S++){var M=f.samples[S];M.pts=h(M.pts-v,u*x)/x}f.samples.sort(function(G,V){return G.pts-V.pts});var j=f.samples;return f.samples=[],{samples:j}},L}();function h(L,y){var c;if(y===null)return L;for(y<L?c=-8589934592:c=8589934592;Math.abs(L-y)>4294967296;)L+=c;return L}function _(L){for(var y=0;y<L.length;y++)if(L[y].key)return y;return-1}var g=function(y,c,f,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,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(le,$,R){"use strict";R.r($);var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/mp4-tools.ts"),P=R("./src/loader/fragment.ts"),K=R("./src/utils/logger.ts"),U=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 A=b.prototype;return A.destroy=function(){},A.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(T,C,E){this.audioCodec=C,this.videoCodec=E,this.generateInitSegment(T),this.emitInitSegment=!0},A.generateInitSegment=function(T){var C=this.audioCodec,E=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(B.parseInitSegment)(T);C||(C=D(d.audio,P.ElementaryStreamTypes.AUDIO)),E||(E=D(d.video,P.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:C+","+E,initSegment:T,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:C,initSegment:T,id:"audio"}:d.video?a.video={container:"video/mp4",codec:E,initSegment:T,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},A.remux=function(T,C,E,d,a){var l=this.initPTS,h=this.lastEndDTS,_={audio:void 0,video:void 0,text:d,id3:E,initSegment:void 0};Object(Z.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var g=C.samples;if(!g||!g.length)return _;var m={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(g),L=this.initData),!L||!L.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),_;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=N(L,g,h));var y=Object(B.getDuration)(g,L),c=h,f=y+c;Object(B.offsetStartDTS)(L,g,l),y>0?this.lastEndDTS=f:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,o=!!L.video,x="";u&&(x+="audio"),o&&(x+="video");var v={data1:g,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:x,hasAudio:u,hasVideo:o,nb:1,dropped:0};return _.audio=v.type==="audio"?v:void 0,_.video=v.type!=="audio"?v:void 0,_.text=d,_.id3=E,_.initSegment=m,_},b}(),N=function(A,k,T){return Object(B.getStartDTS)(A,k)-T};function D(b,A){var k=b==null?void 0:b.codec;return k&&k.length>4?k:k==="hvc1"?"hvc1.1.c.L120.90":k==="av01"?"av01.0.04M.08":k==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=U},"./src/task-loop.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return Z});var Z=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=B.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},B}()},"./src/types/cmcd.ts":function(le,$,R){"use strict";R.r($),R.d($,"CMCDVersion",function(){return Z}),R.d($,"CMCDObjectType",function(){return B}),R.d($,"CMCDStreamingFormat",function(){return P}),R.d($,"CMCDStreamType",function(){return K});var Z=1,B;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(B||(B={}));var P;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(P||(P={}));var K;(function(U){U.VOD="v",U.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(le,$,R){"use strict";R.r($),R.d($,"HlsSkip",function(){return P}),R.d($,"getSkipValue",function(){return K}),R.d($,"HlsUrlParameters",function(){return U}),R.d($,"Level",function(){return N});function Z(D,b){for(var A=0;A<b.length;A++){var k=b[A];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(D,k.key,k)}}function B(D,b,A){return b&&Z(D.prototype,b),A&&Z(D,A),D}var P;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(P||(P={}));function K(D,b){var A=D.canSkipUntil,k=D.canSkipDateRanges,T=D.endSN,C=b!==void 0?b-T:0;return A&&C<A?k?P.v2:P.Yes:P.No}var U=function(){function D(A,k,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=k,this.skip=T}var b=D.prototype;return b.addDirectives=function(k){var T=new self.URL(k);return this.msn!==void 0&&T.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&T.searchParams.set("_HLS_part",this.part.toString()),this.skip&&T.searchParams.set("_HLS_skip",this.skip),T.toString()},D}(),N=function(){function D(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(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return B(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var k=A%this.url.length;this._urlId!==k&&(this.details=void 0,this._urlId=k)}}]),D}()},"./src/types/loader.ts":function(le,$,R){"use strict";R.r($),R.d($,"PlaylistContextType",function(){return Z}),R.d($,"PlaylistLevelType",function(){return B});var Z;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var B;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(le,$,R){"use strict";R.r($),R.d($,"ChunkMetadata",function(){return Z});var Z=function(K,U,N,D,b,A){D===void 0&&(D=0),b===void 0&&(b=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=K,this.sn=U,this.id=N,this.size=D,this.part=b,this.partial=A};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,$,R){"use strict";R.r($),R.d($,"AttrList",function(){return P});var Z=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function K(N){typeof N=="string"&&(N=K.parseAttrList(N));for(var D in N)N.hasOwnProperty(D)&&(this[D]=N[D])}var U=K.prototype;return U.decimalInteger=function(D){var b=parseInt(this[D],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.hexadecimalInteger=function(D){if(this[D]){var b=(this[D]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var A=new Uint8Array(b.length/2),k=0;k<b.length/2;k++)A[k]=parseInt(b.slice(k*2,k*2+2),16);return A}else return null},U.hexadecimalIntegerAsNumber=function(D){var b=parseInt(this[D],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},U.decimalFloatingPoint=function(D){return parseFloat(this[D])},U.optionalFloat=function(D,b){var A=this[D];return A?parseFloat(A):b},U.enumeratedString=function(D){return this[D]},U.bool=function(D){return this[D]==="YES"},U.decimalResolution=function(D){var b=Z.exec(this[D]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},K.parseAttrList=function(D){var b,A={},k='"';for(B.lastIndex=0;(b=B.exec(D))!==null;){var T=b[2];T.indexOf(k)===0&&T.lastIndexOf(k)===T.length-1&&(T=T.slice(1,-1)),A[b[1]]=T}return A},K}()},"./src/utils/binary-search.ts":function(le,$,R){"use strict";R.r($);var Z={search:function(P,K){for(var U=0,N=P.length-1,D=null,b=null;U<=N;){D=(U+N)/2|0,b=P[D];var A=K(b);if(A>0)U=D+1;else if(A<0)N=D-1;else return b}return null}};$.default=Z},"./src/utils/buffer-helper.ts":function(le,$,R){"use strict";R.r($),R.d($,"BufferHelper",function(){return P});var Z=R("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function K(){}return K.isBuffered=function(N,D){try{if(N){for(var b=K.getBuffered(N),A=0;A<b.length;A++)if(D>=b.start(A)&&D<=b.end(A))return!0}}catch(k){}return!1},K.bufferInfo=function(N,D,b){try{if(N){var A=K.getBuffered(N),k=[],T;for(T=0;T<A.length;T++)k.push({start:A.start(T),end:A.end(T)});return this.bufferedInfo(k,D,b)}}catch(C){}return{len:0,start:D,end:D,nextStart:void 0}},K.bufferedInfo=function(N,D,b){D=Math.max(0,D),N.sort(function(m,L){var y=m.start-L.start;return y||L.end-m.end});var A=[];if(b)for(var k=0;k<N.length;k++){var T=A.length;if(T){var C=A[T-1].end;N[k].start-C<b?N[k].end>C&&(A[T-1].end=N[k].end):A.push(N[k])}else A.push(N[k])}else A=N;for(var E=0,d,a=D,l=D,h=0;h<A.length;h++){var _=A[h].start,g=A[h].end;if(D+b>=_&&D<g)a=_,l=g,E=l-D;else if(D+b<_){d=_;break}}return{len:E,start:a||0,end:l||0,nextStart:d}},K.getBuffered=function(N){try{return N.buffered}catch(D){return Z.logger.log("failed to get media.buffered",D),B}},K}()},"./src/utils/cea-608-parser.ts":function(le,$,R){"use strict";R.r($),R.d($,"Row",function(){return l}),R.d($,"CaptionScreen",function(){return h});var Z=R("./src/utils/logger.ts"),B={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(f){var u=f;return B.hasOwnProperty(f)&&(u=B[f]),String.fromCharCode(u)},K=15,U=100,N={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={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},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},k=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(T||(T={}));var C=function(){function c(){this.time=null,this.verboseLevel=T.ERROR}var f=c.prototype;return f.log=function(o,x){this.verboseLevel>=o&&Z.logger.log(this.time+" ["+o+"] "+x)},c}(),E=function(f){for(var u=[],o=0;o<f.length;o++)u.push(f[o].toString(16));return u},d=function(){function c(u,o,x,v,S){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=x||!1,this.background=v||"black",this.flash=S||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(o){for(var x=["foreground","underline","italics","background","flash"],v=0;v<x.length;v++){var S=x[v];o.hasOwnProperty(S)&&(this[S]=o[S])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},f.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),a=function(){function c(u,o,x,v,S,M){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(o,x,v,S,M)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(o,x){this.uchar=o,this.penState.copy(x)},f.setPenState=function(o){this.penState.copy(o)},f.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},f.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),l=function(){function c(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<U;o++)this.chars.push(new a);this.logger=u,this.pos=0,this.currPenState=new d}var f=c.prototype;return f.equals=function(o){for(var x=!0,v=0;v<U;v++)if(!this.chars[v].equals(o.chars[v])){x=!1;break}return x},f.copy=function(o){for(var x=0;x<U;x++)this.chars[x].copy(o.chars[x])},f.isEmpty=function(){for(var o=!0,x=0;x<U;x++)if(!this.chars[x].isEmpty()){o=!1;break}return o},f.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},f.moveCursor=function(o){var x=this.pos+o;if(o>1)for(var v=this.pos+1;v<x+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(x)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(o){o>=144&&this.backSpace();var x=P(o);if(this.pos>=U){this.logger.log(T.ERROR,"Cannot insert "+o.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(o){var x;for(x=o;x<U;x++)this.chars[x].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var o=[],x=!0,v=0;v<U;v++){var S=this.chars[v].uchar;S!==" "&&(x=!1),o.push(S)}return x?"":o.join("")},f.setPenStyles=function(o){this.currPenState.setStyles(o);var x=this.chars[this.pos];x.setPenState(this.currPenState)},c}(),h=function(){function c(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 f=c.prototype;return f.reset=function(){for(var o=0;o<K;o++)this.rows[o].clear();this.currRow=K-1},f.equals=function(o){for(var x=!0,v=0;v<K;v++)if(!this.rows[v].equals(o.rows[v])){x=!1;break}return x},f.copy=function(o){for(var x=0;x<K;x++)this.rows[x].copy(o.rows[x])},f.isEmpty=function(){for(var o=!0,x=0;x<K;x++)if(!this.rows[x].isEmpty()){o=!1;break}return o},f.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},f.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},f.insertChar=function(o){var x=this.rows[this.currRow];x.insertChar(o)},f.setPen=function(o){var x=this.rows[this.currRow];x.setPenStyles(o)},f.moveCursor=function(o){var x=this.rows[this.currRow];x.moveCursor(o)},f.setCursor=function(o){this.logger.log(T.INFO,"setCursor: "+o);var x=this.rows[this.currRow];x.setCursor(o)},f.setPAC=function(o){this.logger.log(T.INFO,"pacData = "+JSON.stringify(o));var x=o.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var v=0;v<K;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var j=M.rows[S].cueStartTime,G=this.logger.time;if(j&&G!==null&&j<G)for(var V=0;V<this.nrRollUpRows;V++)this.rows[x-this.nrRollUpRows+V+1].copy(M.rows[S+V])}}this.currRow=x;var O=this.rows[this.currRow];if(o.indent!==null){var I=o.indent,X=Math.max(I-1,0);O.setCursor(o.indent),o.color=O.chars[X].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},f.setBkgData=function(o){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},f.setRollUpRows=function(o){this.nrRollUpRows=o},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(o,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(T.INFO,"Rolling up")},f.getDisplayText=function(o){o=o||!1;for(var x=[],v="",S=-1,M=0;M<K;M++){var j=this.rows[M].getTextString();j&&(S=M+1,o?x.push("Row "+S+": '"+j+"'"):x.push(j.trim()))}return x.length>0&&(o?v="["+x.join(" | ")+"]":v=x.join(`
`)),v},f.getTextAndFormat=function(){return this.rows},c}(),_=function(){function c(u,o,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new h(x),this.nonDisplayedMemory=new h(x),this.lastOutputScreen=new h(x),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var f=c.prototype;return f.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},f.getHandler=function(){return this.outputFilter},f.setHandler=function(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(T.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},f.insertChars=function(o){for(var x=0;x<o.length;x++)this.writeScreen.insertChar(o[x]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(o){this.logger.log(T.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},f.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(T.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(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(o){this.logger.log(T.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},f.ccMIDROW=function(o){var x={flash:!1};if(x.underline=o%2===1,x.italics=o>=46,x.italics)x.foreground="white";else{var v=Math.floor(o/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=S[v]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},f.outputDataUpdate=function(o){o===void 0&&(o=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},c}(),g=function(){function c(u,o,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new C;this.channels=[null,new _(u,o,v),new _(u+1,x,v)],this.cmdHistory=y(),this.logger=v}var f=c.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,x){this.channels[o].setHandler(x)},f.addData=function(o,x){var v,S,M,j=!1;this.logger.time=o;for(var G=0;G<x.length;G+=2){if(S=x[G]&127,M=x[G+1]&127,S===0&&M===0)continue;if(this.logger.log(T.DATA,"["+E([x[G],x[G+1]])+"] -> ("+E([S,M])+")"),v=this.parseCmd(S,M),v||(v=this.parseMidrow(S,M)),v||(v=this.parsePAC(S,M)),v||(v=this.parseBackgroundAttributes(S,M)),!v&&(j=this.parseChars(S,M),j)){var V=this.currentChannel;if(V&&V>0){var O=this.channels[V];O.insertChars(j)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!j&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+E([S,M])+" orig: "+E([x[G],x[G+1]]))}},f.parseCmd=function(o,x){var v=this.cmdHistory,S=(o===20||o===28||o===21||o===29)&&x>=32&&x<=47,M=(o===23||o===31)&&x>=33&&x<=35;if(!(S||M))return!1;if(L(o,x,v))return m(null,null,v),this.logger.log(T.DEBUG,"Repeated command ("+E([o,x])+") 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?x===32?G.ccRCL():x===33?G.ccBS():x===34?G.ccAOF():x===35?G.ccAON():x===36?G.ccDER():x===37?G.ccRU(2):x===38?G.ccRU(3):x===39?G.ccRU(4):x===40?G.ccFON():x===41?G.ccRDC():x===42?G.ccTR():x===43?G.ccRTD():x===44?G.ccEDM():x===45?G.ccCR():x===46?G.ccENM():x===47&&G.ccEOC():G.ccTO(x-32),m(o,x,v),this.currentChannel=j,!0},f.parseMidrow=function(o,x){var v=0;if((o===17||o===25)&&x>=32&&x<=47){if(o===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[v];return S?(S.ccMIDROW(x),this.logger.log(T.DEBUG,"MIDROW ("+E([o,x])+")"),!0):!1}return!1},f.parsePAC=function(o,x){var v,S=this.cmdHistory,M=(o>=17&&o<=23||o>=25&&o<=31)&&x>=64&&x<=127,j=(o===16||o===24)&&x>=64&&x<=95;if(!(M||j))return!1;if(L(o,x,S))return m(null,null,S),!0;var G=o<=23?1:2;x>=64&&x<=95?v=G===1?N[o]:b[o]:v=G===1?D[o]:A[o];var V=this.channels[G];return V?(V.setPAC(this.interpretPAC(v,x)),m(o,x,S),this.currentChannel=G,!0):!1},f.interpretPAC=function(o,x){var v,S={color:null,italics:!1,indent:null,underline:!1,row:o};return x>95?v=x-96:v=x-64,S.underline=(v&1)===1,v<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((v-16)/2)*4,S},f.parseChars=function(o,x){var v,S=null,M=null;if(o>=25?(v=2,M=o-8):(v=1,M=o),M>=17&&M<=19){var j;M===17?j=x+80:M===18?j=x+112:j=x+144,this.logger.log(T.INFO,"Special char '"+P(j)+"' in channel "+v),S=[j]}else o>=32&&o<=127&&(S=x===0?[o]:[o,x]);if(S){var G=E(S);this.logger.log(T.DEBUG,"Char codes = "+G.join(",")),m(o,x,this.cmdHistory)}return S},f.parseBackgroundAttributes=function(o,x){var v=(o===16||o===24)&&x>=32&&x<=47,S=(o===23||o===31)&&x>=45&&x<=47;if(!(v||S))return!1;var M,j={};o===16||o===24?(M=Math.floor((x-32)/2),j.background=k[M],x%2===1&&(j.background=j.background+"_semi")):x===45?j.background="transparent":(j.foreground="black",x===47&&(j.underline=!0));var G=o<=23?1:2,V=this.channels[G];return V.setBkgData(j),m(o,x,this.cmdHistory),!0},f.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var x=this.channels[o];x&&x.reset()}this.cmdHistory=y()},f.cueSplitAtTime=function(o){for(var x=0;x<this.channels.length;x++){var v=this.channels[x];v&&v.cueSplitAtTime(o)}},c}();function m(c,f,u){u.a=c,u.b=f}function L(c,f,u){return u.a===c&&u.b===f}function y(){return{a:null,b:null}}$.default=g},"./src/utils/codecs.ts":function(le,$,R){"use strict";R.r($),R.d($,"isCodecType",function(){return B}),R.d($,"isCodecSupportedInMp4",function(){return P});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function B(K,U){var N=Z[U];return!!N&&N[K.slice(0,4)]===!0}function P(K,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/utils/vttparser.ts"),B=R("./src/utils/webvtt-parser.ts"),P=R("./src/utils/texttrack-utils.ts"),K=/\s/,U={newCue:function(D,b,A,k){for(var T=[],C,E,d,a,l,h=self.VTTCue||self.TextTrackCue,_=0;_<k.rows.length;_++)if(C=k.rows[_],d=!0,a=0,l="",!C.isEmpty()){for(var g=0;g<C.chars.length;g++)K.test(C.chars[g].uchar)&&d?a++:(l+=C.chars[g].uchar,d=!1);C.cueStartTime=b,b===A&&(A+=1e-4),a>=16?a--:a++;var m=Object(Z.fixLineBreaks)(l.trim()),L=Object(B.generateCueId)(b,A,m);(!D||!D.cues||!D.cues.getCueById(L))&&(E=new h(b,A,m),E.id=L,E.line=_+1,E.align="left",E.position=10+Math.min(80,Math.floor(a*8/32)*10),T.push(E))}return D&&T.length&&(T.sort(function(y,c){return y.line==="auto"||c.line==="auto"?0:y.line>8&&c.line>8?c.line-y.line:y.line-c.line}),T.forEach(function(y){return Object(P.addCueToTrack)(D,y)})),T}};$.default=U},"./src/utils/discontinuities.ts":function(le,$,R){"use strict";R.r($),R.d($,"findFirstFragWithCC",function(){return K}),R.d($,"shouldAlignOnDiscontinuities",function(){return U}),R.d($,"findDiscontinuousReferenceFrag",function(){return N}),R.d($,"adjustSlidingStart",function(){return b}),R.d($,"alignStream",function(){return A}),R.d($,"alignPDT",function(){return T}),R.d($,"alignFragmentByPDTDelta",function(){return C}),R.d($,"alignMediaPlaylistByPDT",function(){return E});var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/logger.ts"),P=R("./src/controller/level-helper.ts");function K(d,a){for(var l=null,h=0,_=d.length;h<_;h++){var g=d[h];if(g&&g.cc===a){l=g;break}}return l}function U(d,a,l){return!!(a.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function N(d,a){var l=d.fragments,h=a.fragments;if(!h.length||!l.length){B.logger.log("No fragments to align");return}var _=K(l,h[0].cc);if(!_||_&&!_.startPTS){B.logger.log("No frag in previous level to align on");return}return _}function D(d,a){if(d){var l=d.start+a;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function b(d,a){for(var l=a.fragments,h=0,_=l.length;h<_;h++)D(l[h],d);a.fragmentHint&&D(a.fragmentHint,d),a.alignedSliding=!0}function A(d,a,l){if(!a)return;k(d,l,a),!l.alignedSliding&&a.details&&T(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(P.adjustSliding)(a.details,l)}function k(d,a,l){if(U(d,l,a)){var h=N(l.details,a);h&&Object(Z.isFiniteNumber)(h.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),b(h.start,a))}}function T(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=d.fragments[0].programDateTime,_=(h-l)/1e3+a.fragments[0].start;_&&Object(Z.isFiniteNumber)(_)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+_.toFixed(3)+" "+d.url+" "),b(_,d))}function C(d,a){var l=d.programDateTime;if(!l)return;var h=(l-a)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function E(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=a.fragments[0].start,_=l-h*1e3;d.fragments.forEach(function(g){C(g,_)}),d.fragmentHint&&C(d.fragmentHint,_),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/utils/ewma.ts"),B=function(){function P(U,N,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(U),this.fast_=new Z.default(N)}var K=P.prototype;return K.update=function(N,D){var b=this.slow_,A=this.fast_;this.slow_.halfLife!==N&&(this.slow_=new Z.default(N,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new Z.default(D,A.getEstimate(),A.getTotalWeight()))},K.sample=function(N,D){N=Math.max(N,this.minDelayMs_);var b=8*D,A=N/1e3,k=b/A;this.fast_.sample(A,k),this.slow_.sample(A,k)},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(){},P}();$.default=B},"./src/utils/ewma.ts":function(le,$,R){"use strict";R.r($);var Z=function(){function B(K,U,N){U===void 0&&(U=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_=U,this.totalWeight_=N}var P=B.prototype;return P.sample=function(U,N){var D=Math.pow(this.alpha_,U);this.estimate_=N*(1-D)+D*this.estimate_,this.totalWeight_+=U},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},B}();$.default=Z},"./src/utils/fetch-loader.ts":function(le,$,R){"use strict";R.r($),R.d($,"fetchSupported",function(){return C});var Z=R("./src/polyfills/number.ts"),B=R("./src/loader/load-stats.ts"),P=R("./src/demux/chunk-cache.ts");function K(h,_){h.prototype=Object.create(_.prototype),h.prototype.constructor=h,A(h,_)}function U(h){var _=typeof Map=="function"?new Map:void 0;return U=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 _!="undefined"){if(_.has(m))return _.get(m);_.set(m,L)}function L(){return N(m,arguments,k(this).constructor)}return L.prototype=Object.create(m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),A(L,m)},U(h)}function N(h,_,g){return D()?N=Reflect.construct:N=function(L,y,c){var f=[null];f.push.apply(f,y);var u=Function.bind.apply(L,f),o=new u;return c&&A(o,c.prototype),o},N.apply(null,arguments)}function D(){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 b(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function A(h,_){return A=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},A(h,_)}function k(h){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},k(h)}function T(){return T=Object.assign||function(h){for(var _=1;_<arguments.length;_++){var g=arguments[_];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(h[m]=g[m])}return h},T.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var E=function(){function h(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||a,this.controller=new self.AbortController,this.stats=new B.LoadStats}var _=h.prototype;return _.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},_.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},_.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},_.load=function(m,L,y){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var u=d(m,this.controller.signal),o=y.onProgress,x=m.responseType==="arraybuffer",v=x?"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(){c.abortInternal(),y.onTimeout(f,m,c.response)},L.timeout),self.fetch(this.request).then(function(S){if(c.response=c.loader=S,!S.ok){var M=S.status,j=S.statusText;throw new l(j||"fetch, bad network response",M,S)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(S.headers.get("Content-Length")||"0"),o&&Object(Z.isFiniteNumber)(L.highWaterMark)?c.loadProgressively(S,f,m,L.highWaterMark,o):x?S.arrayBuffer():S.text()}).then(function(S){var M=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=S[v];var j={url:M.url,data:S};o&&!Object(Z.isFiniteNumber)(L.highWaterMark)&&o(f,m,S,M),y.onSuccess(j,f,m,M)}).catch(function(S){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var M=S.code||0;y.onError({code:M,text:S.message},m,S.details)})},_.getCacheAge=function(){var m=null;if(this.response){var L=this.response.headers.get("age");m=L?parseFloat(L):null}return m},_.loadProgressively=function(m,L,y,c,f){c===void 0&&(c=0);var u=new P.default,o=m.body.getReader(),x=function v(){return o.read().then(function(S){if(S.done)return u.dataLength&&f(L,y,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var M=S.value,j=M.length;return L.loaded+=j,j<c||u.dataLength?(u.push(M),u.dataLength>=c&&f(L,y,u.flush(),m)):f(L,y,M,m),v()}).catch(function(){return Promise.reject()})};return x()},h}();function d(h,_){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(T({},h.headers))};return h.rangeEnd&&g.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),g}function a(h,_){return new self.Request(h.url,_)}var l=function(h){K(_,h);function _(g,m,L){var y;return y=h.call(this,g)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=L,y}return _}(U(Error));$.default=E},"./src/utils/imsc1-ttml-parser.ts":function(le,$,R){"use strict";R.r($),R.d($,"IMSC1_CODEC",function(){return b}),R.d($,"parseIMSC1",function(){return C});var Z=R("./src/utils/mp4-tools.ts"),B=R("./src/utils/vttparser.ts"),P=R("./src/utils/vttcue.ts"),K=R("./src/demux/id3.ts"),U=R("./src/utils/timescale-conversion.ts"),N=R("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var u=arguments[f];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(c[o]=u[o])}return c},D.apply(this,arguments)}var b="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,k=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(c,f,u,o,x){var v=Object(Z.findBox)(new Uint8Array(c),["mdat"]);if(v.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var S=v[0],M=Object(K.utf8ArrayToStr)(new Uint8Array(c,S.start,S.end-S.start)),j=Object(U.toTimescaleFromScale)(f,1,u);try{o(E(M,j))}catch(G){x(G)}}function E(c,f){var u=new DOMParser,o=u.parseFromString(c,"text/xml"),x=o.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(v).reduce(function(O,I){return O[I]=x.getAttribute("ttp:"+I)||v[I],O},{}),M=x.getAttribute("xml:space")!=="preserve",j=a(d(x,"styling","style")),G=a(d(x,"layout","region")),V=d(x,"body","[begin]");return[].map.call(V,function(O){var I=l(O,M);if(!I||!O.hasAttribute("begin"))return null;var X=m(O.getAttribute("begin"),S),q=m(O.getAttribute("dur"),S),oe=m(O.getAttribute("end"),S);if(X===null)throw g(O);if(oe===null){if(q===null)throw g(O);oe=X+q}var ce=new P.default(X-f,oe-f,I);ce.id=Object(N.generateCueId)(ce.startTime,ce.endTime,ce.text);var Le=G[O.getAttribute("region")],Ee=j[O.getAttribute("style")];ce.position=10,ce.size=80;var we=h(Le,Ee),Te=we.textAlign;if(Te){var ye=T[Te];ye&&(ce.lineAlign=ye),ce.align=Te}return D(ce,we),ce}).filter(function(O){return O!==null})}function d(c,f,u){var o=c.getElementsByTagName(f)[0];return o?[].slice.call(o.querySelectorAll(u)):[]}function a(c){return c.reduce(function(f,u){var o=u.getAttribute("xml:id");return o&&(f[o]=u),f},{})}function l(c,f){return[].slice.call(c.childNodes).reduce(function(u,o,x){var v;return o.nodeName==="br"&&x?u+`
`:(v=o.childNodes)!==null&&v!==void 0&&v.length?l(o,f):f?u+o.textContent.trim().replace(/\s+/g," "):u+o.textContent},"")}function h(c,f){var u="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(x,v){var S=_(f,u,v)||_(c,u,v);return S&&(x[v]=S),x},{})}function _(c,f,u){return c.hasAttributeNS(f,u)?c.getAttributeNS(f,u):null}function g(c){return new Error("Could not parse ttml timestamp "+c)}function m(c,f){if(!c)return null;var u=Object(B.parseTimeStamp)(c);return u===null&&(A.test(c)?u=L(c,f):k.test(c)&&(u=y(c,f))),u}function L(c,f){var u=A.exec(c),o=(u[4]|0)+(u[5]|0)/f.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+o/f.frameRate}function y(c,f){var u=k.exec(c),o=Number(u[1]),x=u[2];switch(x){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/f.frameRate;case"t":return o/f.tickRate}return o}},"./src/utils/logger.ts":function(le,$,R){"use strict";R.r($),R.d($,"enableLogs",function(){return N}),R.d($,"logger",function(){return D});var Z=function(){},B={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},P=B;function K(b){var A=self.console[b];return A?A.bind(self.console,"["+b+"] >"):Z}function U(b){for(var A=arguments.length,k=new Array(A>1?A-1:0),T=1;T<A;T++)k[T-1]=arguments[T];k.forEach(function(C){P[C]=b[C]?b[C].bind(b):K(C)})}function N(b){if(self.console&&b===!0||typeof b=="object"){U(b,"debug","log","info","warn","error");try{P.log()}catch(A){P=B}}else P=B}var D=P},"./src/utils/mediakeys-helper.ts":function(le,$,R){"use strict";R.r($),R.d($,"KeySystems",function(){return Z}),R.d($,"requestMediaKeySystemAccess",function(){return B});var Z;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,$,R){"use strict";R.r($),R.d($,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,$,R){"use strict";R.r($),R.d($,"bin2str",function(){return U}),R.d($,"readUint16",function(){return N}),R.d($,"readUint32",function(){return D}),R.d($,"writeUint32",function(){return b}),R.d($,"findBox",function(){return A}),R.d($,"parseSegmentIndex",function(){return k}),R.d($,"parseInitSegment",function(){return T}),R.d($,"getStartDTS",function(){return C}),R.d($,"getDuration",function(){return E}),R.d($,"computeRawDurationFromSamples",function(){return d}),R.d($,"offsetStartDTS",function(){return a}),R.d($,"segmentValidRange",function(){return l}),R.d($,"appendUint8Array",function(){return h});var Z=R("./src/utils/typed-array.ts"),B=R("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,K=[].push;function U(_){return String.fromCharCode.apply(null,_)}function N(_,g){"data"in _&&(g+=_.start,_=_.data);var m=_[g]<<8|_[g+1];return m<0?65536+m:m}function D(_,g){"data"in _&&(g+=_.start,_=_.data);var m=_[g]<<24|_[g+1]<<16|_[g+2]<<8|_[g+3];return m<0?4294967296+m:m}function b(_,g,m){"data"in _&&(g+=_.start,_=_.data),_[g]=m>>24,_[g+1]=m>>16&255,_[g+2]=m>>8&255,_[g+3]=m&255}function A(_,g){var m=[];if(!g.length)return m;var L,y,c;"data"in _?(L=_.data,y=_.start,c=_.end):(L=_,y=0,c=L.byteLength);for(var f=y;f<c;){var u=D(L,f),o=U(L.subarray(f+4,f+8)),x=u>1?f+u:c;if(o===g[0])if(g.length===1)m.push({data:L,start:f+8,end:x});else{var v=A({data:L,start:f+8,end:x},g.slice(1));v.length&&K.apply(m,v)}f=x}return m}function k(_){var g=A(_,["moov"]),m=g[0],L=m?m.end:null,y=A(_,["sidx"]);if(!y||!y[0])return null;var c=[],f=y[0],u=f.data[0],o=u===0?8:16,x=D(f,o);o+=4;var v=0,S=0;u===0?o+=8:o+=16,o+=2;var M=f.end+S,j=N(f,o);o+=2;for(var G=0;G<j;G++){var V=o,O=D(f,V);V+=4;var I=O&2147483647,X=(O&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=D(f,V);V+=4,c.push({referenceSize:I,subsegmentDuration:q,info:{duration:q/x,start:M,end:M+I-1}}),M+=I,V+=4,o=V}return{earliestPresentationTime:v,timescale:x,version:u,referencesCount:j,references:c,moovEndOffset:L}}function T(_){for(var g=[],m=A(_,["moov","trak"]),L=0;L<m.length;L++){var y=m[L],c=A(y,["tkhd"])[0];if(c){var f=c.data[c.start],u=f===0?12:20,o=D(c,u),x=A(y,["mdia","mdhd"])[0];if(x){f=x.data[x.start],u=f===0?12:20;var v=D(x,u),S=A(y,["mdia","hdlr"])[0];if(S){var M=U(S.data.subarray(S.start+8,S.start+12)),j={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[M];if(j){var G=A(y,["mdia","minf","stbl","stsd"])[0],V=void 0;G&&(V=U(G.data.subarray(G.start+12,G.start+16))),g[o]={timescale:v,type:j},g[j]={timescale:v,id:o,codec:V}}}}}}var O=A(_,["moov","mvex","trex"]);return O.forEach(function(I){var X=D(I,4),q=g[X];q&&(q.default={duration:D(I,12),flags:D(I,20)})}),g}function C(_,g){return A(g,["moof","traf"]).reduce(function(m,L){var y=A(L,["tfdt"])[0],c=y.data[y.start],f=A(L,["tfhd"]).reduce(function(u,o){var x=D(o,4),v=_[x];if(v){var S=D(y,4);c===1&&(S*=Math.pow(2,32),S+=D(y,8));var M=v.timescale||9e4,j=S/M;if(isFinite(j)&&(u===null||j<u))return j}return u},null);return f!==null&&isFinite(f)&&(m===null||f<m)?f:m},null)||0}function E(_,g){for(var m=0,L=0,y=0,c=A(_,["moof","traf"]),f=0;f<c.length;f++){var u=c[f],o=A(u,["tfhd"])[0],x=D(o,4),v=g[x];if(!v)continue;var S=v.default,M=D(o,0)|(S==null?void 0:S.flags),j=S==null?void 0:S.duration;M&8&&(M&2?j=D(o,12):j=D(o,8));for(var G=v.timescale||9e4,V=A(u,["trun"]),O=0;O<V.length;O++){if(j){var I=D(V[O],4);m=j*I}else m=d(V[O]);v.type===B.ElementaryStreamTypes.VIDEO?L+=m/G:v.type===B.ElementaryStreamTypes.AUDIO&&(y+=m/G)}}if(L===0&&y===0){var X=k(_);if(X!=null&&X.references)return X.references.reduce(function(q,oe){return q+oe.info.duration||0},0)}return L||y}function d(_){var g=D(_,0),m=8;g&1&&(m+=4),g&4&&(m+=4);for(var L=0,y=D(_,4),c=0;c<y;c++){if(g&256){var f=D(_,m);L+=f,m+=4}g&512&&(m+=4),g&1024&&(m+=4),g&2048&&(m+=4)}return L}function a(_,g,m){A(g,["moof","traf"]).forEach(function(L){A(L,["tfhd"]).forEach(function(y){var c=D(y,4),f=_[c];if(!f)return;var u=f.timescale||9e4;A(L,["tfdt"]).forEach(function(o){var x=o.data[o.start],v=D(o,4);if(x===0)b(o,4,v-m*u);else{v*=Math.pow(2,32),v+=D(o,8),v-=m*u,v=Math.max(v,0);var S=Math.floor(v/(P+1)),M=Math.floor(v%(P+1));b(o,4,S),b(o,8,M)}})})})}function l(_){var g={valid:null,remainder:null},m=A(_,["moof"]);if(m){if(m.length<2)return g.remainder=_,g}else return g;var L=m[m.length-1];return g.valid=Object(Z.sliceUint8)(_,0,L.start-8),g.remainder=Object(Z.sliceUint8)(_,L.start-8),g}function h(_,g){var m=new Uint8Array(_.length+g.length);return m.set(_),m.set(g,_.length),m}},"./src/utils/output-filter.ts":function(le,$,R){"use strict";R.r($),R.d($,"default",function(){return Z});var Z=function(){function B(K,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=U}var P=B.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(U,N,D){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=N,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(le,$,R){"use strict";R.r($),R.d($,"sendAddTrackEvent",function(){return B}),R.d($,"addCueToTrack",function(){return P}),R.d($,"clearCurrentCues",function(){return K}),R.d($,"removeCuesInRange",function(){return U}),R.d($,"getCuesInRange",function(){return D});var Z=R("./src/utils/logger.ts");function B(b,A){var k;try{k=new Event("addtrack")}catch(T){k=document.createEvent("Event"),k.initEvent("addtrack",!1,!1)}k.track=b,A.dispatchEvent(k)}function P(b,A){var k=b.mode;if(k==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(A.id))try{if(b.addCue(A),!b.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(C){Z.logger.debug("[texttrack-utils]: "+C);var T=new self.TextTrackCue(A.startTime,A.endTime,A.text);T.id=A.id,b.addCue(T)}k==="disabled"&&(b.mode=k)}function K(b){var A=b.mode;if(A==="disabled"&&(b.mode="hidden"),b.cues)for(var k=b.cues.length;k--;)b.removeCue(b.cues[k]);A==="disabled"&&(b.mode=A)}function U(b,A,k){var T=b.mode;if(T==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var C=D(b.cues,A,k),E=0;E<C.length;E++)b.removeCue(C[E]);T==="disabled"&&(b.mode=T)}function N(b,A){if(A<b[0].startTime)return 0;var k=b.length-1;if(A>b[k].endTime)return-1;for(var T=0,C=k;T<=C;){var E=Math.floor((C+T)/2);if(A<b[E].startTime)C=E-1;else if(A>b[E].startTime&&T<k)T=E+1;else return E}return b[T].startTime-A<A-b[C].startTime?T:C}function D(b,A,k){var T=[],C=N(b,A);if(C>-1)for(var E=C,d=b.length;E<d;E++){var a=b[E];if(a.startTime>=A&&a.endTime<=k)T.push(a);else if(a.startTime>k)return T}return T}},"./src/utils/time-ranges.ts":function(le,$,R){"use strict";R.r($);var Z={toString:function(P){for(var K="",U=P.length,N=0;N<U;N++)K+="["+P.start(N).toFixed(3)+","+P.end(N).toFixed(3)+"]";return K}};$.default=Z},"./src/utils/timescale-conversion.ts":function(le,$,R){"use strict";R.r($),R.d($,"toTimescaleFromBase",function(){return B}),R.d($,"toTimescaleFromScale",function(){return P}),R.d($,"toMsFromMpegTsClock",function(){return K}),R.d($,"toMpegTsClockFromTimescale",function(){return U});var Z=9e4;function B(N,D,b,A){b===void 0&&(b=1),A===void 0&&(A=!1);var k=N*D*b;return A?Math.round(k):k}function P(N,D,b,A){return b===void 0&&(b=1),A===void 0&&(A=!1),B(N,D,1/b,A)}function K(N,D){return D===void 0&&(D=!1),B(N,1e3,1/Z,D)}function U(N,D){return D===void 0&&(D=1),B(N,Z,1/D)}},"./src/utils/typed-array.ts":function(le,$,R){"use strict";R.r($),R.d($,"sliceUint8",function(){return Z});function Z(B,P,K){return Uint8Array.prototype.slice?B.slice(P,K):new Uint8Array(Array.prototype.slice.call(B,P,K))}},"./src/utils/vttcue.ts":function(le,$,R){"use strict";R.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],B=["start","middle","end","left","right"];function P(b,A){if(typeof A!="string")return!1;if(!Array.isArray(b))return!1;var k=A.toLowerCase();return~b.indexOf(k)?k:!1}function K(b){return P(Z,b)}function U(b){return P(B,b)}function N(b){for(var A=arguments.length,k=new Array(A>1?A-1:0),T=1;T<A;T++)k[T-1]=arguments[T];for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var d in E)b[d]=E[d]}return b}function D(b,A,k){var T=this,C={enumerable:!0};T.hasBeenReset=!1;var E="",d=!1,a=b,l=A,h=k,_=null,g="",m=!0,L="auto",y="start",c=50,f="middle",u=50,o="middle";Object.defineProperty(T,"id",N({},C,{get:function(){return E},set:function(v){E=""+v}})),Object.defineProperty(T,"pauseOnExit",N({},C,{get:function(){return d},set:function(v){d=!!v}})),Object.defineProperty(T,"startTime",N({},C,{get:function(){return a},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");a=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",N({},C,{get:function(){return l},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",N({},C,{get:function(){return h},set:function(v){h=""+v,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",N({},C,{get:function(){return _},set:function(v){_=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",N({},C,{get:function(){return g},set:function(v){var S=K(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",N({},C,{get:function(){return m},set:function(v){m=!!v,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",N({},C,{get:function(){return L},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",N({},C,{get:function(){return y},set:function(v){var S=U(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");y=S,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",N({},C,{get:function(){return c},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",N({},C,{get:function(){return f},set:function(v){var S=U(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");f=S,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",N({},C,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",N({},C,{get:function(){return o},set:function(v){var S=U(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");o=S,this.hasBeenReset=!0}})),T.displayState=void 0}return D.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(le,$,R){"use strict";R.r($),R.d($,"parseTimeStamp",function(){return P}),R.d($,"fixLineBreaks",function(){return A}),R.d($,"VTTParser",function(){return k});var Z=R("./src/utils/vttcue.ts"),B=function(){function T(){}var C=T.prototype;return C.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},T}();function P(T){function C(d,a,l,h){return(d|0)*3600+(a|0)*60+(l|0)+parseFloat(h||0)}var E=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?C(E[2],E[3],0,E[4]):C(E[1],E[2],E[3],E[4]):null}var K=function(){function T(){this.values=Object.create(null)}var C=T.prototype;return C.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},C.get=function(d,a,l){return l?this.has(d)?this.values[d]:a[l]:this.has(d)?this.values[d]:a},C.has=function(d){return d in this.values},C.alt=function(d,a,l){for(var h=0;h<l.length;++h)if(a===l[h]){this.set(d,a);break}},C.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},C.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},T}();function U(T,C,E,d){var a=d?T.split(d):[T];for(var l in a){if(typeof a[l]!="string")continue;var h=a[l].split(E);if(h.length!==2)continue;var _=h[0],g=h[1];C(_,g)}}var N=new Z.default(0,0,""),D=N.align==="middle"?"middle":"center";function b(T,C,E){var d=T;function a(){var _=P(T);if(_===null)throw new Error("Malformed timestamp: "+d);return T=T.replace(/^[^\sa-zA-Z-]+/,""),_}function l(_,g){var m=new K;U(_,function(c,f){var u;switch(c){case"region":for(var o=E.length-1;o>=0;o--)if(E[o].id===f){m.set(c,E[o].region);break}break;case"vertical":m.alt(c,f,["rl","lr"]);break;case"line":u=f.split(","),m.integer(c,u[0]),m.percent(c,u[0])&&m.set("snapToLines",!1),m.alt(c,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",D,"end"]);break;case"position":u=f.split(","),m.percent(c,u[0]),u.length===2&&m.alt("positionAlign",u[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":m.percent(c,f);break;case"align":m.alt(c,f,["start",D,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var L=m.get("line","auto");L==="auto"&&N.line===-1&&(L=-1),g.line=L,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",D);var y=m.get("position","auto");y==="auto"&&N.position===50&&(y=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=y}function h(){T=T.replace(/^\s+/,"")}if(h(),C.startTime=a(),h(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);T=T.substr(3),h(),C.endTime=a(),h(),l(T,C)}function A(T){return T.replace(/<br(?: \/)?>/gi,`
`)}var k=function(){function T(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var C=T.prototype;return C.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function l(){var y=a.buffer,c=0;for(y=A(y);c<y.length&&y[c]!=="\r"&&y[c]!==`
`;)++c;var f=y.substr(0,c);return y[c]==="\r"&&++c,y[c]===`
`&&++c,a.buffer=y.substr(c),f}function h(y){U(y,function(c,f){},/:/)}try{var _="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;_=l();var g=_.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[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:_=l();switch(a.state){case"HEADER":/:/.test(_)?h(_):_||(a.state="ID");continue;case"NOTE":_||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(_)){a.state="NOTE";break}if(!_)continue;if(a.cue=new Z.default(0,0,""),a.state="CUE",_.indexOf("-->")===-1){a.cue.id=_;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{b(_,a.cue,a.regionList)}catch(y){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var L=_.indexOf("-->")!==-1;if(!_||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+=_}continue;case"BADCUE":_||(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},C.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(le,$,R){"use strict";R.r($),R.d($,"generateCueId",function(){return k}),R.d($,"parseWebVTT",function(){return C});var Z=R("./src/polyfills/number.ts"),B=R("./src/utils/vttparser.ts"),P=R("./src/demux/id3.ts"),K=R("./src/utils/timescale-conversion.ts"),U=R("./src/remux/mp4-remuxer.ts"),N=/\r\n|\n\r|\n|\r/g,D=function(d,a,l){return l===void 0&&(l=0),d.substr(l,a.length)===a},b=function(d){var a=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),_=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(a)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(h)||!Object(Z.isFiniteNumber)(_))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*l,a+=60*1e3*h,a+=60*60*1e3*_,a},A=function(d){for(var a=5381,l=d.length;l;)a=a*33^d.charCodeAt(--l);return(a>>>0).toString()};function k(E,d,a){return A(E.toString())+A(d.toString())+A(a)}var T=function(d,a,l){var h=d[a],_=d[h.prevCC];if(!_||!_.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(g=_)!==null&&g!==void 0&&g.new;){var g;d.ccOffset+=h.start-_.start,h.new=!1,h=_,_=d[h.prevCC]}d.presentationOffset=l};function C(E,d,a,l,h,_,g,m){var L=new B.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(N,`
`).split(`
`),c=[],f=Object(K.toMpegTsClockFromTimescale)(d,a),u="00:00.000",o=0,x=0,v,S=!0,M=!1;L.oncue=function(j){var G=l[h],V=l.ccOffset,O=(o-f)/9e4;if(G!=null&&G.new&&(x!==void 0?V=l.ccOffset=G.start:T(l,h,O)),O&&(V=O-l.presentationOffset),M){var I=j.endTime-j.startTime,X=Object(U.normalizePts)((j.startTime+V-x)*9e4,_*9e4)/9e4;j.startTime=X,j.endTime=X+I}var q=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(q)),j.id||(j.id=k(j.startTime,j.endTime,q)),j.endTime>0&&c.push(j)},L.onparsingerror=function(j){v=j},L.onflush=function(){if(v){m(v);return}g(c)},y.forEach(function(j){if(S)if(D(j,"X-TIMESTAMP-MAP=")){S=!1,M=!0,j.substr(16).split(",").forEach(function(G){D(G,"LOCAL:")?u=G.substr(6):D(G,"MPEGTS:")&&(o=parseInt(G.substr(7)))});try{x=b(u)/1e3}catch(G){M=!1,v=G}return}else j===""&&(S=!1);L.parse(j+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(le,$,R){"use strict";R.r($);var Z=R("./src/utils/logger.ts"),B=R("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,K=function(){function U(D){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=D?D.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var N=U.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,A,k){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=A,this.callbacks=k,this.retryDelay=A.retryDelay,this.loadInternal()},N.loadInternal=function(){var b=this.config,A=this.context;if(!b)return;var k=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var C=this.xhrSetup;try{if(C)try{C(k,A.url)}catch(a){k.open("GET",A.url,!0),C(k,A.url)}k.readyState||k.open("GET",A.url,!0);var E=this.context.headers;if(E)for(var d in E)k.setRequestHeader(d,E[d])}catch(a){this.callbacks.onError({code:k.status,text:a.message},A,k);return}A.rangeEnd&&k.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),k.onreadystatechange=this.readystatechange.bind(this),k.onprogress=this.loadprogress.bind(this),k.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),k.send()},N.readystatechange=function(){var b=this.context,A=this.loader,k=this.stats;if(!b||!A)return;var T=A.readyState,C=this.config;if(k.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),k.loading.first===0&&(k.loading.first=Math.max(self.performance.now(),k.loading.start)),T===4){A.onreadystatechange=null,A.onprogress=null;var E=A.status;if(E>=200&&E<300){k.loading.end=Math.max(self.performance.now(),k.loading.first);var d,a;if(b.responseType==="arraybuffer"?(d=A.response,a=d.byteLength):(d=A.responseText,a=d.length),k.loaded=k.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(k,b,d,A),!this.callbacks)return;var h={url:A.responseURL,data:d};this.callbacks.onSuccess(h,k,b,A)}else k.retry>=C.maxRetry||E>=400&&E<499?(Z.logger.error(E+" while loading "+b.url),this.callbacks.onError({code:E,text:A.statusText},b,A)):(Z.logger.warn(E+" 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,C.maxRetryDelay),k.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.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 A=this.stats;A.loaded=b.loaded,b.lengthComputable&&(A.total=b.total)},N.getCacheAge=function(){var b=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");b=A?parseFloat(A):null}return b},U}();$.default=K}}).default})},vHTk:function(ht,Qe,re){ht.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ht,Qe,re){"use strict";re.d(Qe,"c",function(){return B}),re.d(Qe,"b",function(){return P}),re.d(Qe,"d",function(){return K}),re.d(Qe,"a",function(){return N}),re.d(Qe,"e",function(){return D});var le=re("9og8"),$=re("WmNS"),R=re.n($),Z=re("ErOA");function B(b){return Object(Z.c)("libraries/".concat(b,".json"))}function P(){return Object(Z.c)("library_tags.json")}function K(b){return U.apply(this,arguments)}function U(){return U=Object(le.a)(R.a.mark(function b(A){var k;return R.a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,Object(Z.b)("attachments/".concat(A,".json"));case 2:return k=C.sent,C.abrupt("return",k.status===0);case 4:case"end":return C.stop()}},b)})),U.apply(this,arguments)}function N(b){return Object(Z.f)("libraries.json",b)}function D(b,A){return Object(Z.g)("libraries/".concat(b,".json"),A)}},y5JW:function(ht,Qe,re){"use strict";re.d(Qe,"c",function(){return E}),re.d(Qe,"a",function(){return d});var le=re("DZo9"),$=re("8z0m"),R=re("+L6B"),Z=re("2/Rp"),B=re("9og8"),P=re("miYZ"),K=re("tsqr"),U=re("k1fw"),N=re("oBTY"),D=re("WmNS"),b=re.n(D),A=re("q1tI"),k=re.n(A),T=re("m3rI"),C=re("wzkS"),E="\u3000\u3000";function d(a){var l=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var h=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,h)).toFixed(1)+" "+l[h]}Qe.b=function(a){var l=a.value,h=l===void 0?[]:l,_=a.action,g=a.onChange,m=a.className,L=a.maxSize,y=L===void 0?150:L,c=a.title,f=c===void 0?"\u6587\u4EF6\u4E0A\u4F20":c,u=a.accept,o=u===void 0?null:u,x={multiple:!1,fileList:h,accept:o,withCredentials:!0,beforeUpload:function(M){var j=M.size/1024/1024;return!0},action:"".concat(T.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var j,G,V=Object(N.a)(M.fileList);if(V=V.map(function(X){return X.name.indexOf(E)===-1&&(X.name="".concat(X.name).concat(E).concat(d(X.size))),Object(U.a)({},X)}),M.file.status==="done"&&((j=M.file)===null||j===void 0||((G=j.response)===null||G===void 0)?void 0:G.status)===-1){var O,I;K.b.error((O=M.file)===null||O===void 0||((I=O.response)===null||I===void 0)?void 0:I.message),g([]);return}g(V)},onRemove:function(){var S=Object(B.a)(b.a.mark(function j(G){var V,O,I;return b.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(V=G.size/1024/1024,!(G.status==="uploading")){q.next=3;break}return q.abrupt("return",!0);case 3:if(V<y){q.next=7;break}return q.abrupt("return",!0);case 7:if(O=G.response?G.response.id:G.uid,!O){q.next=15;break}return q.next=11,Object(C.d)(G.response?G.response.id:G.id);case 11:return I=q.sent,q.abrupt("return",I);case 15:return q.abrupt("return",!0);case 16:case"end":return q.stop()}},j)}));function M(j){return S.apply(this,arguments)}return M}()};function v(S){S.preventDefault(),S.stopPropagation()}return k.a.createElement("div",{className:"single-upload ".concat(m||"")},k.a.createElement($.a,x,k.a.createElement(Z.a,{type:"primary",title:h.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:h.length>0,ghost:!0},f),k.a.createElement("span",{onClick:v,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",y,"M)"," ")))}},"yTi+":function(ht,Qe,re){ht.exports=re.p+"static/AssistantCode3.fdd8db3c.jpeg"}}]);