(window.webpackJsonp=window.webpackJsonp||[]).push([[177,6,7,8,11],{"+NIl":function(ht,$e,ue){(function(fe){fe(ue("VrN/"))})(function(fe){"use strict";fe.defineMode("stex",function(Z,O){"use strict";function J(L,A){L.cmdState.push(A)}function U(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function k(L){var A=L.cmdState.pop();A&&A.closeBracket()}function G(L){for(var A=L.cmdState,S=A.length-1;S>=0;S--){var d=A[S];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function H(L,A,S){return function(){this.name=L,this.bracketNo=0,this.style=A,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var F={};F.importmodule=H("importmodule","tag",["string","builtin"]),F.documentclass=H("documentclass","tag",["","atom"]),F.usepackage=H("usepackage","tag",["atom"]),F.begin=H("begin","tag",["atom"]),F.end=H("end","tag",["atom"]),F.label=H("label","tag",["atom"]),F.ref=H("ref","tag",["atom"]),F.eqref=H("eqref","tag",["atom"]),F.cite=H("cite","tag",["atom"]),F.bibitem=H("bibitem","tag",["atom"]),F.Bibitem=H("Bibitem","tag",["atom"]),F.RBibitem=H("RBibitem","tag",["atom"]),F.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(L,A){L.f=A}function E(L,A){var S;if(L.match(/^\\[a-zA-Z@]+/)){var d=L.current().slice(1);return S=F.hasOwnProperty(d)?F[d]:F.DEFAULT,S=new S,J(A,S),R(A,M),S.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return R(A,function(l,u){return w(l,u,"\\]")}),"keyword";if(L.match("\\("))return R(A,function(l,u){return w(l,u,"\\)")}),"keyword";if(L.match("$$"))return R(A,function(l,u){return w(l,u,"$$")}),"keyword";if(L.match("$"))return R(A,function(l,u){return w(l,u,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(S=U(A),S)S.closeBracket(o),R(A,M);else return"error";return"bracket"}else return o=="{"||o=="["?(S=F.DEFAULT,S=new S,J(A,S),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),S=G(A),S.name=="begin"&&(S.argument=L.current()),S.styleIdentifier())}function w(L,A,S){if(L.eatSpace())return null;if(S&&L.match(S))return R(A,E),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=L.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(L.skipToEnd(),"comment"):"error"}function M(L,A){var S=L.peek(),d;return S=="{"||S=="["?(d=U(A),d.openBracket(S),L.eat(S),R(A,E),"bracket"):/[ \t\r]/.test(S)?(L.eat(S),null):(R(A,E),k(A),E(L,A))}return{startState:function(){var L=O.inMathMode?function(A,S){return w(A,S)}:E;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,A){return A.f(L,A)},blankLine:function(L){L.f=E,L.cmdState.length=0},lineComment:"%"}}),fe.defineMIME("text/x-stex","stex"),fe.defineMIME("text/x-latex","stex")})},"19Vz":function(ht,$e,ue){(function(fe){fe(ue("VrN/"))})(function(fe){fe.defineOption("placeholder","",function(H,F,R){var E=R&&R!=fe.Init;if(F&&!E)H.on("blur",U),H.on("change",k),H.on("swapDoc",k),fe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){J(H)}),k(H);else if(!F&&E){H.off("blur",U),H.off("change",k),H.off("swapDoc",k),fe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var w=H.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}F&&!H.hasFocus()&&U(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function O(H){Z(H);var F=H.state.placeholder=document.createElement("pre");F.style.cssText="height: 0; overflow: visible",F.style.direction=H.getOption("direction"),F.className="CodeMirror-placeholder CodeMirror-line-like";var R=H.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),F.appendChild(R),H.display.lineSpace.insertBefore(F,H.display.lineSpace.firstChild)}function J(H){setTimeout(function(){var F=!1,R=H.getInputField();R.nodeName=="TEXTAREA"?F=!R.value:H.lineCount()==1&&(F=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),F?O(H):Z(H)},20)}function U(H){G(H)&&O(H)}function k(H){var F=H.getWrapperElement(),R=G(H);F.className=F.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(H):Z(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(ht,$e,ue){(function(fe){fe(ue("VrN/"))})(function(fe){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};fe.defineMode("xml",function(J,U){var k=J.indentUnit,G={},H=U.htmlMode?Z:O;for(var F in H)G[F]=H[F];for(var F in U)G[F]=U[F];var R,E;function w(a,y){function g(j){return y.tokenize=j,j(a,y)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(A("atom","]]>")):null:a.match("--")?g(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),y.tokenize=A("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",y.tokenize=M,"tag bracket");if(b=="&"){var N;return a.eat("#")?a.eat("x")?N=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):N=a.eatWhile(/[\d]/)&&a.eat(";"):N=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),N?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function M(a,y){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return y.tokenize=w,R=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return R="equals",null;if(g=="<"){y.tokenize=w,y.state=u,y.tagName=y.tagStart=null;var b=y.tokenize(a,y);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(g)?(y.tokenize=L(g),y.stringStartCol=a.column(),y.tokenize(a,y)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var y=function(g,b){for(;!g.eol();)if(g.next()==a){b.tokenize=M;break}return"string"};return y.isInAttribute=!0,y}function A(a,y){return function(g,b){for(;!g.eol();){if(g.match(y)){b.tokenize=w;break}g.next()}return a}}function S(a){return function(y,g){for(var b;(b=y.next())!=null;){if(b=="<")return g.tokenize=S(a+1),g.tokenize(y,g);if(b==">")if(a==1){g.tokenize=w;break}else return g.tokenize=S(a-1),g.tokenize(y,g)}return"meta"}}function d(a,y,g){this.prev=a.context,this.tagName=y,this.indent=a.indented,this.startOfLine=g,(G.doNotIndent.hasOwnProperty(y)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,y){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!G.contextGrabbers.hasOwnProperty(g)||!G.contextGrabbers[g].hasOwnProperty(y))return;o(a)}}function u(a,y,g){return a=="openTag"?(g.tagStart=y.column(),C):a=="closeTag"?v:u}function C(a,y,g){return a=="word"?(g.tagName=y.current(),E="tag",x):G.allowMissingTagName&&a=="endTag"?(E="tag bracket",x(a,y,g)):(E="error",C)}function v(a,y,g){if(a=="word"){var b=y.current();return g.context&&g.context.tagName!=b&&G.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==b||G.matchClosing===!1?(E="tag",m):(E="tag error",_)}else return G.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,y,g)):(E="error",_)}function m(a,y,g){return a!="endTag"?(E="error",m):(o(g),u)}function _(a,y,g){return E="error",m(a,y,g)}function x(a,y,g){if(a=="word")return E="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var b=g.tagName,N=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(b)?l(g,b):(l(g,b),g.context=new d(g,b,N==g.indented)),u}return E="error",x}function p(a,y,g){return a=="equals"?c:(G.allowMissing||(E="error"),x(a,y,g))}function c(a,y,g){return a=="string"?h:a=="word"&&G.allowUnquoted?(E="string",x):(E="error",x(a,y,g))}function h(a,y,g){return a=="string"?h:x(a,y,g)}return{startState:function(a){var y={tokenize:w,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(y.baseIndent=a),y},token:function(a,y){if(!y.tagName&&a.sol()&&(y.indented=a.indentation()),a.eatSpace())return null;R=null;var g=y.tokenize(a,y);return(g||R)&&g!="comment"&&(E=null,y.state=y.state(R||g,a,y),E&&(g=E=="error"?g+" error":E)),g},indent:function(a,y,g){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+k;if(b&&b.noIndent)return fe.Pass;if(a.tokenize!=M&&a.tokenize!=w)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+k*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/$/,blockCommentStart:"",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var y=[],g=a.context;g;g=g.prev)g.tagName&&y.push(g.tagName);return y.reverse()}}}),fe.defineMIME("text/xml","xml"),fe.defineMIME("application/xml","xml"),fe.mimeModes.hasOwnProperty("text/html")||fe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return v});var fe=ue("+L6B"),Z=ue("2/Rp"),O=ue("2qtc"),J=ue("kLXV"),U=ue("9og8"),k=ue("k1fw"),G=ue("miYZ"),H=ue("tsqr"),F=ue("oBTY"),R=ue("tJVT"),E=ue("DZo9"),w=ue("8z0m"),M=ue("WmNS"),L=ue.n(M),A=ue("q1tI"),S=ue.n(A),d=ue("m3rI"),o=ue("wzkS"),l=ue("y5JW"),u=ue("LtfV"),C=w.a.Dragger;function v(m){var _=[];return m&&m.length>0&&(_=m.map(function(x){return{uid:x.id,id:x.id,name:x.title+l.c+x.filesize,url:x.url,filesize:x.filesize,status:"done",response:{id:x.id}}})),_}$e.b=function(m){var _=m.value,x=m.onChange,p=m.action,c=m.className,h=m.maxSize,a=h===void 0?150:h,y=m.title,g=y===void 0?"\u4E0A\u4F20\u9644\u4EF6":y,b=m.showRemoveModal,N=b===void 0?!1:b,j=m.accept,K=j===void 0?"":j,V=m.additionalText,P=m.isDragger,I=m.number,$=I===void 0?1e3:I,ne=m.aloneClear,de=ne===void 0?!1:ne,me=Object(A.useState)(!1),De=Object(R.a)(me,2),xe=De[0],Le=De[1],Te=Object(A.useState)(_||[]),Se=Object(R.a)(Te,2),ve=Se[0],z=Se[1];Object(A.useEffect)(function(){_&&(z(Object(F.a)(_)),$===(_==null?void 0:_.length)&&Le(!0))},[_]);var s=function(){setTimeout(function(){ve.pop(),z(Object(F.a)(ve))},500)},f={multiple:!0,disabled:xe,accept:K,withCredentials:!0,fileList:ve,beforeUpload:function(B,se){var be=B.size/1024/1024;return ve.concat(se).length>$?(ve.pop(),z(Object(F.a)(ve)),H.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat($,"\u4E2A\u6587\u4EF6")),de?Promise.reject():(s(),!1)):!0},action:p||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(B){var se,be,we=Object(F.a)(B.fileList);if(B.file.status==="done"&&((se=B.file)===null||se===void 0||((be=se.response)===null||be===void 0)?void 0:be.status)===-1){var Oe,_e;H.b.error((Oe=B.file)===null||Oe===void 0||((_e=Oe.response)===null||_e===void 0)?void 0:_e.message);return}we.length>=$?Le(!0):Le(!1),z(Object(F.a)(we)),we=we.map(function(Re){var Pe;if(Re!=null&&(Pe=Re.response)!==null&&Pe!==void 0&&Pe.id){var Fe;Re.url="/api/attachments/".concat(Re==null||((Fe=Re.response)===null||Fe===void 0)?void 0:Fe.id)}return Re.name.indexOf(l.c)===-1&&(Re.name="".concat(Re.name).concat(l.c).concat(Object(l.a)(Re.size))),Object(k.a)({},Re)}),console.log("info:",B),x(we)},onRemove:function(){var X=Object(U.a)(L.a.mark(function se(be){var we;return L.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:if(we=function(){var Re=Object(U.a)(L.a.mark(function Pe(){var Fe,Ge;return L.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(Fe=be.response?be.response.id:be.id,!Fe){We.next=8;break}return We.next=4,Object(o.d)(be.response?be.response.id:be.uid);case 4:return Ge=We.sent,We.abrupt("return",Ge);case 8:return We.abrupt("return",!0);case 9:case"end":return We.stop()}},Pe)}));return function(){return Re.apply(this,arguments)}}(),!N){_e.next=5;break}return _e.abrupt("return",new Promise(function(Re,Pe){J.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:S.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Fe=Object(U.a)(L.a.mark(function ze(){var We;return L.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,we();case 2:We=Ke.sent,H.b.success("\u5220\u9664\u6210\u529F"),Re(!0);case 5:case"end":return Ke.stop()}},ze)}));function Ge(){return Fe.apply(this,arguments)}return Ge}(),onCancel:function(){return Re(!1)}})}));case 5:return _e.next=7,we();case 7:return _e.abrupt("return",_e.sent);case 8:case"end":return _e.stop()}},se)}));function B(se){return X.apply(this,arguments)}return B}()};function D(X){X.preventDefault(),X.stopPropagation()}return S.a.createElement("div",{className:"multi-upload ".concat(c||"")},P&&S.a.createElement(C,f,S.a.createElement("p",{className:"ant-upload-drag-icon"},S.a.createElement(u.a,null)),S.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",S.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),V),!P&&S.a.createElement(w.a,f,S.a.createElement(Z.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:S.a.createElement("i",{className:"iconfont icon-shangchuan3",style:{marginRight:"6px"}}),disabled:xe},g),S.a.createElement("span",{onClick:D,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return l});var fe=ue("Ty5D"),Z=ue("dI71"),O=ue("q1tI"),J=ue.n(O),U=ue("YS25"),k=ue("17x9"),G=ue.n(k),H=ue("wx14"),F=ue("zLVn"),R=ue("9R94"),E=function(c){Object(Z.a)(h,c);function h(){for(var y,g=arguments.length,b=new Array(g),N=0;N1&&arguments[1]!==void 0?arguments[1]:0,A=(G[M[L+0]]+G[M[L+1]]+G[M[L+2]]+G[M[L+3]]+"-"+G[M[L+4]]+G[M[L+5]]+"-"+G[M[L+6]]+G[M[L+7]]+"-"+G[M[L+8]]+G[M[L+9]]+"-"+G[M[L+10]]+G[M[L+11]]+G[M[L+12]]+G[M[L+13]]+G[M[L+14]]+G[M[L+15]]).toLowerCase();if(!k(A))throw TypeError("Stringified UUID is invalid");return A}var R=F;function E(M,L,A){M=M||{};var S=M.random||(M.rng||O)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,L){A=A||0;for(var d=0;d<16;++d)L[A+d]=S[d];return L}return R(S)}var w=$e.a=E},"7ahc":function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return C});var fe=ue("k1fw"),Z=ue("0Owb"),O=ue("+L6B"),J=ue("2/Rp"),U=ue("y8nQ"),k=ue("Vl3Y"),G=ue("tJVT"),H=ue("OaEy"),F=ue("2fM7"),R=ue("q1tI"),E=ue.n(R),w=ue("VrN/"),M=ue.n(w),L=ue("p77/"),A=ue.n(L),S=ue("c5Ni"),d=ue.n(S),o=F.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};$e.b=function(v){var m=v.callback,_=v.onCancel,x=Object(R.useState)("python"),p=Object(G.a)(x,2),c=p[0],h=p[1];function a(g){h(u[g][1])}function y(g){m(g)}return E.a.createElement(k.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),E.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(F.a,{onChange:a},Object.keys(u).map(function(g){return E.a.createElement(o,{key:g,value:g},u[g][0])}))),E.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(C,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(J.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(J.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function C(v){var m=v.value,_=v.onChange,x=v.mode,p=v.options,c=p===void 0?{}:p,h=Object(R.useRef)(),a=Object(R.useState)(),y=Object(G.a)(a,2),g=y[0],b=y[1];return Object(R.useEffect)(function(){if(g){function N(j){var K=j.getValue();_&&_(K)}return g.on("change",N),function(){g.off("change",N)}}},[g,_]),Object(R.useEffect)(function(){g&&g.setOption("mode",x)},[g,x]),Object(R.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(R.useEffect)(function(){if(h.current&&!g){var N=M.a.fromTextArea(h.current,Object(fe.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));b(N)}},[h.current,g]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:h}))}},"8EBN":function(ht,$e,ue){(function(fe){fe(ue("VrN/"))})(function(fe){"use strict";fe.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 Z=0;Z-1&&J.substring(G+1,J.length);if(H)return fe.findModeByExtension(H)},fe.findModeByName=function(J){J=J.toLowerCase();for(var U=0;U=ie.length?le.slice(ie.length):le}).join(` `)}var d=[],o=["
    "],l=new L.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){d.length=0,o=["
      "]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(oe,q,ee,ie){if(q>=oe.length||oe[q].level<=ee)return q;var le=oe[q];ie.push("
    • "+le.text+""),q++;var te=[];return q=m(oe,q,le.level,te),te.length>0&&(ie.push("
        "),te.forEach(function(ae){ie.push(ae)}),ie.push("
      ")),ie.push("
    • "),q=m(oe,q,ee,ie),q}function _(){return m(d,0,0,o),o.push("
    "),o.join("")}var x={heading:function(q){var ee=u.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ie=ee[0],le=S(ie,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ae=h(),he=le;le=ae,a[ae]={type:"block",expression:he}}return{type:"code",raw:ie,lang:te,text:le}}}},p=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,h=function(){return"__special_katext_id_".concat(c++,"__")},a={};function y(){return a}function g(){c=0,a={}}function b(oe){return oe=oe.replace(p,function(q,ee){var ie=h();return a[ie]={type:"inline",expression:ee},ie}),oe}var N=l.listitem;l.listitem=function(oe){return N(b(oe))};var j=l.paragraph;l.paragraph=function(oe){return j(b(oe))};var K=l.tablecell;l.tablecell=function(oe,q){return K(b(oe),q)},l.code=function(oe,q,ee){var ie=(q||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"

    ".concat(oe,"

    "):'
    ').concat(ee?oe:Object(A.escape)(oe,!0),`
    `):'
    '+(ee?oe:Object(A.escape)(oe,!0))+"
    "},l.heading=function(oe,q,ee){var ie=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ie,level:q,text:oe}),"'+oe+""},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:x,renderer:l});var V=L.a,P=ue("SJMd"),I=ue("ulZh"),$=ue.n(I),ne=ue("m3rI"),de=ue("Oy/b"),me=ue("p5ED"),De=ue("ErOA"),xe=ue("STEk");/* ********************************** cropro version 1.2.0 @license SEE LICENSE IN LICENSE copyright Alan Mendelevich see README and LICENSE for details ********************************** *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Le=function(oe,q){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ie){ee.__proto__=ie}||function(ee,ie){for(var le in ie)Object.prototype.hasOwnProperty.call(ie,le)&&(ee[le]=ie[le])})(oe,q)};function Te(oe,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=oe}Le(oe,q),oe.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function Se(oe,q,ee,ie){return new(ee||(ee=Promise))(function(le,te){function ae(ye){try{ce(ie.next(ye))}catch(Ee){te(Ee)}}function he(ye){try{ce(ie.throw(ye))}catch(Ee){te(Ee)}}function ce(ye){var Ee;ye.done?le(ye.value):(Ee=ye.value,Ee instanceof ee?Ee:new ee(function(Me){Me(Ee)})).then(ae,he)}ce((ie=ie.apply(oe,q||[])).next())})}function ve(oe,q){var ee,ie,le,te,ae={label:0,sent:function(){if(1&le[0])throw le[1];return le[1]},trys:[],ops:[]};return te={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function he(ce){return function(ye){return function(Ee){if(ee)throw new TypeError("Generator is already executing.");for(;ae;)try{if(ee=1,ie&&(le=2&Ee[0]?ie.return:Ee[0]?ie.throw||((le=ie.return)&&le.call(ie),0):ie.next)&&!(le=le.call(ie,Ee[1])).done)return le;switch(ie=0,le&&(Ee=[2&Ee[0],le.value]),Ee[0]){case 0:case 1:le=Ee;break;case 4:return ae.label++,{value:Ee[1],done:!1};case 5:ae.label++,ie=Ee[1],Ee=[0];continue;case 7:Ee=ae.ops.pop(),ae.trys.pop();continue;default:if(!(le=ae.trys,(le=le.length>0&&le[le.length-1])||Ee[0]!==6&&Ee[0]!==2)){ae=0;continue}if(Ee[0]===3&&(!le||Ee[1]>le[0]&&Ee[1]0&&ee>0){var ie=new _e(q,ee),le=ie.ratio>=1?20:ie.getHorizontalLength(20),te=ie.ratio<1?20:ie.getVerticalLength(20),ae=document.createElementNS("http://www.w3.org/2000/svg","svg");ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),ae.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ae);var he=s.createDefs();ae.appendChild(he);var ce=s.createElement("clipPath",[["id","text-bg-clip"]]);he.appendChild(ce);var ye=s.createPath(s.getHollowRectanglePath((24-le)/2,(24-te)/2,le,te,(24-le)/2+2,(24-te)/2+2,le-4,te-4));ae.appendChild(ye);var Ee=s.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(s.createTSpan(q+":"+ee)),ae.appendChild(Ee);var Me=Ee.getBBox();s.setAttributes(Ee,[["x",((24-Me.width)/2).toString()],["y",((24-Me.height)/2-Me.y).toString()]]);var He=s.createPath(s.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Me.width))/2,(24-Math.ceil(Me.height))/2,Math.ceil(Me.width),Math.ceil(Me.height)));return ce.appendChild(He),s.setAttributes(ye,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ae),ae.outerHTML}return''},oe}(),Pe=function(oe){function q(ee,ie,le){var te=oe.call(this,ee,ie)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=le,te}return Te(q,oe),q.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ie){ie.className=ee.className,ie.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ie.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(we),Fe=function(){function oe(q,ee){this.GRIP_SIZE=10,this.color=q,this.fillColor=ee,this.visual=s.createGroup(),this.visual.appendChild(s.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(s.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return oe.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},oe.prototype.setCenter=function(q,ee){this.visual.childNodes.forEach(function(ie){return s.setAttributes(ie,[["cx",q.toString()],["cy",ee.toString()]])})},oe}(),Ge=function(){function oe(q,ee,ie,le){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=ee,this.margin=ie,this.container=le,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(oe.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&s.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),oe.prototype.open=function(){var q=this;this.cropShadeElement=s.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=s.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;eethis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),s.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var ie=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ae){var he=ee.y+ie*(ae+1);s.setAttributes(te,[["x1",""+ee.x],["y1",""+he],["x2",""+(ee.x+ee.width)],["y2",""+he]])});var le=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ae){var he=ee.x+le*(ae+1);s.setAttributes(te,[["x1",""+he],["y1",""+ee.y],["x2",""+he],["y2",""+(ee.y+ee.height)]])}),s.setAttributes(this.cropShadeElement,[["d",s.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},oe.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)},oe.prototype.clientToLocalCoordinates=function(q,ee){var ie=this.container.getBoundingClientRect();return{x:q-ie.left+this.margin,y:ee-ie.top+this.margin}},oe.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},oe.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(ee)}q.preventDefault()},oe.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},oe.prototype.move=function(q){var ee=q.x-this.previousPoint.x,ie=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ie=-ie/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ie),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},oe.prototype.resize=function(q){var ee=Object.assign({},this.cropRect),ie=q.x-this.previousPoint.x,le=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+iethis.canvasWidth*this.zoomFactor&&(ie=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ie}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ie),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=le,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=le}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=q,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},oe.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,ie=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ie/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=q-this.cropRect.width/2,this.cropRect.y=ee-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},oe.prototype.getRescaledRect=function(q,ee,ie,le,te,ae){var he=ie/q,ce=le/ee;return{x:(te.x-ae)*he+ae,y:(te.y-ae)*ce+ae,width:te.width*he,height:te.height*ce}},oe.prototype.scaleCanvas=function(q,ee){var ie=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ie),this.setCropRectangle(ie)},oe}(),ze=function(){function oe(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(oe.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),oe.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},oe.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},oe.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},oe.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},oe.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();s.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},oe.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},oe.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ie=1;ie<=this.width/5+10;ie++){var le=ie%5==0?this.height/3:this.height/6;ee+="h4v"+-le+"h1v"+le}ee+="v1H0Z",this.scaleShape=s.createPath(ee);var te=s.createTransform();this.scaleShape.transform.baseVal.appendItem(te),q.appendChild(this.scaleShape),this.angleLabelElement=s.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=s.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ae=s.createTSpan("");return ae.innerHTML="°",this.angleLabelElement.appendChild(ae),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},oe}(),We=function(){function oe(){this.naturalSize=!1,this.imageType="image/png"}return oe.prototype.rasterize=function(q,ee,ie,le,te,ae,he){var ce=this;return new Promise(function(ye){var Ee=document.createElement("canvas");Ee.width=q.width.baseVal.value-2*le,Ee.height=q.height.baseVal.value-2*le;var Me=1,He=1;ce.naturalSize===!0?(Me=ee.naturalWidth/(q.width.baseVal.value-2*le)/ae,He=ee.naturalHeight/(q.height.baseVal.value-2*le)/he,Ee.width=ee.naturalWidth/ae,Ee.height=ee.naturalHeight/he):ce.width!==void 0&&ce.height!==void 0&&(Me=ce.width/ie.width,He=ce.height/ie.height,Ee.width*=Me,Ee.height*=He);var et=Ee.getContext("2d");et.translate(Ee.width/2,Ee.height/2),et.rotate(te*Math.PI/180),et.scale(ae,he),et.translate(-Ee.width/2,-Ee.height/2),et.drawImage(ee,0,0,Ee.width,Ee.height);var rt=document.createElement("canvas");rt.width=ie.width*Me,rt.height=ie.height*He,rt.getContext("2d").putImageData(et.getImageData((ie.x-le)*Me,(ie.y-le)*He,ie.width*Me,ie.height*He),0,0),ye(rt.toDataURL(ce.imageType,ce.imageQuality))})},oe}(),nt=function(){function oe(q){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=oe.instanceCounter++,this.styles=new f(this.instanceNo),this.target=q,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(oe.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),oe.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},oe.prototype.show=function(){this.showUI(),this.open()},oe.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},oe.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},oe.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},oe.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},oe.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},oe.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},oe.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ie=ee+2*this.CANVAS_MARGINq+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},oe.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},oe.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new B,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new be;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var ie=[];this.aspectRatios.forEach(function(He){var et=new we(Re.getIcon(He.horizontal,He.vertical),He.horizontal===0&&He.vertical===0?"FREE":He.horizontal+":"+He.vertical);et.onClick=function(){return q.ratioButtonClicked(He)},ie.push(et)}),this.aspectRatioButton=new Pe(Re.getIcon(0,0),"Aspect ratio",ie),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var le=new we('',"Toggle grid");le.isActive=this.isGridVisible,le.onClick=function(){q.isGridVisible=!q.isGridVisible,le.isActive=q.isGridVisible},ee.addButton(le);var te=new we('',"Zoom to selection");if(te.isActive=this.zoomToCropEnabled,te.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,te.isActive=q.zoomToCropEnabled},ee.addButton(te),!z.isLicensed){var ae=new Oe;this.topToolbar.addElementBlock(ae);var he=document.createElement("div");he.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ce=document.createElement("a");ce.style.color="currentColor",ce.href="https://markerjs.com/products/cropro",ce.target="_blank",ce.innerHTML='',he.appendChild(ce),ae.addElement(he)}var ye=new be;ye.minWidth=3*this.toolbarHeight+"px",ye.contentAlign="end",this.topToolbar.addButtonBlock(ye);var Ee=new we('',"OK");Ee.onClick=this.startRenderAndClose,ye.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Me=new we('',"Close");Me.onClick=this.close,ye.addButton(Me),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},oe.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new B,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var ee=new be;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var ie=new we('',"Rotate left");ie.onClick=this.rotateLeftButtonClicked,ee.addButton(ie);var le=new we('',"Rotate right");le.onClick=this.rotateRightButtonClicked,ee.addButton(le);var te=new Oe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new ze("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(ye){q.rotateBy(ye),q.straightener.angle=q.rotationAngle},te.addElement(this.straightener.getUI());var ae=new be;ae.minWidth=2*this.toolbarHeight+"px",ae.contentAlign="end",this.bottomToolbar.addButtonBlock(ae);var he=new we('',"Flip horizontal");he.onClick=this.flipHorizontallyButtonClicked,ae.addButton(he);var ce=new we('',"Flip vertical");ce.onClick=this.flipVerticallyButtonClicked,ae.addButton(ce)},oe.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},oe.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Re.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},oe.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new _e(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},oe.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},oe.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},oe.prototype.restoreState=function(q){if(q){var ee=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},oe.prototype.clientToLocalCoordinates=function(q,ee){var ie=this.cropImage.getBoundingClientRect();return{x:q-ie.left,y:ee-ie.top}},oe.prototype.onWindowResize=function(){this.positionUI()},oe.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},oe.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},oe.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},oe.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},oe.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},oe.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var ie=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ie.width,this.imageHeight/ie.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},oe.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},oe.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},oe.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},oe.prototype.startRenderAndClose=function(){return Se(this,void 0,void 0,function(){var q,ee;return ve(this,function(ie){switch(ie.label){case 0:return[4,this.render()];case 1:return q=ie.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(le){return le(q,ee)}),this.close(!0),[2]}})})},oe.prototype.render=function(){return Se(this,void 0,void 0,function(){var q;return ve(this,function(ee){switch(ee.label){case 0:return(q=new We).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),s.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return ee.sent(),[4,q.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,ee.sent()]}})})},oe.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new X("toolbar",` width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`; flex-shrink: 0; display: flex; flex-direction: row; justify-content: space-between; height: `+this.toolbarHeight+`px; box-sizing: content-box; overflow: hidden; line-height: 0px; `)),this.toolbarStyleColorsClass=this.styles.addClass(new X("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new X("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new X("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*q)+`px; height: `+(this.toolbarHeight-2*q)+`px; padding: `+q+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new X("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new D("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new D("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new X("toolbar_dropdown",` position: absolute; max-width: `+4*this.toolbarHeight+`px; z-index: 20; white-space: normal; box-sizing: content-box; box-shadow: 3px 3px rgba(33, 33, 33, 0.1); margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px; line-height: 0px; `)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new X("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new X("toolbar_straightener_block",` display: flex; overflow: hidden; justify-content: center; -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%); `)),this.toolbarStraightenerStyleClass=this.styles.addClass(new X("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*q)+`px; padding: `+q+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new X("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},oe.instanceCounter=0,oe}(),Ke=ue("8hTe"),Qe=ue.n(Ke),ke=/]*>/g;function Ze(oe){var q=document.createElement("div");return q.innerHTML=oe,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var Ve=$e.a=function(oe){var q=oe.value,ee=q===void 0?"":q,ie=oe.edit,le=ie===void 0?!1:ie,te=oe.className,ae=oe.showTextOnly,he=oe.showLines,ce=oe.replaces,ye=oe.zoomImg,Ee=oe.hasMask,Me=oe.style,He=Me===void 0?{}:Me,et=oe.stylesPrev,rt=et===void 0?{}:et,vt=String(ee),ot=Object(R.useRef)(),it=Object(R.useRef)(),wt=Object(R.useState)(""),xt=Object(G.a)(wt,2),It=xt[0],Ot=xt[1],Et=Object(R.useState)("office"),mr=Object(G.a)(Et,2),Tr=mr[0],Yt=mr[1],gr=function(){var Tt=new nt(it.current);Tt.displayMode="popup",Tt.addRenderEventListener(function(){var Zt=Object(k.a)(F.a.mark(function mt(pt){var At;return F.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return ot.current.style.display="none",Ut.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt}});case 3:At=Ut.sent,At!=null&&At.id&&ce(it.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 5:case"end":return Ut.stop()}},mt)}));return function(mt){return Zt.apply(this,arguments)}}()),Tt.show()},cr=function(){var Tt=new xe.a(it.current);Tt.settings.displayMode="popup",Tt.addEventListener("render",function(){var Zt=Object(k.a)(F.a.mark(function mt(pt){var At;return F.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(ot.current.style.display="none",!it.current){Ut.next=6;break}return Ut.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:pt.dataUrl}});case 4:At=Ut.sent,At!=null&&At.id&&ce(it.current.getAttribute("src").replace(ne.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 6:case"end":return Ut.stop()}},mt)}));return function(mt){return Zt.apply(this,arguments)}}()),Tt.show(),window.markerArea=Tt},zr=Object(R.useMemo)(function(){ot.current&&(ot.current.style.zIndex=-1);try{var Je=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Tt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Zt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;vt=vt.replace(Je,"("+ne.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+ne.a.API_SERVER+"/api/attachments/").replace(Zt,'"'+ne.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,` `)}catch(vr){}var mt=V(vt),pt=y();if(vt.match(/\[TOC\]/)&&(mt=mt.replace("

    [TOC]

    ",_()),C()),mt=mt.replace(/(__special_katext_id_\d+__)/g,function(vr,Ut){var Be=pt[Ut],dt=Be.type,ri=Be.expression;return Object(de.renderToString)(Ze(ri)||"",{displayMode:dt==="block",throwOnError:!1,output:"html"})}),mt=mt.replace(/▁/g,"\u2581\u2581\u2581"),g(),ae){var At=document.createElement("div");return At.innerHTML=mt,At.innerText}return setTimeout(function(){return ti()},500),mt},[vt]),$t=Object(R.useRef)();v.WebkitLineClamp=he,he&&(He=Object(U.a)(Object(U.a)({},He),v));function Nr(Je){var Tt=Je.target;if(Tt.tagName.toUpperCase()==="IMG"){if(ye){var Zt=Tt.getAttribute("src");Ot(Zt),Yt("image")}}else if(Tt.tagName.toUpperCase()==="A"){var mt=Tt.getAttribute("href");if(mt.indexOf("office")>-1)Je.preventDefault(),Ot(mt),Yt("office");else if(mt.indexOf("application/pdf")>-1)Je.preventDefault(),Ot(mt),Yt("pdf");else if(mt.indexOf("text/html")>-1)Je.preventDefault(),Ot(mt),Yt("html");else if(mt.startsWith("#")){Je.preventDefault();var pt=document.getElementById(mt.replace("#",""));pt&&pt.scrollIntoView(!0)}}}var ti=function(){var Tt,Zt=(Tt=$t.current)===null||Tt===void 0?void 0:Tt.querySelectorAll("video");Zt==null||Zt.forEach(function(mt){if(mt.oncontextmenu=function(){return!1},mt.src.indexOf(".m3u8")>-1&&!mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var pt=new $.a;pt.loadSource(mt.src),pt.attachMedia(mt)}}})};Object(R.useEffect)(function(){if($t.current&&zr&&(zr.match(ke)&&window.PR.prettyPrint()),$t.current)return $t.current.addEventListener("click",Nr),function(){$t.current.removeEventListener("click",Nr),g(),C()}},[zr,$t.current,Nr]);var Pt=function(Tt){if(!le)return;Tt.target.nodeName==="IMG"?(ot.current.style.zIndex=1,ot.current.style.display="flex",ot.current.style.width=Tt.target.clientWidth+"px",ot.current.style.height=Tt.target.clientHeight+"px",ot.current.style.top=Tt.target.offsetTop+"px",ot.current.style.left=Tt.target.offsetLeft+"px",it.current.src=Tt.target.getAttribute("src")):ot.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:$t,style:Object(U.a)({},He),className:"".concat(te||""," markdown-body ").concat(Qe.a.mdBody),onMouseOver:Pt,dangerouslySetInnerHTML:{__html:zr}}),E.a.createElement("div",{ref:ot,className:Qe.a.button},E.a.createElement(Z.a,null,E.a.createElement(J.a,{onClick:function(){return gr()}},"\u88C1\u526A"),E.a.createElement(J.a,{onClick:function(){return cr()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:it,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(me.a,{close:!0,data:It,type:It!=null&&It.length?Tr:"",style:Object(U.a)({},rt),onClose:function(){return Ot("")}}))}},"9VGf":function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return O});var fe=ue("q1tI"),Z=ue.n(fe);function O(J,U){var k=Object(fe.useRef)();Object(fe.useEffect)(function(){k.current=J}),Object(fe.useEffect)(function(){function G(){k.current()}if(U!==null){var H=setInterval(G,U);return function(){return clearInterval(H)}}},[U])}},Bd2K:function(ht,$e,ue){(function(fe){fe(ue("VrN/"),ue("osHv"))})(function(fe){fe.defineOption("autoCloseTags",!1,function(F,R,E){if(E!=fe.Init&&E&&F.removeKeyMap("autoCloseTags"),!R)return;var w={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(w["'/'"]=function(M){return k(M)}),(typeof R!="object"||R.whenOpening!==!1)&&(w["'>'"]=function(M){return J(M)}),F.addKeyMap(w)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function J(F){if(F.getOption("disableInput"))return fe.Pass;for(var R=F.listSelections(),E=[],w=F.getOption("autoCloseTags"),M=0;ML.ch&&(l=l.slice(0,l.length-A.end+L.ch));var m=l.toLowerCase();if(!l||A.type=="string"&&(A.end!=L.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==L.ch-A.start-1||C&&G(C,m)>-1||H(F,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(d)||[],l,L,!0))return fe.Pass;var _=typeof w=="object"&&w.emptyTags;if(_&&G(_,l)>-1){E[M]={text:"/>",newPos:fe.Pos(L.line,L.ch+2)};continue}var x=v&&G(v,m)>-1;E[M]={indent:x,text:">"+(x?` `:"")+"",newPos:x?fe.Pos(L.line+1,0):fe.Pos(L.line,L.ch+1)}}for(var p=typeof w=="object"&&w.dontIndentOnAutoClose,M=R.length-1;M>=0;M--){var c=E[M];F.replaceRange(c.text,R[M].head,R[M].anchor,"+insert");var h=F.listSelections().slice(0);h[M]={head:c.newPos,anchor:c.newPos},F.setSelections(h),!p&&c.indent&&(F.indentLine(c.newPos.line,null,!0),F.indentLine(c.newPos.line+1,null,!0))}}function U(F,R){for(var E=F.listSelections(),w=[],M=R?"/":""&&(C+=">"),w[S]=C}if(F.replaceSelections(w),E=F.listSelections(),!A)for(var S=0;S=0&&R[d]==E;d--)++S;w=A.to;for(var d=1;d0){for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:"",R=[],E=0;Eee.length)&&(ie=ee.length);for(var le=0,te=new Array(ie);le=ee.length?{done:!0}:{done:!1,value:ee[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return le=ee[Symbol.iterator](),le.next.bind(le)}function k(ee,ie){return ie={exports:{}},ee(ie,ie.exports),ie.exports}var G=k(function(ee){function ie(){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 le(te){ee.exports.defaults=te}ee.exports={defaults:ie(),getDefaults:ie,changeDefaults:le}}),H=G.defaults,F=G.getDefaults,R=G.changeDefaults,E=/[&<>"']/,w=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},S=function(ie){return A[ie]};function d(ee,ie){if(ie){if(E.test(ee))return ee.replace(w,S)}else if(M.test(ee))return ee.replace(L,S);return ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ee){return ee.replace(o,function(ie,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(ee,ie){ee=ee.source||ee,ie=ie||"";var le={replace:function(ae,he){return he=he.source||he,he=he.replace(u,"$1"),ee=ee.replace(ae,he),le},getRegex:function(){return new RegExp(ee,ie)}};return le}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(ee,ie,le){if(ee){var te;try{te=decodeURIComponent(l(le)).replace(v,"").toLowerCase()}catch(ae){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ie&&!m.test(le)&&(le=a(ie,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ae){return null}return le}var x={},p=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ee,ie){x[" "+ee]||(p.test(ee)?x[" "+ee]=ee+"/":x[" "+ee]=N(ee,"/",!0)),ee=x[" "+ee];var le=ee.indexOf(":")===-1;return ie.substring(0,2)==="//"?le?ie:ee.replace(c,"$1")+ie:ie.charAt(0)==="/"?le?ie:ee.replace(h,"$1")+ie:ee+ie}var y={exec:function(){}};function g(ee){for(var ie=1,le,te;ie=0&&ye[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=le.split(/ \|/),ae=0;if(te.length>ie)te.splice(ie);else for(;te.length=te.length?ae.slice(te.length):ae}).join(` `)}var xe=function(){function ee(le){this.options=le||P}var ie=ee.prototype;return ie.space=function(te){var ae=this.rules.block.newline.exec(te);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:` `}},ie.code=function(te,ae){var he=this.rules.block.code.exec(te);if(he){var ce=ae[ae.length-1];if(ce&&ce.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var ye=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:I(ye,` `)}}},ie.fences=function(te){var ae=this.rules.block.fences.exec(te);if(ae){var he=ae[0],ce=De(he,ae[3]||"");return{type:"code",raw:he,lang:ae[2]?ae[2].trim():ae[2],text:ce}}},ie.heading=function(te){var ae=this.rules.block.heading.exec(te);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},ie.nptable=function(te){var ae=this.rules.block.nptable.exec(te);if(ae){var he={type:"table",header:$(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(` `):[],raw:ae[0]};if(he.header.length===he.align.length){var ce=he.align.length,ye;for(ye=0;ye ?/gm,"");return{type:"blockquote",raw:ae[0],text:he}}},ie.list=function(te){var ae=this.rules.block.list.exec(te);if(ae){for(var he=ae[0],ce=ae[2],ye=ce.length>1,Ee=ce[ce.length-1]===")",Me={type:"list",raw:he,ordered:ye,start:ye?+ce.slice(0,-1):"",loose:!1,items:[]},He=ae[0].match(this.rules.block.item),et=!1,rt,vt,ot,it,wt,xt,It,Ot=He.length,Et=0;Et1||this.options.smartLists&&ot!==ce)&&(it=He.slice(Et+1).join(` `),Me.raw=Me.raw.substring(0,Me.raw.length-it.length),Et=Ot-1)),wt=et||/\n\n(?!\s*$)/.test(rt),Et!==Ot-1&&(et=rt.charAt(rt.length-1)===` `,wt||(wt=et)),wt&&(Me.loose=!0),xt=/^\[[ xX]\] /.test(rt),It=void 0,xt&&(It=rt[1]!==" ",rt=rt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:he,task:xt,checked:It,loose:wt,text:rt});return Me}},ie.html=function(te){var ae=this.rules.block.html.exec(te);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]):ne(ae[0]):ae[0]}},ie.def=function(te){var ae=this.rules.block.def.exec(te);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var he=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ae[0],href:ae[2],title:ae[3]}}},ie.table=function(te){var ae=this.rules.block.table.exec(te);if(ae){var he={type:"table",header:$(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(` `):[]};if(he.header.length===he.align.length){he.raw=ae[0];var ce=he.align.length,ye;for(ye=0;ye/i.test(ce[0])&&(ae=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:ae,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]}},ie.link=function(te){var ae=this.rules.inline.link.exec(te);if(ae){var he=de(ae[2],"()");if(he>-1){var ce=ae[0].indexOf("!")===0?5:4,ye=ce+ae[1].length+he;ae[2]=ae[2].substring(0,he),ae[0]=ae[0].substring(0,ye).trim(),ae[3]=""}var Ee=ae[2],Me="";if(this.options.pedantic){var He=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);He?(Ee=He[1],Me=He[3]):Me=""}else Me=ae[3]?ae[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var et=me(ae,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},ae[0]);return et}},ie.reflink=function(te,ae){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var ce=(he[2]||he[1]).replace(/\s+/g," ");if(ce=ae[ce.toLowerCase()],!ce||!ce.href){var ye=he[0].charAt(0);return{type:"text",raw:ye,text:ye}}var Ee=me(he,ce,he[0]);return Ee}},ie.strong=function(te,ae,he){he===void 0&&(he="");var ce=this.rules.inline.strong.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*te.length);var ye=ce[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var Ee;(ce=ye.exec(ae))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ae.slice(0,ce.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ie.em=function(te,ae,he){he===void 0&&(he="");var ce=this.rules.inline.em.start.exec(te);if(ce&&(!ce[1]||ce[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*te.length);var ye=ce[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var Ee;(ce=ye.exec(ae))!=null;)if(Ee=this.rules.inline.em.middle.exec(ae.slice(0,ce.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ie.codespan=function(te){var ae=this.rules.inline.code.exec(te);if(ae){var he=ae[2].replace(/\n/g," "),ce=/[^ ]/.test(he),ye=he.startsWith(" ")&&he.endsWith(" ");return ce&&ye&&(he=he.substring(1,he.length-1)),he=ne(he,!0),{type:"codespan",raw:ae[0],text:he}}},ie.br=function(te){var ae=this.rules.inline.br.exec(te);if(ae)return{type:"br",raw:ae[0]}},ie.del=function(te){var ae=this.rules.inline.del.exec(te);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},ie.autolink=function(te,ae){var he=this.rules.inline.autolink.exec(te);if(he){var ce,ye;return he[2]==="@"?(ce=ne(this.options.mangle?ae(he[1]):he[1]),ye="mailto:"+ce):(ce=ne(he[1]),ye=ce),{type:"link",raw:he[0],text:ce,href:ye,tokens:[{type:"text",raw:ce,text:ce}]}}},ie.url=function(te,ae){var he;if(he=this.rules.inline.url.exec(te)){var ce,ye;if(he[2]==="@")ce=ne(this.options.mangle?ae(he[0]):he[0]),ye="mailto:"+ce;else{var Ee;do Ee=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Ee!==he[0]);ce=ne(he[0]),he[1]==="www."?ye="http://"+ce:ye=ce}return{type:"link",raw:he[0],text:ce,href:ye,tokens:[{type:"text",raw:ce,text:ce}]}}},ie.inlineText=function(te,ae,he){var ce=this.rules.inline.text.exec(te);if(ce){var ye;return ae?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):ne(ce[0]):ce[0]:ye=ne(this.options.smartypants?he(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ye}}},ee}(),Le=V.noopTest,Te=V.edit,Se=V.merge,ve={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Le,table:Le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ve._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ve._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ve.def=Te(ve.def).replace("label",ve._label).replace("title",ve._title).getRegex(),ve.bullet=/(?:[*+-]|\d{1,9}[.)])/,ve.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ve.item=Te(ve.item,"gm").replace(/bull/g,ve.bullet).getRegex(),ve.list=Te(ve.list).replace(/bull/g,ve.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ve.def.source+")").getRegex(),ve._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",ve._comment=//,ve.html=Te(ve.html,"i").replace("comment",ve._comment).replace("tag",ve._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve.paragraph=Te(ve._paragraph).replace("hr",ve.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",")|<(?:script|pre|style|!--)").replace("tag",ve._tag).getRegex(),ve.blockquote=Te(ve.blockquote).replace("paragraph",ve.paragraph).getRegex(),ve.normal=Se({},ve),ve.gfm=Se({},ve.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*|$)"}),ve.gfm.nptable=Te(ve.gfm.nptable).replace("hr",ve.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",")|<(?:script|pre|style|!--)").replace("tag",ve._tag).getRegex(),ve.gfm.table=Te(ve.gfm.table).replace("hr",ve.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",")|<(?:script|pre|style|!--)").replace("tag",ve._tag).getRegex(),ve.pedantic=Se({},ve.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Le,paragraph:Te(ve.normal._paragraph).replace("hr",ve.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ve.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:Le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",z.punctuation=Te(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=Te(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=Te(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=Te(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=Te(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=Te(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=Te(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=Te(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=Te(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=Te(z._blockSkip,"g").getRegex(),z.overlapSkip=Te(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,z.autolink=Te(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=Te(z.tag).replace("comment",ve._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=Te(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=Te(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=Te(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=Se({},z),z.pedantic=Se({},z.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=Se({},z.normal,{escape:Te(z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(te="x"+te.toString(16)),ie+="&#"+te+";";return ie}var be=function(){function ee(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||f,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:D.normal,inline:X.normal};this.options.pedantic?(te.block=D.pedantic,te.inline=X.pedantic):this.options.gfm&&(te.block=D.gfm,this.options.breaks?te.inline=X.breaks:te.inline=X.gfm),this.tokenizer.rules=te}ee.lex=function(te,ae){var he=new ee(ae);return he.lex(te)};var ie=ee.prototype;return ie.lex=function(te){return te=te.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ie.blockTokens=function(te,ae,he){ae===void 0&&(ae=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var ce,ye,Ee,Me;te;){if(ce=this.tokenizer.space(te)){te=te.substring(ce.raw.length),ce.type&&ae.push(ce);continue}if(ce=this.tokenizer.code(te,ae)){te=te.substring(ce.raw.length),ce.type?ae.push(ce):(Me=ae[ae.length-1],Me.raw+=` `+ce.raw,Me.text+=` `+ce.text);continue}if(ce=this.tokenizer.fences(te)){te=te.substring(ce.raw.length),ae.push(ce);continue}if(ce=this.tokenizer.heading(te)){te=te.substring(ce.raw.length),ae.push(ce);continue}if(ce=this.tokenizer.nptable(te)){te=te.substring(ce.raw.length),ae.push(ce);continue}if(ce=this.tokenizer.hr(te)){te=te.substring(ce.raw.length),ae.push(ce);continue}if(ce=this.tokenizer.blockquote(te)){te=te.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],he),ae.push(ce);continue}if(ce=this.tokenizer.list(te)){for(te=te.substring(ce.raw.length),Ee=ce.items.length,ye=0;ye0)for(;(He=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)et.includes(He[0].slice(He[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,He.index)+"["+"a".repeat(He[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(He=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,He.index)+"["+"a".repeat(He[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ee=this.tokenizer.escape(te)){te=te.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.tag(te,he,ce)){te=te.substring(Ee.raw.length),he=Ee.inLink,ce=Ee.inRawBlock,ae.push(Ee);continue}if(Ee=this.tokenizer.link(te)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ce)),ae.push(Ee);continue}if(Ee=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ce)),ae.push(Ee);continue}if(Ee=this.tokenizer.strong(te,Me,ye)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ae.push(Ee);continue}if(Ee=this.tokenizer.em(te,Me,ye)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ae.push(Ee);continue}if(Ee=this.tokenizer.codespan(te)){te=te.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.br(te)){te=te.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.del(te)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],he,ce),ae.push(Ee);continue}if(Ee=this.tokenizer.autolink(te,se)){te=te.substring(Ee.raw.length),ae.push(Ee);continue}if(!he&&(Ee=this.tokenizer.url(te,se))){te=te.substring(Ee.raw.length),ae.push(Ee);continue}if(Ee=this.tokenizer.inlineText(te,ce,B)){te=te.substring(Ee.raw.length),ye=Ee.raw.slice(-1),ae.push(Ee);continue}if(te){var rt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return ae},Z(ee,null,[{key:"rules",get:function(){return{block:D,inline:X}}}]),ee}(),we=G.defaults,Oe=V.cleanUrl,_e=V.escape,Re=function(){function ee(le){this.options=le||we}var ie=ee.prototype;return ie.code=function(te,ae,he){var ce=(ae||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(te,ce);ye!=null&&ye!==te&&(he=!0,te=ye)}return ce?'
    '+(he?te:_e(te,!0))+`
    `:"
    "+(he?te:_e(te,!0))+`
    `},ie.blockquote=function(te){return`
    `+te+`
    `},ie.html=function(te){return te},ie.heading=function(te,ae,he,ce){return this.options.headerIds?"'+te+" `:""+te+" `},ie.hr=function(){return this.options.xhtml?`
    `:`
    `},ie.list=function(te,ae,he){var ce=ae?"ol":"ul",ye=ae&&he!==1?' start="'+he+'"':"";return"<"+ce+ye+`> `+te+" `},ie.listitem=function(te){return"
  • "+te+`
  • `},ie.checkbox=function(te){return" "},ie.paragraph=function(te){return"

    "+te+`

    `},ie.table=function(te,ae){return ae&&(ae=""+ae+""),` `+te+` `+ae+`
    `},ie.tablerow=function(te){return` `+te+` `},ie.tablecell=function(te,ae){var he=ae.header?"th":"td",ce=ae.align?"<"+he+' align="'+ae.align+'">':"<"+he+">";return ce+te+" `},ie.strong=function(te){return""+te+""},ie.em=function(te){return""+te+""},ie.codespan=function(te){return""+te+""},ie.br=function(){return this.options.xhtml?"
    ":"
    "},ie.del=function(te){return""+te+""},ie.link=function(te,ae,he){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ce='",ce},ie.image=function(te,ae,he){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ce=''+he+'":">",ce},ie.text=function(te){return te},ee}(),Pe=function(){function ee(){}var ie=ee.prototype;return ie.strong=function(te){return te},ie.em=function(te){return te},ie.codespan=function(te){return te},ie.del=function(te){return te},ie.html=function(te){return te},ie.text=function(te){return te},ie.link=function(te,ae,he){return""+he},ie.image=function(te,ae,he){return""+he},ie.br=function(){return""},ee}(),Fe=function(){function ee(){this.seen={}}var ie=ee.prototype;return ie.slug=function(te){var ae=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var he=ae;do this.seen[he]++,ae=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},ee}(),Ge=G.defaults,ze=V.unescape,We=function(){function ee(le){this.options=le||Ge,this.options.renderer=this.options.renderer||new Re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new Fe}ee.parse=function(te,ae){var he=new ee(ae);return he.parse(te)};var ie=ee.prototype;return ie.parse=function(te,ae){ae===void 0&&(ae=!0);var he="",ce,ye,Ee,Me,He,et,rt,vt,ot,it,wt,xt,It,Ot,Et,mr,Tr,Yt,gr=te.length;for(ce=0;ce0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=Yt+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=Yt+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:Yt}):Ot+=Yt),Ot+=this.parse(Et.tokens,It),ot+=this.renderer.listitem(Ot,Tr,mr);he+=this.renderer.list(ot,wt,xt);continue}case"html":{he+=this.renderer.html(it.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(it.tokens));continue}case"text":{for(ot=it.tokens?this.parseInline(it.tokens):it.text;ce+1An error occurred:

    "+Qe(Ee.message+"",!0)+"
    ";throw Ee}}oe.options=oe.setOptions=function(ee){return nt(oe.defaults,ee),Ze(oe.defaults),oe},oe.getDefaults=ke,oe.defaults=Ve,oe.use=function(ee){var ie=nt({},ee);if(ee.renderer&&function(){var te=oe.defaults.renderer||new Re,ae=function(ye){var Ee=te[ye];te[ye]=function(){for(var Me=arguments.length,He=new Array(Me),et=0;et`,triples:"",explode:"[]{}"},O=fe.Pos;fe.defineOption("autoCloseBrackets",!1,function(A,S,d){d&&d!=fe.Init&&(A.removeKeyMap(U),A.state.closeBrackets=null),S&&(k(J(S,"pairs")),A.state.closeBrackets=S,A.addKeyMap(U))});function J(A,S){return S=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[S]!=null?A[S]:Z[S]}var U={Backspace:F,Enter:R};function k(A){for(var S=0;S=0;l--){var C=o[l].head;A.replaceRange("",O(C.line,C.ch-1),O(C.line,C.ch+1),"+delete")}}function R(A){var S=H(A),d=S&&J(S,"explode");if(!d||A.getOption("disableInput"))return fe.Pass;for(var o=A.listSelections(),l=0;l0;return{anchor:new O(A.anchor.line,A.anchor.ch+(S?-1:1)),head:new O(A.head.line,A.head.ch+(S?1:-1))}}function w(A,S){var d=H(A);if(!d||A.getOption("disableInput"))return fe.Pass;var o=J(d,"pairs"),l=o.indexOf(S);if(l==-1)return fe.Pass;for(var u=J(d,"closeBefore"),C=J(d,"triples"),v=o.charAt(l+1)==S,m=A.listSelections(),_=l%2==0,x,p=0;p=0&&A.getRange(h,O(h.line,h.ch+3))==S+S+S?a="skipThree":a="skip";else if(v&&h.ch>1&&C.indexOf(S)>=0&&A.getRange(O(h.line,h.ch-2),h)==S+S){if(h.ch>2&&/\bstring/.test(A.getTokenTypeAt(O(h.line,h.ch-2))))return fe.Pass;a="addFour"}else if(v){var g=h.ch==0?" ":A.getRange(O(h.line,h.ch-1),h);if(!fe.isWordChar(y)&&g!=S&&!fe.isWordChar(g))a="both";else return fe.Pass}else if(_&&(y.length===0||/\s/.test(y)||u.indexOf(y)>-1))a="both";else return fe.Pass;if(!x)x=a;else if(x!=a)return fe.Pass}var b=l%2?o.charAt(l-1):S,N=l%2?S:o.charAt(l+1);A.operation(function(){if(x=="skip")A.execCommand("goCharRight");else if(x=="skipThree")for(var j=0;j<3;j++)A.execCommand("goCharRight");else if(x=="surround"){for(var K=A.getSelections(),j=0;j0&&(de.percent=de.loaded/de.total*100),V.onProgress(de)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(ne){var de=V.data[ne];if(Array.isArray(de)){de.forEach(function(me){I.append(ne+"[]",me)});return}I.append(ne,V.data[ne])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),P.onerror=function(de){V.onError(de)},P.onload=function(){return P.status<200||P.status>=300?V.onError(U(V,P),k(P)):V.onSuccess(k(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ne){$[ne]!==null&&P.setRequestHeader(ne,$[ne])}),P.send(I),{abort:function(){P.abort()}}}var H=+new Date,F=0;function R(){return"rc-upload-"+H+"-"+ ++F}function E(V,P){return V.indexOf(P,V.length-P.length)!==-1}var w=function(V,P){if(V&&P){var I=Array.isArray(P)?P:P.split(","),$=V.name||"",ne=V.type||"",de=ne.replace(/\/.*$/,"");return I.some(function(me){var De=me.trim();return De.charAt(0)==="."?E($.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?de===De.replace(/\/.*$/,""):ne===De})}return!0};function M(V,P){var I=V.createReader(),$=[];function ne(){I.readEntries(function(de){var me=Array.prototype.slice.apply(de);$=$.concat(me);var De=!me.length;De?P($):ne()})}ne()}var L=function(P,I,$){var ne=function de(me,De){De=De||"",me.isFile?me.file(function(xe){$(xe)&&(me.fullPath&&!xe.webkitRelativePath&&(Object.defineProperties(xe,{webkitRelativePath:{writable:!0}}),xe.webkitRelativePath=me.fullPath.replace(/^\//,""),Object.defineProperties(xe,{webkitRelativePath:{writable:!1}})),I([xe]))}):me.isDirectory&&M(me,function(xe){xe.forEach(function(Le){de(Le,""+De+me.name+"/")})})};P.forEach(function(de){ne(de.webkitGetAsEntry())})},A=L,S=Object.assign||function(V){for(var P=1;P=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;I[$]=V[$]}return I}function C(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function v(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function m(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}var _=function(P){return Object.keys(P).reduce(function(I,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(I[$]=P[$]),I},{})},x=function(V){m(P,V);function P(){var I,$,ne,de;C(this,P);for(var me=arguments.length,De=Array(me),xe=0;xe1&&arguments[1]!==void 0?arguments[1]:1,le=Pe.length,te=0;te1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(I).map(function(ne,de){if(!U.isValidElement(ne)||!ne.type)return null;var me=ne.type.isSelectOptGroup,De=ne.key,xe=ne.props,Le=xe.children,Te=Object(G.a)(xe,["children"]);return $||!me?x(ne):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(De===null?de:De,"__"),label:De},Te),{},{options:p(Le)})}).filter(function(ne){return ne})}var c=ue("2Qr1"),h=ue("qNPg"),a=ue("U8pU"),y=ue("Kwbf"),g=ue("WKfj");function b(I){var $=I.mode,ne=I.options,de=I.children,me=I.backfill,De=I.allowClear,xe=I.placeholder,Le=I.getInputElement,Te=I.showSearch,Se=I.onSearch,ve=I.defaultOpen,z=I.autoFocus,s=I.labelInValue,f=I.value,D=I.inputValue,X=I.optionLabelProp,B=$==="multiple"||$==="tags",se=Te!==void 0?Te:B||$==="combobox",be=ne||p(de);if(Object(y.a)($!=="tags"||be.every(function(Re){return!Re.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var we=be.some(function(Re){return Re.options?Re.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Re?Re.value:Re.key)=="number"});Object(y.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)($!=="combobox"||!X,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)($==="combobox"||!me,"`backfill` only works with `combobox` mode."),Object(y.a)($==="combobox"||!Le,"`getInputElement` only work with `combobox` mode."),Object(y.b)($!=="combobox"||!Le||!De||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!se&&$!=="combobox"&&$!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ve||z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),f!=null){var Oe=Object(g.d)(f);Object(y.a)(!s||Oe.every(function(Re){return Object(a.a)(Re)==="object"&&("key"in Re||"value"in Re)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!B||Array.isArray(f),"`value` should be array when `mode` is `multiple` or `tags`")}if(de){var _e=null;Object(_.a)(de).some(function(Re){if(!U.isValidElement(Re)||!Re.type)return!1;var Pe=Re.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Fe=Object(_.a)(Re.props.children).every(function(Ge){return!U.isValidElement(Ge)||!Re.type||Ge.type.isSelectOption?!0:(_e=Ge.type,!1)});return!Fe}return _e=Pe,!0}),_e&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_e.displayName||_e.name||_e,"`.")),Object(y.a)(D===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=b,j=Object(h.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:p,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:N,fillOptionsWithMissingValue:c.a}),K=function(I){Object(O.a)(ne,I);var $=Object(J.a)(ne);function ne(){var de;return Object(fe.a)(this,ne),de=$.apply(this,arguments),de.selectRef=U.createRef(),de.focus=function(){de.selectRef.current.focus()},de.blur=function(){de.selectRef.current.blur()},de}return Object(Z.a)(ne,[{key:"render",value:function(){return U.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),ne}(U.Component);K.Option=u,K.OptGroup=v;var V=K,P=$e.c=V},M8RZ:function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return F});var fe=ue("fWQN"),Z=ue("mtLc"),O=ue("yKVA"),J=ue("879j"),U=ue("q1tI"),k=ue.n(U),G=ue("i8i4"),H=ue.n(G),F=function(R){Object(O.a)(w,R);var E=Object(J.a)(w);function w(M){var L;Object(fe.a)(this,w),L=E.call(this,M);var A=window.document;return L.node=A.createElement("div"),A.body.appendChild(L.node),L}return Object(Z.a)(w,[{key:"render",value:function(){var L=this.props.children;return Object(G.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(k.a.Component)},Ot1p:function(ht,$e,ue){"use strict";var fe=ue("2qtc"),Z=ue("kLXV"),O=ue("rAM+"),J=ue("miYZ"),U=ue("tsqr"),k=ue("9og8"),G=ue("tJVT"),H=ue("jrin"),F=ue("WmNS"),R=ue.n(F),E=ue("q1tI"),w=ue.n(E),M=ue("VrN/"),L=ue.n(M),A=ue("bdgK"),S=ue("p77/"),d=ue("Bd2K"),o=ue("ELLl"),l=ue("19Vz"),u=ue("lZu9"),C=ue("+NIl"),v=ue("kSUc"),m=ue("9Bee"),_=function(ye){var Ee=ye.value,Me=Ee===void 0?"":Ee,He=ye.className,et=ye.showTextOnly,rt=ye.showLines,vt=ye.style,ot=vt===void 0?{}:vt,it=Object(E.useMemo)(function(){return""},[Me]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:it}}))},x=ue("0Owb"),p=ue("dejd"),c=ue("C+DQ"),h=ue("1vsH"),a=ue("m3rI"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function g(ye){var Ee=ye.onActionCallback,Me=ye.title,He=ye.icon,et=ye.actionName,rt=ye.className,vt=rt===void 0?"":rt,ot=ye.children;function it(){Ee(et)}return w.a.createElement("a",{title:Me,className:vt,onClick:it},w.a.createElement("i",{className:"md-iconfont ".concat(He)}),ot)}var b=function(ye){var Ee=ye.watch,Me=ye.showNullButton,He=ye.onActionCallback,et=ye.fullScreen,rt=ye.insertTemp,vt=ye.hidetoolBar,ot=ye.uuid,it=ye.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.F)("_educoder_session"),"&key=").concat(ot,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var wt=[].concat(y,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!vt&&wt.map(function(xt,It){return w.a.createElement("li",{key:It},xt.actionName?w.a.createElement(g,Object(x.a)({},xt,{onActionCallback:He})):w.a.createElement("span",{className:"v-line"}))}),Me?w.a.createElement("li",null,w.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:He},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,rt&&w.a.createElement("li",null,w.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(rt),onActionCallback:He},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(g,{icon:"".concat(et?"icon-shrink":"icon-enlarge"),title:et?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:He})))},N=ue("M8RZ"),j=ue("+L6B"),K=ue("2/Rp"),V=ue("y8nQ"),P=ue("Vl3Y"),I=ue("5NDa"),$=ue("5rEg"),ne={labelCol:{span:4},wrapperCol:{span:20}},de=function(ye){var Ee=ye.callback,Me=ye.onCancel;function He(et){Ee(et)}return w.a.createElement(P.a,Object(x.a)({},ne,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:He}),w.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement($.a,null)),w.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement($.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},me=ue("7ahc"),De=ue("HmJG"),xe=ue("BjJ7"),Le=P.a.useForm,Te={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},ve=function(ye){var Ee=ye.callback,Me=ye.onCancel,He=Le(),et=Object(G.a)(He,1),rt=et[0];function vt(wt){Ee(wt)}function ot(wt,xt){if(wt.status===-1){U.b.error(wt.message);return}rt.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:xt.type})}function it(wt){var xt=wt.target.files[0];s(xt,ot)}return w.a.createElement(P.a,Object(x.a)({form:rt},Se,{className:"upload-image-panel",onFinish:vt}),w.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement($.a,{style:Te})),w.a.createElement(z,{onFileChange:it}))),w.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement($.a,{style:{width:264}})),w.a.createElement(P.a.Item,{style:{textAlign:"right"}},w.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function z(ye){var Ee=ye.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:Ee}))}function s(ye,Ee){if(!ye)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",ye),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var He=new window.XMLHttpRequest;He.withCredentials=!0,He.addEventListener("load",function(et){Ee(JSON.parse(et.target.responseText),ye)},!1),He.addEventListener("error",function(et){console.error(et)},!1),He.open("POST","".concat(xe.a,"/api/attachments.json")),He.send(Me)}var f=ue("giR+"),D=ue("fyUT"),X=ue("7Kak"),B=ue("9yH6"),se=B.a.Group,be={margin:"0 8px"},we=function(ye){var Ee=ye.callback,Me=ye.onCancel;function He(et){Ee(et)}return w.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:He},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:be},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:be},"\u884C\u6570"),w.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(D.a,null)),w.a.createElement("span",{style:be},"\u5217\u6570"),w.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(D.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(P.a.Item,{name:"align"},w.a.createElement(se,null,w.a.createElement(B.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(B.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(B.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(B.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(K.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Oe=ue("ErOA"),_e=ue("7Cbv"),Re="link",Pe="upload-image",Fe="code-block",Ge="add-table",ze="------------",We={default:ze,left:":".concat(ze),center:":".concat(ze,":"),right:"".concat(ze,":")},nt=ue("9VGf"),Ke,Qe;function ke(){}var Ze=0,Ve=1e4,oe="\u2581",q=` **\u6A21\u677F\u6807\u9898** \u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ee(ye){return/^\d+$/.test(ye)?"".concat(ye,"px"):ye}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ie?"Cmd":"Ctrl",te=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ae=(Ke={},Object(H.a)(Ke,le+"-B","bold"),Object(H.a)(Ke,le+"-I","italic"),Ke),he=(Qe={},Object(H.a)(Qe,Re,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Qe,Fe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Qe,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Qe,Ge,"\u6DFB\u52A0\u8868\u683C"),Qe),ce=$e.a=function(ye){var Ee=ye.defaultValue,Me=Ee===void 0?"":Ee,He=ye.onChange,et=ye.width,rt=et===void 0?"100%":et,vt=ye.height,ot=vt===void 0?400:vt,it=ye.miniToolbar,wt=it===void 0?!1:it,xt=ye.isFocus,It=xt===void 0?!1:xt,Ot=ye.watch,Et=ye.insertTemp,mr=ye.mode,Tr=mr===void 0?"markdown":mr,Yt=ye.id,gr=Yt===void 0?"markdown-editor-id":Yt,cr=ye.showResizeBar,zr=cr===void 0?!1:cr,$t=ye.noStorage,Nr=$t===void 0?!1:$t,ti=ye.showNullButton,Pt=ti===void 0?!1:ti,Je=ye.hidetoolBar,Tt=Je===void 0?!1:Je,Zt=ye.fullScreen,mt=Zt===void 0?!1:Zt,pt=ye.onBlur,At=ye.onCMBeforeChange,vr=ye.onFullScreen,Ut=ye.className,Be=Ut===void 0?"":Ut,dt=ye.disablePaste,ri=dt===void 0?!1:dt,bi=ye.placeholder,xi=bi===void 0?"":bi,ii=ye.values,Ei=ii===void 0?"":ii,ft=Object(E.useState)(null),_n=Object(G.a)(ft,2),Ue=_n[0],Si=_n[1],Er=Object(E.useState)(Me),Ki=Object(G.a)(Er,2),ni=Ki[0],Cr=Ki[1],Vi=Object(E.useState)(Ot),Xi=Object(G.a)(Vi,2),wr=Xi[0],Yi=Xi[1],Ln=Object(E.useState)(mt),$i=Object(G.a)(Ln,2),Ar=$i[0],kn=$i[1],aa=Object(E.useState)(""),Zi=Object(G.a)(aa,2),rr=Zi[0],Kr=Zi[1],oa=Object(E.useState)(0),ai=Object(G.a)(oa,2),_r=ai[0],Ji=ai[1],sa=Object(E.useState)(ot),Dn=Object(G.a)(sa,2),Rn=Dn[0],Ti=Dn[1],On=Object(E.useState)(!1),Pn=Object(G.a)(On,2),la=Pn[0],Ci=Pn[1],oi=Object(E.useRef)(Object(_e.a)()),si=Object(E.useRef)(!1),wi=Object(E.useRef)(),Br=Object(E.useRef)(),Fr=Object(E.useRef)(),Ur=Object(E.useRef)(),Ai=Object(E.useRef)(),Mn=function(){var at=Object(k.a)(R.a.mark(function ct(){var lt,yt;return R.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return Dt.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:yt=Dt.sent,yt!=null&&(lt=yt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Ue,Br),yt.attachments.map(function(St){St.content_type.indexOf("image")>-1?Ue.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):St.content_type.indexOf("video")>-1?Ue.replaceSelection('')):St.content_type.indexOf("pdf")>-1?Ue.replaceSelection('
    ').concat(St.name,"")):Ue.replaceSelection("[".concat(St.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}));case 4:case"end":return Dt.stop()}},ct)}));return function(){return at.apply(this,arguments)}}();Object(E.useEffect)(function(){Cr(Ei),Ue==null||Ue.setValue(Ei)},[Ei]),Object(E.useEffect)(function(){vr==null||vr(Ar)},[Ar]),Object(E.useEffect)(function(){if(Br.current){var at=L.a.fromTextArea(Br.current,{mode:Tr,lineNumbers:!wt,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});It&&at.focus();function ct(lt,yt){if(ri){yt.preventDefault();return}var Ct=yt.clipboardData;if(Ct){var Dt=Ct.types.toString(),St=Ct.items;if(Dt==="Files"||Ct.types.indexOf("Files")>-1){if(yt.preventDefault(),Tr=="stex")return;try{var Ht,ar=St[1];((Ht=St[0])===null||Ht===void 0?void 0:Ht.kind)==="file"&&(ar=St[0]);var bt=ar.getAsFile(),jr=bt.name.split(".").pop();s(bt,function(_t){if(_t.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(_t.id,"?type=").concat(_t.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?at.replaceSelection('')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('').concat(bt.name,"")):te.includes(jr)?at.replaceSelection('').concat(bt.name,"")):at.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})}catch(_t){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",ct),at.on("dragleave",function(lt,yt){Fr.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(lt,yt){Fr.current.classList.add("mouse-hover-md")}),at.on("drop",function(lt,yt){Fr.current.classList.add("mouse-hover-md");var Ct;if(Ct=yt.dataTransfer.files,Ct.length>0){yt.preventDefault(),yt.stopPropagation();for(var Dt=function(ar){var bt=Ct[ar],jr=bt.name.split(".").pop();s(bt,function(_t){if(_t.id){var or,qt,Sr;(bt==null||((or=bt.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(_t.id,"?type=").concat(_t.content_type,")")):(bt==null||((qt=bt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?at.replaceSelection('')):(bt==null||((Sr=bt.type)===null||Sr===void 0)?void 0:Sr.indexOf("pdf"))>-1?at.replaceSelection('').concat(bt.name,"")):te.includes(jr)?at.replaceSelection('').concat(bt.name,"")):at.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})},St=0;St0||St.target.offsetWidth>0)&&(yr(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(Ht){Ct.e(Ht)}finally{Ct.f()}});return lt.observe(Br.current.parentElement),lt}if(Ue){var ct=at();return function(){ct.unobserve(Br.current.parentElement)}}},[Ue,yr]),Object(E.useEffect)(function(){if(Ue){for(var at=[],ct=function(){var St=yt[lt];Ct=Object(G.a)(St,2);var Ht=Ct[0],ar=Ct[1],bt=Object(H.a)({},Ht,function(){In(ar)});at.push(bt),Ue.addKeyMap(bt)},lt=0,yt=Object.entries(ae);lt0){var at=new Date().getTime(),ct=window.sessionStorage.getItem(gr);at>=_r+Ve&&(!ct||ct!==ni)&&(window.sessionStorage.setItem(gr,ni),Ci(!0))}},Ve),Object(E.useEffect)(function(){Yi(Ot)},[Ue,Ot]),Object(E.useEffect)(function(){Ue&&(It&&Ue.focus())},[Ue,It]),Object(E.useEffect)(function(){if(wr&&Ue){var at=Ue.getScrollerElement();function ct(lt){var yt=lt.target;if(Ai.current){var Ct=yt.scrollTop/yt.scrollHeight;Ai.current.scrollTop=Ai.current.scrollHeight*Ct}}return at.addEventListener("scroll",ct),function(){at.removeEventListener("scroll",ct)}}},[Ue,wr]),Object(E.useEffect)(function(){if(Ue&&At){function at(ct,lt){At(ct,lt)}return Ue.on("beforeChange",at),function(){Ue.off("beforeChange",at)}}},[Ue,At]),Object(E.useEffect)(function(){if(Ue&&pt){function at(){pt(Ue.getValue())}return Ue.on("blur",at),function(){Ue.off("blur",at)}}},[Ue,pt]),Object(E.useEffect)(function(){if(Ue){function at(ct){var lt=ct.getValue();Cr(lt),Ji(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),He&&He(lt)}return Ue.on("change",at),function(){Ue.off("change",at)}}},[Ue,He]),Object(E.useEffect)(function(){Ue&&(Me==null?(Ue.setValue(""),Cr("")):Me!==Ue.getValue()&&(Ue.setValue(Me),Cr(Me),Ue.setCursor(Ue.lineCount(),0)))},[Ue,Me]);var In=Object(E.useCallback)(function(at){var ct=Ue.getCursor(),lt=Ue.getSelection(),yt=lt.split(` `);switch(at){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(ct.line,ct.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(ct.line,ct.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(ct.line+1,lt.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`
    `),Ue.focus();case"list-ul":return lt===""?Ue.replaceSelection("- "+lt):Ue.replaceSelection(yt.map(function(Ct){return Ct===""?"":"- ".concat(Ct)}).join(` `)),Ue.focus();case"list-ol":return lt===""?Ue.replaceSelection("1. "+lt):Ue.replaceSelection(yt.map(function(Ct,Dt){return Ct===""?"":"".concat(Dt+1,". ").concat(Ct)}).join(` `)),Ue.focus();case"add-null-ch":return lt===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.replaceSelection(oe),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(ct.line,ct.ch),Ue.replaceSelection(q),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return Yi(!wr),Ue.focus();case"trigger-full-screen":return kn(!Ar),Ue.focus();case Re:Kr(Re);return;case Fe:Kr(Fe);return;case Pe:Kr(Pe);return;case Ge:Kr(Ge);return;default:throw new Error}},[Ue,wr,Ar]),_i=Object(E.useCallback)(function(at){Kr("");switch(rr){case Re:var ct=at.title,lt=at.link;return Ue.replaceSelection("[".concat(ct,"](").concat(lt,")")),Ue.focus();case Fe:var yt=at.language,Ct=at.content;return Ue.replaceSelection(["```"+yt,Ct,"```"].join(` `)),Ue.focus();case Pe:var Dt=at.src,St=at.alt;return St?Ue.replaceSelection("![ ".concat(St," ]( ").concat(Dt,' "').concat(St,'" )')):Ue.replaceSelection("![,](".concat(Dt,")")),Ue.focus();case Ge:for(var Ht=at.row,ar=at.col,bt=at.align,jr=` `,_t=0;_t300&&(Ht=300);var ar=ot+Ht+"px";Ti(ar)}}return at.addEventListener("mousedown",yt),document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Ct),function(){at.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Ct)}}},[Ue,Ur]),Object(E.useEffect)(function(){Ti(ot)},[ot]);var Or=ee(rt),qi=ee(Rn),Lr={width:Or,height:qi},en=Object(E.useMemo)(function(){if(_r){var at=new Date(_r),ct=at.getHours(),lt=at.getMinutes(),yt=at.getSeconds();return ct=ct<10?"0"+ct:ct,lt=lt<10?"0"+lt:lt,yt=yt<10?"0"+yt:yt,"".concat(ct,":").concat(lt,":").concat(yt)}return 0},[_r]);function Nn(){window.sessionStorage.removeItem(gr),Ci(!1),Ji(0)}function li(){Ci(!1),Ji(0),Ue.setValue(window.sessionStorage.getItem(gr))}function ua(at,ct){var lt=Ue.getValue();lt=lt.replace(at,ct),Cr(lt),Ue==null||Ue.setValue(lt)}return w.a.createElement(E.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Fr},w.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(wr?"on-preview":""," ").concat(wt?"mini":""," ").concat(Ar?"full-screen":""),style:Lr},w.a.createElement(b,{insertTemp:Et,watch:wr,fullScreen:Ar,showNullButton:Pt,onActionCallback:In,hidetoolBar:Tt,uuid:oi.current,setOpenPhones:function(){si.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:Br,placeholder:xi})),wr?w.a.createElement("div",{ref:Ai,className:"preview-container"},Tr==="stex"&&w.a.createElement(_,{value:ni}),Tr!=="stex"&&w.a.createElement(m.a,{edit:!0,value:ni,replaces:ua})):null))),zr?w.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,w.a.createElement(N.a,null,he[rr]?w.a.createElement(Z.a,{centered:!0,title:he[rr],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Qi):null))}},SJMd:function(ht,$e){/** * @license * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var ue,fe,Z,O=!1,J,U;window.PR_SHOULD_USE_CONTINUATION=!0;var k,G;(function(){var H=window,F=["break,continue,do,else,for,if,return,while"],R=[F,"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"],E=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[E,"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"],A="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",S=[E,"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",o=[F,"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=[F,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[F,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[w,L,M,S,d,o,l,u],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",_="kwd",x="com",p="typ",c="lit",h="pun",a="pln",y="tag",g="dec",b="src",N="atn",j="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(se){for(var be=0,we=!1,Oe=!1,_e=0,Re=se.length;_e122||(te<65||le>90||Ze.push([Math.max(65,le)|32,Math.min(te,90)|32]),te<97||le>122||Ze.push([Math.max(97,le)&~32,Math.min(te,122)&~32]))}}Ze.sort(function(ye,Ee){return ye[0]-Ee[0]||Ee[1]-ye[1]});for(var ae=[],he=[],q=0;qce[0]&&(ce[1]+1>ce[0]&&oe.push("-"),oe.push(ze(ce[1])))}return oe.push("]"),oe.join("")}function nt(Qe){for(var ke=Qe.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")),Ze=ke.length,Ve=[],oe=0,q=0;oe=2&&le==="["?ke[oe]=We(ee):le!=="\\"&&(ke[oe]=ee.replace(/[a-zA-Z]/g,function(he){var ce=he.charCodeAt(0);return"["+String.fromCharCode(ce&~32,ce|32)+"]"}))}return ke.join("")}for(var Ke=[],_e=0,Re=se.length;_e=0;)we[Ke.charAt(Qe)]=nt;var ke=nt[1],Ze=""+ke;Ge.hasOwnProperty(Ze)||(Fe.push(ke),Ge[Ze]=null)}Fe.push(/[\0-\uffff]/),Oe=P(Fe)})();var _e=be.length,Re=function(Pe){for(var Fe=Pe.sourceCode,Ge=Pe.basePos,ze=Pe.sourceNode,We=[Ge,a],nt=0,Ke=Fe.match(Oe)||[],Qe={},ke=0,Ze=Ke.length;ke=5&&oe.substring(0,5)==="lang-",ee&&!(q&&typeof q[1]=="string")&&(ee=!1,oe=b),ee||(Qe[Ve]=oe)}var te=nt;if(nt+=Ve.length,!ee)We.push(Ge+te,oe);else{var ae=q[1],he=Ve.indexOf(ae),ce=he+ae.length;q[2]&&(ce=Ve.length-q[2].length,he=ce-ae.length);var ye=oe.substring(5);$(ze,Ge+te,Ve.substring(0,he),Re,We),$(ze,Ge+te+he,ae,z(ye,ae),We),$(ze,Ge+te+ce,Ve.substring(ce),Re,We)}}Pe.decorations=We};return Re}function De(se){var be=[],we=[];se.tripleQuotedStrings?be.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):se.multiLineStrings?be.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),se.verbatimStrings&&we.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=se.hashComments;Oe&&(se.cStyleComments?(Oe>1?be.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([x,/^#[^\r\n]*/,null,"#"])),se.cStyleComments&&(we.push([x,/^\/\/[^\r\n]*/,null]),we.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _e=se.regexLiterals;if(_e){var Re=_e>1?"":` \r`,Pe=Re?".":"[\\S\\s]",Fe="/(?=[^/*"+Re+"])(?:[^/\\x5B\\x5C"+Re+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Re+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+V+"("+Fe+")")])}var Ge=se.types;Ge&&we.push([p,Ge]);var ze=(""+se.keywords).replace(/^ | $/g,"");ze.length&&we.push([_,new RegExp("^(?:"+ze.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([a,/^\s+/,null,` \r \xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return se.regexLiterals&&(We+="(?!s*/)"),we.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[h,new RegExp(We),null]),me(be,we)}var xe=De({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Le(se,be,we){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,_e=/\r\n?|\n/,Re=se.ownerDocument,Pe=Re.createElement("li");se.firstChild;)Pe.appendChild(se.firstChild);var Fe=[Pe];function Ge(ke){var Ze=ke.nodeType;if(Ze==1&&!Oe.test(ke.className))if(ke.nodeName==="br")ze(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var Ve=ke.firstChild;Ve;Ve=Ve.nextSibling)Ge(Ve);else if((Ze==3||Ze==4)&&we){var oe=ke.nodeValue,q=oe.match(_e);if(q){var ee=oe.substring(0,q.index);ke.nodeValue=ee;var ie=oe.substring(q.index+q[0].length);if(ie){var le=ke.parentNode;le.insertBefore(Re.createTextNode(ie),ke.nextSibling)}ze(ke),ee||ke.parentNode.removeChild(ke)}}}function ze(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function Ze(q,ee){var ie=ee?q.cloneNode(!1):q,le=q.parentNode;if(le){var te=Ze(le,1),ae=q.nextSibling;te.appendChild(ie);for(var he=ae;he;he=ae)ae=he.nextSibling,te.appendChild(he)}return ie}for(var Ve=Ze(ke.nextSibling,0),oe;(oe=Ve.parentNode)&&oe.nodeType===1;)Ve=oe;Fe.push(Ve)}for(var We=0;We=le&&(Ge+=2),Re>=te&&(nt+=2)}}finally{oe&&(oe.style.display=q)}}var Se={};function ve(se,be){for(var we=be.length;--we>=0;){var Oe=be[we];Se.hasOwnProperty(Oe)?H.console&&console.warn("cannot override language handler %s",Oe):Se[Oe]=se}}function z(se,be){return se&&Se.hasOwnProperty(se)||(se=/^\s*]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ve(me([[a,/^[\s]+/,null,` \r `],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ve(me([],[[j,/^[\s\S]+/]]),["uq.val"]),ve(De({keywords:w,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ve(De({keywords:"null,true,false"}),["json"]),ve(De({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ve(De({keywords:M,cStyleComments:!0}),["java"]),ve(De({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ve(De({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ve(De({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ve(De({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ve(De({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ve(De({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ve(me([],[[m,/^[\s\S]+/]]),["regex"]);function s(se){var be=se.langExtension;try{var we=I(se.sourceNode,se.pre),Oe=we.sourceCode;se.sourceCode=Oe,se.spans=we.spans,se.basePos=0,z(be,Oe)(se),Te(se)}catch(_e){H.console&&console.log(_e&&_e.stack||_e)}}function f(se,be,we){var Oe=we||!1,_e=be||null,Re=document.createElement("div");Re.innerHTML="
    "+se+"
    ",Re=Re.firstChild,Oe&&Le(Re,Oe,!0);var Pe={langExtension:_e,numberLines:Oe,sourceNode:Re,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return s(Pe),Re.innerHTML}function D(se,be){var we=be||document.body,Oe=we.ownerDocument||document;function _e(ie){return we.getElementsByTagName(ie)}for(var Re=[_e("pre"),_e("code"),_e("xmp")],Pe=[],Fe=0;Fe0&&X[X.length-1])||_e[0]!==6&&_e[0]!==2)){se=0;continue}if(_e[0]===3&&(!X||_e[1]>X[0]&&_e[1]',"select"),this.addActionButton(D,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(D,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(D,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(D,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(D,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(D,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(D,'',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(B){var se=document.createElement("div");se.className=""+f.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",B.typeName),se.innerHTML=B.icon,se.addEventListener("click",function(){f.markerToolbarButtonClicked(se,B)}),f.buttons.push(se),f.markerButtons.push(se)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'',"render"),this.addActionButton(X,'',"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 f=0;f0&&this.buttonClickListeners.forEach(function(D){return D("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",f)}),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 f=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===s});f&&this.setActiveButton(f)},z.prototype.setCurrentMarker=function(s){var f=this;this.currentMarker=s,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){f.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},z}(),L=function(){function z(s,f,D,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=f,this.uiStyleSettings=D,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new w("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 w("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new w("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new w("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new w("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 w("toolbox-panel-row_colors",` background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new w("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px; padding: `+f+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new w("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new E("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new E("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},z.prototype.show=function(s){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var f,D,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(B){var se;B.uiStyleSettings=X.uiStyleSettings;var be=document.createElement("div");be.className=X.toolboxButtonStyleClass.name+" "+((se=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:X.toolboxButtonStyleColorsClass.name),be.innerHTML=B.icon,be.title=B.title,be.addEventListener("click",function(){X.panelButtonClick(B)}),X.panelButtons.push(be),X.buttonRow.appendChild(be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var f=this,D=-1;if(s!==this.activePanel){D=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,se){var be,we;B.className=f.toolboxButtonStyleClass.name+" "+(se===D?""+((be=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&be!==void 0?be:f.toolboxActiveButtonStyleColorsClass.name):""+((we=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&we!==void 0?we:f.toolboxButtonStyleColorsClass.name))})},z}(),A=function(z,s){this.title=z,this.icon=s},S=function(z){function s(f,D,X,B){var se=z.call(this,f,B||'')||this;return se.colors=[],se.addTransparent=!1,se.colorBoxes=[],se.colors=D,se.currentColor=X,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(X){var B=f.getColorBox(X);D.appendChild(B),f.colorBoxes.push(B)}),D},s.prototype.getColorBox=function(f){var D=this,X=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-X,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=B-2+"px",se.style.height=B-2+"px",se.style.padding="1px",se.style.marginRight="2px",se.style.marginBottom="2px",se.style.borderWidth="2px",se.style.borderStyle="solid",se.style.borderRadius=(B+2)/2+"px",se.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){D.setCurrentColor(f,se)});var be=document.createElement("div");return be.style.display="inline-block",be.style.width=B-2+"px",be.style.height=B-2+"px",be.style.backgroundColor=f,be.style.borderRadius=B/2+"px",f==="transparent"&&(be.style.fill=this.uiStyleSettings.toolboxAccentColor,be.innerHTML=` `),se.appendChild(be),se},s.prototype.setCurrentColor=function(f,D){var X=this;this.currentColor=f,this.colorBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},s}(A),d=function(){function z(s,f,D){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=f,this.globalSettings=D,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,f){},z.prototype.dblClick=function(s,f){},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,f){},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}(),o=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),l=function(){function z(){this.GRIP_SIZE=10,this.visual=k.createGroup(),this.visual.appendChild(k.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(k.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}(),u=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,f){return s.a=f.a,s.b=f.b,s.c=f.c,s.d=f.d,s.e=f.e,s.f=f.f,s},z}(),C=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(k.createTransform()),B.setupControlBox(),B}return Z(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(f){this._visual=f;var D=k.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(f);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var se=this.container.transform.baseVal.getItem(0);se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(f){var D=this.state;z.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},s.prototype.manipulate=function(f){var D=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(f)},s.prototype.resize=function(f){var D=this.manipulationStartLeft,X=this.manipulationStartWidth,B=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+f.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+f.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+f.y-this.manipulationStartY}X>=0?(this.left=D,this.width=X):(this.left=D+X,this.width=-X),se>=0?(this.top=B,this.height=se):(this.top=B+se,this.height=-se),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var D=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},s.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},s.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var D=this.container.getCTM(),X=k.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},s.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var D=this.container.getCTM();D=D.inverse();var X=k.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(D)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=k.createGroup();var f=k.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=k.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=k.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 o,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,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 f=new l;return f.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,D=-f/2,X=D,B=(this.width+this.CB_DISTANCE)/2-f/2,se=(this.height+this.CB_DISTANCE)/2-f/2,be=this.height+this.CB_DISTANCE-f/2,we=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,D,X),this.positionGrip(this.controlGrips.topCenter.visual,B,X),this.positionGrip(this.controlGrips.topRight.visual,we,X),this.positionGrip(this.controlGrips.centerLeft.visual,D,se),this.positionGrip(this.controlGrips.centerRight.visual,we,se),this.positionGrip(this.controlGrips.bottomLeft.visual,D,be),this.positionGrip(this.controlGrips.bottomCenter.visual,B,be),this.positionGrip(this.controlGrips.bottomRight.visual,we,be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(f,D,X){var B=f.transform.baseVal.getItem(0);B.setTranslate(D,X),f.transform.baseVal.replaceItem(B,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:u.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:u.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D);var X=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:X.x*f,y:X.y*D});this.left=B.x,this.top=B.y,this.width=this.width*f,this.height=this.height*D,this.adjustControlBox()},s}(d),v=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=k.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(f,D){z.prototype.pointerDown.call(this,f,D),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){z.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&k.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&k.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&k.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&k.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(f){var D=f;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setSize()},s.title="Rectangle marker",s}(C),m=function(z){function s(f,D,X,B){var se=z.call(this,f,B||'')||this;return se.widths=[],se.widthBoxes=[],se.widths=D,se.currentWidth=X,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=X===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentWidth(X,B)}),D.appendChild(B);var se=document.createElement("div");se.innerText=X.toString(),se.style.marginRight="5px",B.appendChild(se);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.display="flex",be.style.alignItems="center";var we=document.createElement("hr");we.style.minWidth="20px",we.style.border="0px",we.style.borderTop=X+"px solid "+f.uiStyleSettings.toolboxColor,we.style.flexGrow="2",be.appendChild(we),B.appendChild(be),f.widthBoxes.push(B)}),D},s.prototype.setCurrentWidth=function(f,D){var X=this;this.currentWidth=f,this.widthBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(A),_=function(z){function s(f,D,X,B){var se=z.call(this,f,B||'')||this;return se.styles=[],se.styleBoxes=[],se.styles=D,se.currentStyle=X,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/f.styles.length-5+"%",B.style.borderColor=X===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentStyle(X,B)}),D.appendChild(B);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var be=` `;se.innerHTML=be,B.appendChild(se),f.styleBoxes.push(B)}),D},s.prototype.setCurrentStyle=function(f,D){var X=this;this.currentStyle=f,this.styleBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(A),x=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new S("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new _("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Z(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 f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="FrameMarker",s.title="Frame marker",s.icon='',s}(v),p=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},c=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return Z(s,z),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.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(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(f){var D=this.state;z.prototype.pointerUp.call(this,f),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(f),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},s.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.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=k.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 f=new l;return f.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},s.prototype.positionGrip=function(f,D,X){var B=f.transform.baseVal.getItem(0);B.setTranslate(D,X),f.transform.baseVal.replaceItem(B,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.x1=this.x1*f,this.y1=this.y1*D,this.x2=this.x2*f,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},s}(d),h=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new S("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new _("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=k.createGroup(),this.selectorLine=k.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=k.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(f,D){z.prototype.pointerDown.call(this,f,D),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()),k.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,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 f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='',s}(c),a=function(z){function s(f,D,X,B){var se=z.call(this,f,B||'')||this;return se.fonts=[],se.fontBoxes=[],se.fonts=D,se.currentFont=X,se.setCurrentFont=se.setCurrentFont.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(X){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/f.fonts.length-5+"%",B.style.borderColor=X===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentFont(X,B)}),D.appendChild(B);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=X,se.style.overflow="hidden";var be=document.createElement("div");be.style.whiteSpace="nowrap",be.style.overflow="hidden",be.style.textOverflow="ellipsis",be.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(be),B.appendChild(se),f.fontBoxes.push(B)}),D},s.prototype.setCurrentFont=function(f,D){var X=this;this.currentFont=f,this.fontBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(A),y=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=X.defaultColor,B.fontFamily=X.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new S("Color",X.defaultColorSet,X.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return Z(s,z),s.prototype.ownsTarget=function(f){if(z.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(X){X===f&&(D=!0)}),D},s.prototype.createVisual=function(){this.visual=k.createGroup(),this.bgRectangle=k.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=k.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.renderText=function(){var f=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(D){f.textElement.appendChild(k.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var f=this.textElement.getBBox(),D=1;if(f.width>0&&f.height>0){var X=(1*this.width-this.width*this.padding*2/100)/f.width,B=(1*this.height-this.height*this.padding*2/100)/f.height;D=Math.min(X,B)}return D},s.prototype.getTextPosition=function(f){var D=this.textElement.getBBox(),X=0,B=0;return D.width>0&&D.height>0&&(X=(this.width-D.width*f)/2,B=this.height/2-D.height*f/2),{x:X,y:B}},s.prototype.sizeText=function(){var f=this.textElement.getBBox(),D=this.getTextScale(),X=this.getTextPosition(D);X.y-=f.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(f){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,f),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var f=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(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&D>.9;)D-=.1,f.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var X=D.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(X)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.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 f=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),B={x:X.width*f,y:X.height*f};D.x-=B.x/2,D.y-=B.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(f){this.text=f.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(f,D){z.prototype.dblClick.call(this,f,D),this.showTextEditor()},s.prototype.setColor=function(f){this.textElement&&k.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},s.prototype.setFont=function(f){this.textElement&&k.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,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 f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var D=f;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='',s}(C),g=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=X.defaultColor,B.lineWidth=X.defaultStrokeWidth,B.pixelRatio=X.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new S("Color",X.defaultColorSet,X.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=k.createGroup(),this.drawingImage=k.createImage(),this.visual.appendChild(this.drawingImage);var f=k.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,D){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(f.x,f.y),this.drawing=!0):z.prototype.pointerDown.call(this,f,D)},s.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,f)},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 f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=D[0],B=D[1],se=D[2],be=D[3],we=!1,Oe=0;Oe0&&(we=!0,Oebe&&(be=Oe),_e>se&&(se=_e));if(we){this.left=X/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(se-X)/this.pixelRatio,this.height=(be-B)/this.pixelRatio;var Re=document.createElement("canvas");Re.width=se-X,Re.height=be-B,Re.getContext("2d").putImageData(this.canvasContext.getImageData(X,B,se-X,be-B),0,0),this.drawingImgUrl=Re.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},s.prototype.setLineWidth=function(f){this.lineWidth=f},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 f=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){this.createVisual(),z.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(f,D){z.prototype.scale.call(this,f,D),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='',s}(C),b=function(z){function s(f,D,X){var B=z.call(this,f,X||'')||this;return B.typeBoxes=[],B.currentType=D,B.setCurrentType=B.setCurrentType.bind(B),B}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var X=function(be){var we="both";switch(be){case 0:we="both";break;case 1:we="start";break;case 2:we="end";break;case 3:we="none"}var Oe=document.createElement("div");if(Oe.style.display="flex",Oe.style.flexGrow="2",Oe.style.alignItems="center",Oe.style.justifyContent="space-between",Oe.style.padding="5px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderColor=we===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){f.setCurrentType(we,Oe)}),D.appendChild(Oe),we==="both"||we==="start"){var _e=document.createElement("div");_e.style.display="flex",_e.style.alignItems="center",_e.style.minHeight="20px",_e.innerHTML=` `,_e.style.marginLeft="5px",Oe.appendChild(_e)}var Re=document.createElement("div");Re.style.display="flex",Re.style.alignItems="center",Re.style.minHeight="20px",Re.style.flexGrow="2";var Pe=document.createElement("hr");if(Pe.style.minWidth="20px",Pe.style.border="0px",Pe.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),Pe.style.flexGrow="2",Re.appendChild(Pe),Oe.appendChild(Re),we==="both"||we==="end"){var Fe=document.createElement("div");Fe.style.display="flex",Fe.style.alignItems="center",Fe.style.minHeight="20px",Fe.innerHTML=` `,Fe.style.marginRight="5px",Oe.appendChild(Fe)}B.typeBoxes.push(Oe)},B=this,se=0;se<4;se++)X(se);return D},s.prototype.setCurrentType=function(f,D){var X=this;this.currentType=f,this.typeBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(A),N=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new b("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},s.prototype.getArrowPoints=function(f,D){var X=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return f-X/2+","+(D+B/2)+" "+f+","+(D-B/2)+" "+(f+X/2)+","+(D+B/2)},s.prototype.createTips=function(){this.arrow1=k.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=k.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(f,D){z.prototype.pointerDown.call(this,f,D),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",k.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),k.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(f){this.arrowType=f,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 f=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='',s}(h),j=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.fillColor=X.defaultFillColor,B.strokeWidth=0,B.fillPanel=new S("Color",X.defaultColorSet,X.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return Z(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="CoverMarker",s.title="Cover marker",s.icon='',s}(v),K=function(z){function s(f,D,X,B){var se=z.call(this,f,B||'')||this;return se.opacities=[],se.opacityBoxes=[],se.opacities=D,se.currentOpacity=X,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return Z(s,z),s.prototype.getUi=function(){var f=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(X){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=X===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentOpacity(X,B)}),D.appendChild(B);var se=document.createElement("div");se.innerText=100*X+"%",B.appendChild(se),f.opacityBoxes.push(B)}),D},s.prototype.setCurrentOpacity=function(f,D){var X=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===D?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(A),V=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=X.defaultHighlightColor,B.strokeWidth=0,B.opacity=X.defaultHighlightOpacity,B.fillPanel=new S("Color",X.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new K("Opacity",X.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Z(s,z),s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&k.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 f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='',s}(j),P='',I=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=X.defaultStrokeColor,B.bgColor=X.defaultFillColor,B.fontFamily=X.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new S("Text color",X.defaultColorSet,B.color,''),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new S("Fill color",X.defaultColorSet,B.bgColor,P),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new l,B.tipGrip.visual.transform.baseVal.appendItem(k.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return Z(s,z),s.prototype.ownsTarget=function(f){return z.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},s.prototype.createTip=function(){k.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=k.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(f,D){this.state==="new"&&z.prototype.pointerDown.call(this,f,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,f,D)},s.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,f);else{var D=this.state==="creating";z.prototype.pointerUp.call(this,f),this.setTipPoints(D),this.positionTip()}},s.prototype.manipulate=function(f){if(this.tipMoving){var D=this.unrotatePoint(f);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,f)},s.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(k.setAttributes(this.bgRectangle,[["fill",f]]),k.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},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(f){f===void 0&&(f=!1);var D=Math.min(this.height/2,15),X=this.height/5;f&&(this.tipPosition={x:D+X/2,y:this.height+20});var B=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?B.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='',s}(h),de=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.strokePanel.colors=X.defaultColorSet,B.fillColor="transparent",B}return Z(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 f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='',s}($),me=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}(),De=function(z){function s(f,D,X){var B=z.call(this,f,D,X)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=X.defaultColor,B.strokeWidth=X.defaultStrokeWidth,B.strokeDasharray=X.defaultStrokeDasharray,B.strokePanel=new S("Line color",X.defaultColorSet,X.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new _("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Z(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},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=k.createGroup(),this.selectorCurve=k.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=k.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(f,D){z.prototype.pointerDown.call(this,f,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(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()),k.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=k.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=k.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 f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/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(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),z.prototype.resize.call(this,f),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(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},s.prototype.scale=function(f,D){this.curveX=this.curveX*f,this.curveY=this.curveY*D,z.prototype.scale.call(this,f,D)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var D=f;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='',s}(c),xe=function(){function z(s,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=f}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Le=function(z){function s(f,D,X){var B=z.call(this,f,!1)||this;return B.dataUrl=D,B.state=X,B}return Z(s,z),s}(xe),Te=function(z){function s(f,D,X){X===void 0&&(X=!1);var B=z.call(this,f,X)||this;return B.marker=D,B}return Z(s,z),s}(xe),Se=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,f){this[s].push(f)},z.prototype.removeEventListener=function(s,f){var D=this[s].indexOf(f);D>-1&&this[s].splice(D,1)},z}(),ve=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 p,this._isOpen=!1,this.undoRedoManager=new me,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 Se,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new R(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[x,g,N,y,de,$,V,I,ne,j,h,De]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[x,g,N,y,$,V,I]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[x,g,N,y,V]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var f=this;this._availableMarkerTypes.splice(0),s.forEach(function(D){if(typeof D=="string"){var X=f.ALL_MARKER_TYPES.find(function(B){return B.typeName===D});X!==void 0&&f._availableMarkerTypes.push(X)}else f._availableMarkerTypes.push(D)})},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(),G.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&F.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=F.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new xe(s))})},z.prototype.render=function(){return O(this,void 0,void 0,function(){var s;return J(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(s=new H).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},z.prototype.close=function(s){var f=this;if(s===void 0&&(s=!1),this.isOpen){var D=!1;s||this.eventListeners.beforeclose.forEach(function(X){var B=new xe(f,!0);X(B),B.defaultPrevented&&(D=!0)}),D||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new xe(f))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,f=[],D=0;Dthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,D=f',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 M(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-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,f){if(s==="marker"&&f!==void 0)this.createNewMarker(f);else if(s==="action")switch(f){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 f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var B=new Te(s,s._currentMarker,!0);X(B),B.defaultPrevented&&(f=!0)}),!f){var D=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new Te(s,D))})}}},z.prototype.clear=function(){var s=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var be=new Te(s,void 0,!0);se(be),be.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var D=function(se){var be=X.markers[se];X.setCurrentMarker(X.markers[se]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(we){return we(new Te(s,be))})},X=this,B=this.markers.length-1;B>=0;B--)D(B);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===f.width&&D.height===f.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),X1&&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,f){var D=this.markerImage.getBoundingClientRect();return{x:(s-D.left)/this.zoomLevel,y:(f-D.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){G.addKey(s)},z.prototype.addEventListener=function(s,f){this.eventListeners.addEventListener(s,f)},z.prototype.removeEventListener=function(s,f){this.eventListeners.removeEventListener(s,f)},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(f){return f(new xe(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(f){return f(new xe(s))}))},z.instanceCounter=0,z}()},"VrN/":function(ht,$e,ue){(function(fe,Z){ht.exports=Z()})(this,function(){"use strict";var fe=navigator.userAgent,Z=navigator.platform,O=/gecko\/\d/i.test(fe),J=/MSIE \d/.test(fe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe),k=/Edge\/(\d+)/.exec(fe),G=J||U||k,H=G&&(J?document.documentMode||6:+(k||U)[1]),F=!k&&/WebKit\//.test(fe),R=F&&/Qt\/\d+\.\d+/.test(fe),E=!k&&/Chrome\//.test(fe),w=/Opera\//.test(fe),M=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fe),A=/PhantomJS/.test(fe),S=!k&&/AppleWebKit/.test(fe)&&/Mobile\/\w+/.test(fe),d=/Android/.test(fe),o=S||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fe),l=S||/Mac/.test(Z),u=/\bCrOS\b/.test(fe),C=/win/i.test(Z),v=w&&fe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(w=!1,F=!0);var m=l&&(R||w&&(v==null||v<12.11)),_=O||G&&H>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=function(e,t){var i=e.className,r=x(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return c(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var T=0;T=t)return W+(t-T);W+=Y-T,W+=i-W%i,T=Y+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};ne.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ne.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(W,t-n);if(n+=T-r,n+=i-n%i,r=T+1,n>=t)return r}}var ve=[""];function z(e){for(;ve.length<=e;)ve.push(s(ve)+" ");return ve[e]}function s(e){return e[e.length-1]}function f(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||se.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var _e=/[\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 Re(e){return e.charCodeAt(0)>=768&&_e.test(e)}function Pe(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,T=r<0?Math.ceil(n):Math.floor(n);if(T==t)return e(T)?t:i;e(T)?i=T:t=T+r}}function Ge(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,T=0;Tt||t==i&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,i),W.level==1?"rtl":"ltr",T),n=!0)}n||r(t,i,"ltr")}var ze=null;function We(e,t,i){var r;ze=null;for(var n=0;nt)return n;T.to==t&&(T.from!=T.to&&i=="before"?r=n:ze=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:ze=n)}return r!=null?r:ze}var nt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,W=/[Lb1n]/,Y=/[1n]/;function Q(re,pe,ge){this.level=re,this.from=pe,this.to=ge}return function(re,pe){var ge=pe=="ltr"?"L":"R";if(re.length==0||pe=="ltr"&&!r.test(re))return!1;for(var Ae=re.length,Ce=[],Ie=0;Ie-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function oe(e,t){var i=Ze(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function le(e){e.prototype.on=function(t,i){ke(this,t,i)},e.prototype.off=function(t,i){Ve(this,t,i)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ce(e){te(e),ae(e)}function ye(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(G&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),He;function et(e){if(He==null){var t=a("span","\u200B");h(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(He=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&H<8))}var i=He?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var rt;function vt(e){if(rt!=null)return rt;var t=h(e,document.createTextNode("A\u062EA")),i=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:rt=r.right-i.right<3}var ot=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` `,t);n==-1&&(n=e.length);var T=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),W=T.indexOf("\r");W!=-1?(i.push(T.slice(0,W)),t+=W+1):(i.push(T),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},it=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function It(e){if(xt!=null)return xt;var t=h(e,a("span","x")),i=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return xt=Math.abs(i.left-r.left)>1}var Ot={},Et={};function mr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function Tr(e,t){Et[e]=t}function Yt(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=B(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=Yt(t);var i=Ot[t.name];if(!i)return gr(e,"text/plain");var r=i(e,t);if(cr.hasOwnProperty(t.name)){var n=cr[t.name];for(var T in n){if(!n.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=n[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var cr={};function zr(e,t){var i=cr.hasOwnProperty(e)?cr[e]:cr[e]={};I(t,i)}function $t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Nr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function ti(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.post},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Je(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],T=n.chunkSize();if(t=e.first&&ti?Be(i,Je(e,i).text.length):_n(t,Je(e,t.line).text.length)}function _n(e,t){var i=e.ch;return i==null||i>t?Be(e.line,t):i<0?Be(e.line,0):e}function Ue(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Er.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}},Er.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Er.fromSaved=function(e,t,i){return t instanceof Si?new Er(e,$t(e.mode,t.state),i,t.lookAhead):new Er(e,$t(e.mode,t),i)},Er.prototype.save=function(e){var t=e!==!1?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Si(t,this.maxLookAhead):t};function Ki(e,t,i,r){var n=[e.state.modeGen],T={};Ar(e,t.text,e.doc.mode,i,function(re,pe){return n.push(re,pe)},T,r);for(var W=i.state,Y=function(re){i.baseTokens=n;var pe=e.state.overlays[re],ge=1,Ae=0;i.state=!0,Ar(e,t.text,pe.mode,i,function(Ce,Ie){for(var Ne=ge;AeCe&&n.splice(ge,1,Ce,n[ge+1],je),ge+=2,Ae=Math.min(Ce,je)}if(!Ie)return;if(pe.opaque)n.splice(Ne,ge-Ne,Ce,"overlay "+Ie),ge=Ne+2;else for(;Nee.options.maxHighlightLength&&$t(e.doc.mode,r.state),T=Ki(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Cr(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Er(r,!0,t);var T=kn(e,t,i),W=T>r.first&&Je(r,T-1).stateAfter,Y=W?Er.fromSaved(r,W,T):new Er(r,ti(r.mode),T);return r.iter(T,t,function(Q){Vi(e,Q.text,Y);var re=Y.line;Q.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&ret.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yi=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Ln(e,t,i,r){var n=e.doc,T=n.mode,W;t=ft(n,t);var Y=Je(n,t.line),Q=Cr(e,t.line,i),re=new Pt(Y.text,e.options.tabSize,Q),pe;for(r&&(pe=[]);(r||re.pose.options.maxHighlightLength?(Y=!1,W&&Vi(e,t,r,pe.pos),pe.pos=t.length,ge=null):ge=$i(wr(i,pe,r.state,Ae),T),Ae){var Ce=Ae[0].name;Ce&&(ge="m-"+(ge?Ce+" "+ge:Ce))}if(!Y||re!=ge){for(;QW;--Y){if(Y<=T.first)return T.first;var Q=Je(T,Y-1),re=Q.stateAfter;if(re&&(!i||Y+(re instanceof Si?re.lookAhead:0)<=T.modeFrontier))return Y;var pe=$(Q.text,null,e.options.tabSize);(n==null||r>pe)&&(n=Y-1,r=pe)}return n}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontieri;r--){var n=Je(e,r).stateAfter;if(n&&(!(n instanceof Si)||r+n.lookAhead=t:T.to>t);(r||(r=[])).push(new ai(W,T.from,Q?null:T.to))}}return r}function Rn(e,t,i){var r;if(e)for(var n=0;n=t:T.to>t);if(Y||T.from==t&&W.type=="bookmark"&&(!i||T.marker.insertLeft)){var Q=T.from==null||(W.inclusiveLeft?T.from<=t:T.from0&&Y)for(var tt=0;tt0)continue;var pe=[Q,1],ge=dt(re.from,Y.from),Ae=dt(re.to,Y.to);(ge<0||!W.inclusiveLeft&&!ge)&&pe.push({from:re.from,to:Y.from}),(Ae>0||!W.inclusiveRight&&!Ae)&&pe.push({from:Y.to,to:re.to}),n.splice.apply(n,pe),Q+=pe.length-3}return n}function la(e){var t=e.markedSpans;if(!t)return;for(var i=0;it)&&(!r||wi(r,T.marker)<0)&&(r=T.marker)}return r}function Mn(e,t,i,r,n){var T=Je(e,t),W=rr&&T.markedSpans;if(W)for(var Y=0;Y=0&&ge<=0||pe<=0&&ge>=0)continue;if(pe<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?dt(re.to,i)>=0:dt(re.to,i)>0)||pe>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?dt(re.from,r)<=0:dt(re.from,r)<0))return!0}}function yr(e){for(var t;t=Fr(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function _i(e){for(var t,i;t=Ur(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Qi(e,t){var i=Je(e,t),r=yr(i);return i==r?t:pt(r)}function Vr(e,t){if(t>e.lastLine())return t;var i=Je(e,t),r;if(!Or(e,i))return t;for(;r=Ur(i);)i=r.find(1,!0).line;return pt(i)+1}function Or(e,t){var i=rr&&t.markedSpans;if(i)for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var li=function(e,t,i){this.text=e,Ci(this,t),this.height=i?i(this):1};li.prototype.lineNo=function(){return pt(this)},le(li);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Ci(e,i);var n=r?r(e):1;n!=e.height&&mt(e,n)}function at(e){e.parent=null,la(e)}var ct={},lt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?lt:ct;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Ct(e,t){var i=y("span",null,null,F?"padding-right: .1px":null),r={pre:y("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var T=n?t.rest[n-1]:t.line,W=void 0;r.pos=0,r.addToken=St,vt(e.display.measure)&&(W=Ke(T,e.doc.direction))&&(r.addToken=ar(r.addToken,W)),r.map=[];var Y=t!=e.display.externalMeasured&&pt(T);jr(T,r,ni(e,T,Y)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=K(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=K(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(et(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(F){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Dt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function St(e,t,i,r,n,T,W){if(!t)return;var Y=e.splitSpaces?Ht(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,pe;if(!Q.test(t))e.col+=t.length,pe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,pe),G&&H<9&&(re=!0),e.pos+=t.length;else{pe=document.createDocumentFragment();for(var ge=0;;){Q.lastIndex=ge;var Ae=Q.exec(t),Ce=Ae?Ae.index-ge:t.length-ge;if(Ce){var Ie=document.createTextNode(Y.slice(ge,ge+Ce));G&&H<9?pe.appendChild(a("span",[Ie])):pe.appendChild(Ie),e.map.push(e.pos,e.pos+Ce,Ie),e.col+=Ce,e.pos+=Ce}if(!Ae)break;ge+=Ce+1;var Ne=void 0;if(Ae[0]==" "){var je=e.cm.options.tabSize,Xe=je-e.col%je;Ne=pe.appendChild(a("span",z(Xe),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Xe}else Ae[0]=="\r"||Ae[0]==` `?(Ne=pe.appendChild(a("span",Ae[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",Ae[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(Ae[0]),Ne.setAttribute("cm-text",Ae[0]),G&&H<9?pe.appendChild(a("span",[Ne])):pe.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||re||T||W){var qe=i||"";r&&(qe+=r),n&&(qe+=n);var Ye=a("span",[pe],qe,T);if(W)for(var tt in W)W.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ye.setAttribute(tt,W[tt]);return e.content.appendChild(Ye)}e.content.appendChild(pe)}function Ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nre&&ge.from<=re);Ae++);if(ge.to>=pe)return e(i,r,n,T,W,Y,Q);e(i,r.slice(0,ge.to-re),n,T,null,Y,Q),T=null,r=r.slice(ge.to-re),re=ge.to}}}function bt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function jr(e,t,i){var r=e.markedSpans,n=e.text,T=0;if(!r){for(var W=1;WQ||gt.collapsed&&st.to==Q&&st.from==Q)){if(st.to!=null&&st.to!=Q&&Ce>st.to&&(Ce=st.to,Ne=""),gt.className&&(Ie+=" "+gt.className),gt.css&&(Ae=(Ae?Ae+";":"")+gt.css),gt.startStyle&&st.from==Q&&(je+=" "+gt.startStyle),gt.endStyle&&st.to==Ce&&(tt||(tt=[])).push(gt.endStyle,st.to),gt.title&&((qe||(qe={})).title=gt.title),gt.attributes)for(var Rt in gt.attributes)(qe||(qe={}))[Rt]=gt.attributes[Rt];gt.collapsed&&(!Xe||wi(Xe.marker,gt)<0)&&(Xe=st)}else st.from>Q&&Ce>st.from&&(Ce=st.from)}if(tt)for(var Vt=0;Vt=Y)break;for(var pr=Math.min(Y,Ce);;){if(pe){var ur=Q+pe.length;if(!Xe){var jt=ur>pr?pe.slice(0,pr-Q):pe;t.addToken(t,jt,ge?ge+Ie:Ie,je,Q+jt.length==Ce?Ne:"",Ae,qe)}if(ur>=pr){pe=pe.slice(pr-Q),Q=pr;break}Q=ur,je=""}pe=n.slice(T,T=i[re++]),ge=yt(i[re++],t.cm.options)}}}function _t(e,t,i){this.line=t,this.rest=_i(t),this.size=this.rest?pt(s(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Or(e,t)}function or(e,t,i){for(var r=[],n,T=t;T2&&T.push((Q.bottom+re.top)/2-i.top)}}T.push(i.bottom-i.top)}}function eo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=yr(t);var i=pt(t),r=e.display.externalMeasured=new _t(e.doc,t,i);r.lineN=i;var n=r.built=Ct(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Mr(e,Li(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(T=Q-Y,n=T-1,t>=Q&&(W="right")),n!=null){if(r=e[re+2],Y==Q&&i==(r.insertLeft?"left":"right")&&(W=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],W="left";if(i=="right"&&n==Q-Y)for(;re=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=io(t.map,i,r),T=n.node,W=n.start,Y=n.end,Q=n.collapse,re;if(T.nodeType==3){for(var pe=0;pe<4;pe++){for(;W&&Re(t.line.text.charAt(n.coverStart+W));)--W;for(;n.coverStart+Y0&&(Q=r="right");var ge;e.options.lineWrapping&&(ge=T.getClientRects()).length>1?re=ge[r=="right"?ge.length-1:0]:re=T.getBoundingClientRect()}if(G&&H<9&&!W&&(!re||!re.left&&!re.right)){var Ae=T.parentNode.getClientRects()[0];Ae?re={left:Ae.left,right:Ae.left+Di(e.display),top:Ae.top,bottom:Ae.bottom}:re=ro}for(var Ce=re.top-t.rect.top,Ie=re.bottom-t.rect.top,Ne=(Ce+Ie)/2,je=t.view.measure.heights,Xe=0;Xe=r.text.length?(Q=r.text.length,re="before"):Q<=0&&(Q=0,re="after"),!Y)return W(re=="before"?Q-1:Q,re=="before");function pe(Ie,Ne,je){var Xe=Y[Ne],qe=Xe.level==1;return W(je?Ie-1:Ie,qe!=je)}var ge=We(Y,Q,re),Ae=ze,Ce=pe(Q,ge,re=="before");return Ae!=null&&(Ce.other=pe(Q,Ae,re!="before")),Ce}function uo(e,t){var i=0;t=ft(e.doc,t),e.options.lineWrapping||(i=Di(e.display)*t.ch);var r=Je(e.doc,t.line),n=Lr(r)+Bn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var T=Be(e,t,i);return T.xRel=n,r&&(T.outside=r),T}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=At(r,i),T=r.first+r.size-1;if(n>T)return ga(r.first+r.size-1,Je(r,T).text.length,null,1,1);t<0&&(t=0);for(var W=Je(r,n);;){var Y=Gs(e,W,n,t,i),Q=Ai(W,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var re=Q.find(1);if(re.line==n)return re;W=Je(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,T=Fe(function(W){return Mr(e,i,W-1).bottom<=r},n,0);return n=Fe(function(W){return Mr(e,i,W).top>r},T,n),{begin:T,end:n}}function co(e,t,i,r){i||(i=Li(e,t));var n=Fn(e,t,Mr(e,i,r),"line").top;return ho(e,t,i,n)}function ya(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Lr(t);var T=Li(e,t),W=pa(t),Y=0,Q=t.text.length,re=!0,pe=Ke(t,e.doc.direction);if(pe){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,T,pe,r,n);re=ge.level!=1,Y=re?ge.from:ge.to-1,Q=re?ge.to:ge.from-1}var Ae=null,Ce=null,Ie=Fe(function(ut){var st=Mr(e,T,ut);return st.top+=W,st.bottom+=W,ya(st,r,n,!1)?(st.top<=n&&st.left<=r&&(Ae=ut,Ce=st),!0):!1},Y,Q),Ne,je,Xe=!1;if(Ce){var qe=r-Ce.left=tt.bottom?1:0}return Ie=Pe(t.text,Ie,1),ga(i,Ie,je,Xe,r-Ne)}function zs(e,t,i,r,n,T,W){var Y=Fe(function(ge){var Ae=n[ge],Ce=Ae.level!=1;return ya(kr(e,Be(i,Ce?Ae.to:Ae.from,Ce?"before":"after"),"line",t,r),T,W,!0)},0,n.length-1),Q=n[Y];if(Y>0){var re=Q.level!=1,pe=kr(e,Be(i,re?Q.from:Q.to,re?"after":"before"),"line",t,r);ya(pe,T,W,!0)&&pe.top>W&&(Q=n[Y-1])}return Q}function Ks(e,t,i,r,n,T,W){var Y=ho(e,t,r,W),Q=Y.begin,re=Y.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var pe=null,ge=null,Ae=0;Ae=re||Ce.to<=Q)continue;var Ie=Ce.level!=1,Ne=Mr(e,r,Ie?Math.min(re,Ce.to)-1:Math.max(Q,Ce.from)).right,je=Neje)&&(pe=Ce,ge=je)}return pe||(pe=n[n.length-1]),pe.fromre&&(pe={from:pe.from,to:re,level:pe.level}),pe}var hi;function ki(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hi==null){hi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hi.appendChild(document.createTextNode("x")),hi.appendChild(a("br"));hi.appendChild(document.createTextNode("x"))}h(e.measure,hi);var i=hi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Di(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,T=t.gutters.firstChild,W=0;T;T=T.nextSibling,++W){var Y=e.display.gutterSpecs[W].className;i[Y]=T.offsetLeft+T.clientLeft+n,r[Y]=T.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=ki(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Di(e.display)-3);return function(n){if(Or(e.doc,n))return 0;var T=0;if(n.widgets)for(var W=0;W0&&(re=Je(e.doc,Q.line).text).length==Q.ch){var pe=$(re,re.length,e.options.tabSize)-re.length;Q=Be(Q.line,Math.max(0,Math.round((T-qa(e.display).left)/Di(e.display))-pe))}return Q}function ci(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&Qi(e.doc,t)n.viewFrom?Yr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Yr(e);else if(t<=n.viewFrom){var T=Un(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):Yr(e)}else if(i>=n.viewTo){var W=Un(e,t,t,-1);W?(n.view=n.view.slice(0,W.index),n.viewTo=W.lineN):Yr(e)}else{var Y=Un(e,t,t,-1),Q=Un(e,i,i+r,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(or(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=r):Yr(e)}var re=n.externalMeasured;re&&(i=n.lineN&&t=r.viewTo)return;var T=r.view[ci(e,t)];if(T.node==null)return;var W=T.changes||(T.changes=[]);de(W,i)==-1&&W.push(i)}function Yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,i,r){var n=ci(e,t),T,W=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Q=0;Q0){if(n==W.length-1)return null;T=Y+W[n].size-t,n++}else T=Y-t;t+=T,i+=T}for(;Qi(e.doc,i)!=i;){if(n==(r<0?0:W.length-1))return null;i+=r*W[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=or(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=or(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,ci(e,i)))),r.viewTo=i}function po(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||Y.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Ri(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ri(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(oe(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(),F&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Ri(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(oe(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r.005||pe<-.005)&&(mt(n.line,W),bo(n.line),n.rest))for(var ge=0;gee.display.sizerWidth){var Ae=Math.ceil(Y/Di(e.display));Ae>e.display.maxLineLength&&(e.display.maxLineLength=Ae,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t=W&&(T=At(t,Lr(Je(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:T,to:Math.max(W,T+1)}}function Ys(e,t){if(q(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!A){var T=a("div","\u200B",null,`position: absolute; top: `+(t.top-i.viewOffset-Bn(e.display))+`px; height: `+(t.bottom-t.top+Pr(e)+i.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(n),e.display.lineSpace.removeChild(T)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var W=!1,Y=kr(e,t),Q=!i||i==t?Y:kr(e,i);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var re=Ca(e,n),pe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-pe)>1&&(W=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(W=!0)),!W)break}return n}function Zs(e,t){var i=Ca(e,t);i.scrollTop!=null&&ln(e,i.scrollTop),i.scrollLeft!=null&&fi(e,i.scrollLeft)}function Ca(e,t){var i=e.display,r=ki(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,T=ca(e),W={};t.bottom-t.top>T&&(t.bottom=t.top+T);var Y=e.doc.height+da(i),Q=t.topY-r;if(t.topn+T){var pe=Math.min(t.top,(re?Y:t.bottom)-T);pe!=n&&(W.scrollTop=pe)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,Ae=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ce=ui(e)-i.gutters.offsetWidth,Ie=t.right-t.left>Ce;return Ie&&(t.right=t.left+Ce),t.left<10?W.scrollLeft=0:t.leftCe+Ae-3&&(W.scrollLeft=t.right+(Ie?0:10)-Ce),W}function wa(e,t){if(t==null)return;Gn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Oi(e){Gn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sn(e,t,i){(t!=null||i!=null)&&Gn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Gn(e),e.curOp.scrollToPos=t}function Gn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);xo(e,i,r,t.margin)}}function xo(e,t,i,r){var n=Ca(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});sn(e,n.scrollLeft,n.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||_a(e,{top:t}),Eo(e,t,!0),O&&_a(e),dn(e,100)}function Eo(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+da(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Pr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var pi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ne,this.disableVert=new ne},pi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),T=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hn=function(){};hn.prototype.update=function(){return{bottom:0,right:0}},hn.prototype.setScrollLeft=function(){},hn.prototype.setScrollTop=function(){},hn.prototype.clear=function(){};function Pi(e,t){t||(t=un(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Wn(e),So(e,un(e)),i=e.display.barWidth,r=e.display.barHeight}function So(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var To={native:pi,null:hn};function Co(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new To[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?fi(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function mi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},Sr(e.curOp)}function gi(e){var t=e.curOp;t&&Rs(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new zn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Wn(t),e.barMeasure=un(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Pr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-ui(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Cr(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var W=T.styles,Y=T.text.length>e.options.maxHighlightLength?$t(t.mode,r.state):null,Q=Ki(e,T,r,!0);Y&&(r.state=Y),T.styles=Q.styles;var re=T.styleClasses,pe=Q.classes;pe?T.styleClasses=pe:re&&(T.styleClasses=null);for(var ge=!W||W.length!=T.styles.length||re!=pe&&(!re||!pe||re.bgClass!=pe.bgClass||re.textClass!=pe.textClass),Ae=0;!ge&&Aei)return dn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&fr(e,function(){for(var T=0;T=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&po(e)==0)return!1;_o(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromW&&i.viewTo-W<20&&(W=Math.min(n,i.viewTo)),rr&&(T=Qi(e.doc,T),W=Vr(e.doc,W));var Y=T!=i.viewFrom||W!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,W),i.viewOffset=Lr(Je(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Q=po(e);if(!Y&&Q==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return Q>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Q>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,dn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+da(e.display)-ca(e),i.top)}),t.visible=Hn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hn(e.display,e.doc,i));if(!Aa(e,t))break;Wn(e);var n=un(e);on(e),Pi(e,n),ka(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 _a(e,t){var i=new zn(e,t);if(Aa(e,i)){Wn(e),wo(e,i);var r=un(e);on(e),Pi(e,r),ka(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,T=r.lineDiv,W=T.firstChild;function Y(Ie){var Ne=Ie.nextSibling;return F&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Ne}for(var Q=r.view,re=r.viewFrom,pe=0;pe-1&&(Ce=!1),Ya(e,ge,re,i)),Ce&&(c(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(Ut(e.options,re)))),W=ge.node.nextSibling}re+=ge.size}for(;W;)W=Y(W)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Pr(e)+"px"}function Ao(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,T=r+"px",W=0;WW.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&Y||n&&Q))return;if(n&&l&&F){e:for(var re=t.target,pe=T.view;re!=W;re=re.parentNode)for(var ge=0;ge=0&&dt(e,r.to())<=0)return i}return-1};var Lt=function(e,t){this.anchor=e,this.head=t};Lt.prototype.from=function(){return ii(this.anchor,this.head)},Lt.prototype.to=function(){return xi(this.anchor,this.head)},Lt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Dr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Ae,Ce){return dt(Ae.from(),Ce.from())}),i=de(t,n);for(var T=1;T0:Q>=0){var re=ii(Y.from(),W.from()),pe=xi(Y.to(),W.to()),ge=Y.empty()?W.from()==W.head:Y.from()==Y.head;T<=i&&--i,t.splice(--T,2,new Lt(ge?pe:re,ge?re:pe))}}return new xr(t,i)}function $r(e,t){return new xr([new Lt(e,t||e)],0)}function Zr(e){return e.text?Be(e.from.line+e.text.length-1,s(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Zr(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+=Zr(t).ch-t.to.ch),Be(i,r)}function Ra(e,t){for(var i=[],r=0;r1&&e.remove(Y.line+1,Ie-1),e.insert(Y.line+1,Xe)}Jt(e,"change",e,t)}function Jr(e,t,i){function r(n,T,W){if(n.linked)for(var Y=0;Y1&&!e.done[e.done.length-2].ranges)return e.done.pop(),s(e.done)}function Bo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,W,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(n,n.lastOp==r)))Y=s(W.changes),dt(t.from,t.to)==0&&dt(t.from,Y.to)==0?Y.to=Zr(t):W.changes.push(Ma(e,t));else{var Q=s(n.done);for((!Q||!Q.ranges)&&Xn(e.sel,n.done),W={changes:[Ma(e,t)],generation:n.generation},n.done.push(W);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=T,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||oe(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,s(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Xn(e,t){var i=s(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Fo(e,t,i,r){var n=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((n||(n=t["spans_"+e.id]={}))[T]=W.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,i=0;i-1&&(s(Y)[ge]=re[ge],delete re[ge]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var T=dt(t,n)<0;T!=dt(i,n)<0?(n=t,t=i):T!=dt(t,i)<0&&(t=i)}return new Lt(n,t)}else return new Lt(i||t,t)}function Yn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),er(e,new xr([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),T=0;T=t.ch:Y.to>t.ch))){if(n&&(oe(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(T.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(i){var ge=Q.find(r<0?1:-1),Ae=void 0;if((r<0?pe:re)&&(ge=Vo(e,ge,-r,ge&&ge.line==t.line?T:null)),ge&&ge.line==t.line&&(Ae=dt(ge,i))&&(r<0?Ae<0:Ae>0))return Ii(e,ge,t,r,n)}var Ce=Q.find(r<0?-1:1);return(r<0?re:pe)&&(Ce=Vo(e,Ce,r,Ce.line==t.line?T:null)),Ce?Ii(e,Ce,t,r,n):null}}return t}function Zn(e,t,i,r,n){var T=r||1,W=Ii(e,t,i,T,n)||!n&&Ii(e,t,i,T,!0)||Ii(e,t,i,-T,n)||!n&&Ii(e,t,i,-T,!0);return W||(e.cantEdit=!0,Be(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ft(e,Be(t.line-1)):null:i>0&&t.ch==(r||Je(e,t.line)).text.length?t.line=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]==""&&dt(t.from,t.to)==0)return;var i=Ra(e,t);Bo(e,t,i,e.cm?e.cm.curOp.id:NaN),pn(e,t,i,Ti(e,t));var r=[];Jr(e,function(n,T){!T&&de(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),pn(n,t,null,Ti(n,t))})}function Jn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,W=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,re=0;re=0;--Ce){var Ie=Ae(Ce);if(Ie)return Ie.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new xr(f(e.sel.ranges,function(n){return new Lt(Be(n.anchor.line+t,n.anchor.ch),Be(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){sr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())return;if(t.from.lineT&&(t={from:t.from,to:Be(T,Je(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Tt(e,t.from,t.to),i||(i=Ra(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),$n(e,i,xe),e.cantEdit&&Zn(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,T=t.from,W=t.to,Y=!1,Q=T.line;e.options.lineWrapping||(Q=pt(yr(Je(r,T.line))),r.iter(Q,W.line+1,function(Ce){if(Ce==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ee(e),Pa(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Q,T.line+t.text.length,function(Ce){var Ie=en(Ce);Ie>n.maxLineLength&&(n.maxLine=Ce,n.maxLineLength=Ie,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),dn(e,400);var re=t.text.length-(W.line-T.line)-1;t.full?sr(e):T.line==W.line&&t.text.length==1&&!Po(e.doc,t)?Xr(e,T.line,"text"):sr(e,T.line,W.line+1,re);var pe=ie(e,"changes"),ge=ie(e,"change");if(ge||pe){var Ae={from:T,to:W,text:t.text,removed:t.removed,origin:t.origin};ge&&Jt(e,"change",e,Ae),pe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ae)}e.display.selForContextMenu=null}function Bi(e,t,i,r,n){var T;r||(r=i),dt(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:i,to:r,text:t,origin:n})}function Jo(e,t,i,r){i1||!(this.children[0]instanceof gn))){var Y=[];this.collapse(Y),this.children=[new gn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var W=n.lines.length%25+25,Y=W;Y10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=pe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&sr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&Jt(e,"markerCleared",e,this,r,n),t&&gi(e),this.parent&&this.parent.clear()},Qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||W==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=y("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Mn(e,t.line,t,i,T)||t.line!=i.line&&Mn(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Bo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,re;if(e.iter(Y,i.line+1,function(ge){Q&&T.collapsed&&!Q.options.lineWrapping&&yr(ge)==Q.display.maxLine&&(re=!0),T.collapsed&&Y!=t.line&&mt(ge,0),sa(ge,new ai(T,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),T.collapsed&&e.iter(t.line,i.line+1,function(ge){Or(e,ge)&&mt(ge,0)}),T.clearOnEnter&&ke(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),T.collapsed)sr(Q,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var pe=t.line;pe<=i.line;pe++)Xr(Q,pe,"text");T.atomic&&zo(Q.doc),Jt(Q,"markerAdded",Q,T)}return T}var bn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;Q--)Ni(this,r[Q]);Y?Ho(this,Y):this.cm&&Oi(this.cm)}),undo:Kt(function(){Jn(this,"undo")}),redo:Kt(function(){Jn(this,"redo")}),undoSelection:Kt(function(){Jn(this,"undo",!0)}),redoSelection:Kt(function(){Jn(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.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ft(this,e),t=ft(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var W=T.markedSpans;if(W)for(var Y=0;Y=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!i||i(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=T,++i}),ft(this,Be(i,t))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var pe=e.dataTransfer.getData("Text");if(pe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),$n(t.doc,$r(i,i)),ge)for(var Ae=0;Ae=0;Y--)Bi(e.doc,"",r[Y].from,r[Y].to,"+delete");Oi(e)})}function Ba(e,t,i){var r=Pe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ba(e,t.ch,i);return r==null?null:new Be(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=Ke(i,t.doc.direction);if(T){var W=n<0?s(T):T[0],Y=n<0==(W.level==1),Q=Y?"after":"before",re;if(W.level>0||t.doc.direction=="rtl"){var pe=Li(t,i);re=n<0?i.text.length-1:0;var ge=Mr(t,pe,re).top;re=Fe(function(Ae){return Mr(t,pe,Ae).top==ge},n<0==(W.level==1)?W.from:W.to-1,re),Q=="before"&&(re=Ba(i,re,1))}else re=n<0?W.to:W.from;return new Be(r,re,Q)}}return new Be(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Ke(t,e.doc.direction);if(!n)return Fa(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var T=We(n,i.ch,i.sticky),W=n[T];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>i.ch:W.from=W.from&&Ae>=pe.begin)){var Ce=ge?"before":"after";return new Be(i.line,Ae,Ce)}}var Ie=function(Xe,qe,Ye){for(var tt=function(Rt,Vt){return Vt?new Be(i.line,Y(Rt,1),"before"):new Be(i.line,Rt,"after")};Xe>=0&&Xe0==(ut.level!=1),gt=st?Ye.begin:Y(Ye.end,-1);if(ut.from<=gt&>0?pe.end:Y(pe.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ne=Ie(r>0?0:n.length-1,r,re(je)),Ne)?Ne:null}var Sn={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return ji(e,function(t){if(t.empty()){var i=Je(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new Be(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),Be(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var W=Je(e.doc,n.line-1).text;W&&(n=new Be(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),Be(n.line-1,W.length-1),n,"+transpose"))}}i.push(new Lt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return fr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&dt(t,this.pos)==0&&i==this.button};var Cn,wn;function Wl(e,t){var i=+new Date;return wn&&wn.compare(i,e,t)?(Cn=wn=null,"triple"):Cn&&Cn.compare(i,e,t)?(wn=new Wa(i,e,t),Cn=null,"double"):(Cn=new Wa(i,e,t),wn=null,"single")}function vs(e){var t=this,i=t.display;if(q(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Wr(i,e)){F||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=di(t,e),n=Ee(e),T=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,T,e))return;n==1?r?zl(t,r,T,e):ye(e)==i.scroller&&te(e):n==2?(r&&Yn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(_?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Tn(e,ls(T,n),n,function(W){if(typeof W=="string"&&(W=Sn[W]),!W)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=W(e,i)!=De}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var T=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(P(vo,e),0):e.curOp.focus=N();var n=Gl(e,i,r),T=e.doc.sel,W;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(W=T.contains(t))>-1&&(dt((W=T.ranges[W]).from(),t)<0||t.xRel>0)&&(dt(W.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,T=!1,W=zt(e,function(re){F&&(n.scroller.draggable=!1),e.state.draggingText=!1,Ve(n.wrapper.ownerDocument,"mouseup",W),Ve(n.wrapper.ownerDocument,"mousemove",Y),Ve(n.scroller,"dragstart",Q),Ve(n.scroller,"drop",W),T||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),F&&!M||G&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(re){T=T||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return T=!0};F&&(n.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),ke(n.wrapper.ownerDocument,"mouseup",W),ke(n.wrapper.ownerDocument,"mousemove",Y),ke(n.scroller,"dragstart",Q),ke(n.scroller,"drop",W),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Lt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Lt(Be(t.line,0),ft(e.doc,Be(t.line+1,0)));var r=i(e,t);return new Lt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;te(t);var W,Y,Q=T.sel,re=Q.ranges;if(r.addNew&&!r.extend?(Y=T.sel.contains(i),Y>-1?W=re[Y]:W=new Lt(i,i)):(W=T.sel.primary(),Y=T.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new Lt(i,i)),i=di(e,t,!0,!0),Y=-1;else{var pe=ys(e,i,r.unit);r.extend?W=Ia(W,pe.anchor,pe.head,r.extend):W=pe}r.addNew?Y==-1?(Y=re.length,er(T,Dr(e,re.concat([W]),Y),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Y].empty()&&r.unit=="char"&&!r.extend?(er(T,Dr(e,re.slice(0,Y).concat(re.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=T.sel):Na(T,Y,W,Le):(Y=0,er(T,new xr([W],0),Le),Q=T.sel);var ge=i;function Ae(Ye){if(dt(ge,Ye)==0)return;if(ge=Ye,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,st=$(Je(T,i.line).text,i.ch,ut),gt=$(Je(T,Ye.line).text,Ye.ch,ut),Rt=Math.min(st,gt),Vt=Math.max(st,gt),Nt=Math.min(i.line,Ye.line),pr=Math.min(e.lastLine(),Math.max(i.line,Ye.line));Nt<=pr;Nt++){var ur=Je(T,Nt).text,jt=Se(ur,Rt,ut);Rt==Vt?tt.push(new Lt(Be(Nt,jt),Be(Nt,jt))):ur.length>jt&&tt.push(new Lt(Be(Nt,jt),Be(Nt,Se(ur,Vt,ut))))}tt.length||tt.push(new Lt(i,i)),er(T,Dr(e,Q.ranges.slice(0,Y).concat(tt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ye)}else{var hr=W,Qt=ys(e,Ye,r.unit),Gt=hr.anchor,Wt;dt(Qt.anchor,Gt)>0?(Wt=Qt.head,Gt=ii(hr.from(),Qt.anchor)):(Wt=Qt.anchor,Gt=xi(hr.to(),Qt.head));var Bt=Q.ranges.slice(0);Bt[Y]=Xl(e,new Lt(ft(T,Gt),Wt)),er(T,Dr(e,Bt,Y),Le)}}var Ce=n.wrapper.getBoundingClientRect(),Ie=0;function Ne(Ye){var tt=++Ie,ut=di(e,Ye,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,ge)!=0){e.curOp.focus=N(),Ae(ut);var st=Hn(n,T);(ut.line>=st.to||ut.lineCe.bottom?20:0;gt&&setTimeout(zt(e,function(){if(Ie!=tt)return;n.scroller.scrollTop+=gt,Ne(Ye)}),50)}}function je(Ye){e.state.selectingText=!1,Ie=Infinity,Ye&&(te(Ye),n.input.focus()),Ve(n.wrapper.ownerDocument,"mousemove",Xe),Ve(n.wrapper.ownerDocument,"mouseup",qe),T.history.lastSelOrigin=null}var Xe=zt(e,function(Ye){Ye.buttons===0||!Ee(Ye)?je(Ye):Ne(Ye)}),qe=zt(e,je);e.state.selectingText=qe,ke(n.wrapper.ownerDocument,"mousemove",Xe),ke(n.wrapper.ownerDocument,"mouseup",qe)}function Xl(e,t){var i=t.anchor,r=t.head,n=Je(e.doc,i.line);if(dt(i,r)==0&&i.sticky==r.sticky)return t;var T=Ke(n);if(!T)return t;var W=We(T,i.ch,i.sticky),Y=T[W];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Q=W+(Y.from==i.ch==(Y.level!=1)?0:1);if(Q==0||Q==T.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var pe=We(T,r.ch,r.sticky),ge=pe-W||(r.ch-i.ch)*(Y.level==1?-1:1);pe==Q-1||pe==Q?re=ge<0:re=ge>0}var Ae=T[Q+(re?-1:0)],Ce=re==(Ae.level==1),Ie=Ce?Ae.from:Ae.to,Ne=Ce?"after":"before";return i.ch==Ie&&i.sticky==Ne?t:new Lt(new Be(i.line,Ie,Ne),r)}function bs(e,t,i,r){var n,T;if(t.touches)n=t.touches[0].clientX,T=t.touches[0].clientY;else try{n=t.clientX,T=t.clientY}catch(Ae){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var W=e.display,Y=W.lineDiv.getBoundingClientRect();if(T>Y.bottom||!ie(e,i))return he(t);T-=Y.top-W.viewOffset;for(var Q=0;Q=n){var pe=At(e.doc,T),ge=e.display.gutterSpecs[Q];return oe(e,i,e,pe,ge.className,t),he(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Wr(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function Yl(e,t){return ie(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Wi={toString:function(){return"CodeMirror.Init"}},Ss={},ta={};function $l(e){var t=e.optionHandlers;function i(r,n,T,W){e.defaults[r]=n,T&&(t[r]=W?function(Y,Q,re){re!=Wi&&T(Y,Q,re)}:T)}e.defineOption=i,e.Init=Wi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){fn(r),an(r),sr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var T=[],W=r.doc.first;r.doc.iter(function(Q){for(var re=0;;){var pe=Q.text.indexOf(n,re);if(pe==-1)break;re=pe+n.length,T.push(Be(W,pe))}W++});for(var Y=T.length-1;Y>=0;Y--)Bi(r.doc,n,T[Y],Be(T[Y].line,T[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,T){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),T!=Wi&&r.refresh()}),i("specialCharPlaceholder",Dt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!C),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),cn(r)},!0),i("keyMap","default",function(r,n,T){var W=qn(n),Y=T!=Wi&&qn(T);Y&&Y.detach&&Y.detach(r,W),W.attach&&W.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Da(n,r.options.lineNumbers),cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?xa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pi(r)},!0),i("scrollbarStyle","native",function(r){Co(r),Pi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Da(r.options.gutters,n),cn(r)},!0),i("firstLineNumber",1,cn,!0),i("lineNumberFormatter",function(r){return r},cn,!0),i("showCursorWhenSelecting",!1,on,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Ri(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,on,!0),i("singleCursorHeightPerLine",!0,on,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,fn,!0),i("addModeClass",!1,fn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,fn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=Wi;if(!t!=!r){var n=e.display.dragFunctions,T=t?ke:Ve;T(e.display.scroller,"dragstart",n.start),T(e.display.scroller,"dragenter",n.enter),T(e.display.scroller,"dragover",n.over),T(e.display.scroller,"dragleave",n.leave),T(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Ea(e),sr(e),an(e),setTimeout(function(){return Pi(e)},100)}function Mt(e,t){var i=this;if(!(this instanceof Mt))return new Mt(e,t);this.options=t=t?I(t):{},I(Ss,t,!1);var r=t.value;typeof r=="string"?r=new lr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Mt.inputStyles[t.inputStyle](this),T=this.display=new hl(e,r,n,t);T.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Co(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 ne,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),G&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),mi(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Ri(this);for(var W in ta)ta.hasOwnProperty(W)&&ta[W](this,t[W],Wi);_o(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y20*20}ke(t.scroller,"touchstart",function(Q){if(!q(e,Q)&&!T(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!Wr(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var pe=e.coordsChar(t.activeTouch,"page"),ge;!re.prev||W(re,re.prev)?ge=new Lt(pe,pe):!re.prev.prev||W(re,re.prev.prev)?ge=e.findWordAt(pe):ge=new Lt(Be(pe.line,0),ft(e.doc,Be(pe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(Q)}n()}),ke(t.scroller,"touchcancel",n),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),oe(e,"scroll",e))}),ke(t.scroller,"mousewheel",function(Q){return Do(e,Q)}),ke(t.scroller,"DOMMouseScroll",function(Q){return Do(e,Q)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){q(e,Q)||ce(Q)},over:function(Q){q(e,Q)||(Ll(e,Q),ce(Q))},start:function(Q){return _l(e,Q)},drop:zt(e,Al),leave:function(Q){q(e,Q)||ns(e)}};var Y=t.input.getField();ke(Y,"keyup",function(Q){return ms.call(e,Q)}),ke(Y,"keydown",zt(e,ps)),ke(Y,"keypress",zt(e,gs)),ke(Y,"focus",function(Q){return Ta(e,Q)}),ke(Y,"blur",function(Q){return Ri(e,Q)})}var Ga=[];Mt.defineInitHook=function(e){return Ga.push(e)};function An(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=Cr(e,t).state:i="prev");var W=e.options.tabSize,Y=Je(n,t),Q=$(Y.text,null,W);Y.stateAfter&&(Y.stateAfter=null);var re=Y.text.match(/^\s*/)[0],pe;if(!r&&!/\S/.test(Y.text))pe=0,i="not";else if(i=="smart"&&(pe=n.mode.indent(T,Y.text.slice(re.length),Y.text),pe==De||pe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?pe=$(Je(n,t-1).text,null,W):pe=0:i=="add"?pe=Q+e.options.indentUnit:i=="subtract"?pe=Q-e.options.indentUnit:typeof i=="number"&&(pe=Q+i),pe=Math.max(0,pe);var ge="",Ae=0;if(e.options.indentWithTabs)for(var Ce=Math.floor(pe/W);Ce;--Ce)Ae+=W,ge+=" ";if(AeW,Q=ot(t),re=null;if(Y&&r.ranges.length>1)if(Rr&&Rr.text.join(` `)==t){if(r.ranges.length%Rr.text.length==0){re=[];for(var pe=0;pe=0;Ae--){var Ce=r.ranges[Ae],Ie=Ce.from(),Ne=Ce.to();Ce.empty()&&(i&&i>0?Ie=Be(Ie.line,Ie.ch-i):e.state.overwrite&&!Y?Ne=Be(Ne.line,Math.min(Je(T,Ne.line).text.length,Ne.ch+s(Q).length)):Y&&Rr&&Rr.lineWise&&Rr.text.join(` `)==Q.join(` `)&&(Ie=Ne=Be(Ie.line,0)));var je={from:Ie,to:Ne,text:re?re[Ae%re.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>W?"cut":"+input")};Ni(e.doc,je),Jt(e,"inputRead",e,je)}t&&!Y&&Cs(e,t),Oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ts(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&fr(t,function(){return za(t,i,0,null,"paste")}),!0}function Cs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var T=e.getModeAt(n.head),W=!1;if(T.electricChars){for(var Y=0;Y-1){W=An(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(Je(e.doc,n.head.line).text.slice(0,n.head.ch))&&(W=An(e,n.head.line,"smart")));W&&Jt(e,"electricInput",e,n.head.line)}}function ws(e){for(var t=[],i=[],r=0;rT&&(An(this,Y.head.line,r,!0),T=Y.head.line,W==this.doc.sel.primIndex&&Oi(this));else{var Q=Y.from(),re=Y.to(),pe=Math.max(T,Q.line);T=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ge=pe;ge0&&Na(this.doc,W,new Lt(Q,Ae[W].to()),xe)}}}),getTokenAt:function(r,n){return Ln(this,r,n)},getLineTokens:function(r,n){return Ln(this,Be(r),n,!0)},getTokenTypeAt:function(r){r=ft(this.doc,r);var n=ni(this,Je(this.doc,r.line)),T=0,W=(n.length-1)/2,Y=r.ch,Q;if(Y==0)Q=n[2];else for(;;){var re=T+W>>1;if((re?n[re*2-1]:0)>=Y)W=re;else if(n[re*2+1]Q&&(r=Q,W=!0),Y=Je(this.doc,r)}else Y=r;return Fn(this,Y,{top:0,left:0},n||"page",T||W).top+(W?this.doc.height-Lr(Y):0)},defaultTextHeight:function(){return ki(this.display)},defaultCharWidth:function(){return Di(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,T,W,Y){var Q=this.display;r=kr(this,ft(this.doc,r));var re=r.bottom,pe=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),W=="over")re=r.top;else if(W=="above"||W=="near"){var ge=Math.max(Q.wrapper.clientHeight,this.doc.height),Ae=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(W=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(re=r.bottom),pe+n.offsetWidth>Ae&&(pe=Ae-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",Y=="right"?(pe=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?pe=0:Y=="middle"&&(pe=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=pe+"px"),T&&Zs(this,{left:pe,top:re,right:pe+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:ir(ps),triggerOnKeyPress:ir(gs),triggerOnKeyUp:ms,triggerOnMouseDown:ir(vs),execCommand:function(r){if(Sn.hasOwnProperty(r))return Sn[r].call(null,this)},triggerElectric:ir(function(r){Cs(this,r)}),findPosH:function(r,n,T,W){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=ft(this.doc,r),re=0;re0&&pe(T.charAt(W-1));)--W;for(;Y.5||this.options.lineWrapping)&&Ea(this),oe(this,"refresh",this)}),swapDoc:ir(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),an(this),this.display.input.reset(),sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Jt(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}},le(e),e.registerHelper=function(r,n,T){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=T},e.registerGlobalHelper=function(r,n,T,W){e.registerHelper(r,n,W),i[r]._global.push({pred:T,val:W})}}function Ka(e,t,i,r,n){var T=t,W=i,Y=Je(e,t.line),Q=n&&e.direction=="rtl"?-i:i;function re(){var qe=t.line+Q;return qe=e.first+e.size?!1:(t=new Be(qe,t.ch,t.sticky),Y=Je(e,qe))}function pe(qe){var Ye;if(r=="codepoint"){var tt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ye=null:Ye=new Be(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(tt>=55296&&tt<56320?2:1))),-i)}else n?Ye=Ml(e.cm,Y,t,i):Ye=Fa(Y,t,i);if(Ye==null)if(!qe&&re())t=Ua(n,e.cm,Y,t.line,Q);else return!1;else t=Ye;return!0}if(r=="char"||r=="codepoint")pe();else if(r=="column")pe(!0);else if(r=="word"||r=="group")for(var ge=null,Ae=r=="group",Ce=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(i<0&&!pe(!Ie));Ie=!1){var Ne=Y.text.charAt(t.ch)||` `,je=we(Ne,Ce)?"w":Ae&&Ne==` `?"n":!Ae||/\s/.test(Ne)?null:"p";if(Ae&&!Ie&&!je&&(je="s"),ge&&ge!=je){i<0&&(i=1,pe(),t.sticky="after");break}if(je&&(ge=je),i>0&&!pe(!Ie))break}var Xe=Zn(e,t,T,W,!0);return ri(T,Xe)&&(Xe.hitSide=!0),Xe}function Ls(e,t,i,r){var n=e.doc,T=t.left,W;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*ki(e.display),3);W=(i>0?t.bottom:t.top)+i*Q}else r=="line"&&(W=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,T,W),!re.outside);){if(i<0?W<=0:W>=n.height){re.hitSide=!0;break}W+=i*5}return re}var kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ne,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;As(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}ke(n,"paste",function(Y){if(!T(Y)||q(r,Y)||Ts(Y,r))return;H<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),ke(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),ke(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),ke(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(n,"touchstart",function(){return i.forceCompositionEnd()}),ke(n,"input",function(){t.composing||t.readFromDOMSoon()});function W(Y){if(!T(Y)||q(r,Y))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);ra({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var re=Rr.text.join(` `);if(Y.clipboardData.setData("Text",re),Y.clipboardData.getData("Text")==re){Y.preventDefault();return}}var pe=_s(),ge=pe.firstChild;r.display.lineSpace.insertBefore(pe,r.display.lineSpace.firstChild),ge.value=Rr.text.join(` `);var Ae=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(pe),Ae.focus(),Ae==n&&i.showPrimarySelection()},50)}ke(n,"copy",W),ke(n,"cut",W)},kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,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&&ks(t,r)||{node:Y[0].measure.map[2],offset:0},re=n.linee.firstLine()&&(r=Be(r.line-1,Je(e.doc,r.line-1).length)),n.ch==Je(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var T,W,Y;r.line==t.viewFrom||(T=ci(e,r.line))==0?(W=pt(t.view[0].line),Y=t.view[0].node):(W=pt(t.view[T].line),Y=t.view[T-1].node.nextSibling);var Q=ci(e,n.line),re,pe;if(Q==t.view.length-1?(re=t.viewTo-1,pe=t.lineDiv.lastChild):(re=pt(t.view[Q+1].line)-1,pe=t.view[Q+1].node.previousSibling),!Y)return!1;for(var ge=e.doc.splitLines(tu(e,Y,pe,W,re)),Ae=Tt(e.doc,Be(W,0),Be(re,Je(e.doc,re).text.length));ge.length>1&&Ae.length>1;)if(s(ge)==s(Ae))ge.pop(),Ae.pop(),re--;else if(ge[0]==Ae[0])ge.shift(),Ae.shift(),W++;else break;for(var Ce=0,Ie=0,Ne=ge[0],je=Ae[0],Xe=Math.min(Ne.length,je.length);Cer.ch&&qe.charCodeAt(qe.length-Ie-1)==Ye.charCodeAt(Ye.length-Ie-1);)Ce--,Ie++;ge[ge.length-1]=qe.slice(0,qe.length-Ie).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ce).replace(/\u200b+$/,"");var ut=Be(W,Ce),st=Be(re,Ae.length?s(Ae).length-Ie:0);if(ge.length>1||ge[0]||dt(ut,st))return Bi(e.doc,ge,ut,st,"+input"),!0},kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},kt.prototype.reset=function(){this.forceCompositionEnd()},kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&fr(this.cm,function(){return sr(e.cm)})},kt.prototype.setUneditable=function(e){e.contentEditable="false"},kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kt.prototype.onContextMenu=function(){},kt.prototype.resetPosition=function(){},kt.prototype.needsContentAttribute=!0;function ks(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=Je(e.doc,t.line),n=eo(i,r,t.line),T=Ke(r,e.doc.direction),W="left";if(T){var Y=We(T,t.ch);W=Y%2?"right":"left"}var Q=io(n.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var T="",W=!1,Y=e.doc.lineSeparator(),Q=!1;function re(Ce){return function(Ie){return Ie.id==Ce}}function pe(){W&&(T+=Y,Q&&(T+=Y),W=Q=!1)}function ge(Ce){Ce&&(pe(),T+=Ce)}function Ae(Ce){if(Ce.nodeType==1){var Ie=Ce.getAttribute("cm-text");if(Ie){ge(Ie);return}var Ne=Ce.getAttribute("cm-marker"),je;if(Ne){var Xe=e.findMarks(Be(r,0),Be(n+1,0),re(+Ne));Xe.length&&(je=Xe[0].find(0))&&ge(Tt(e.doc,je.from,je.to).join(Y));return}if(Ce.getAttribute("contenteditable")=="false")return;var qe=/^(pre|div|p|li|table|br)$/i.test(Ce.nodeName);if(!/^br$/i.test(Ce.nodeName)&&Ce.textContent.length==0)return;qe&&pe();for(var Ye=0;Ye=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ke(n,"paste",function(W){if(q(r,W)||Ts(W,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(W){if(q(r,W))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ws(r);ra({lineWise:!0,text:Y.text}),W.type=="cut"?r.setSelections(Y.ranges,null,xe):(i.prevInput="",n.value=Y.text.join(` `),V(n))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(n,"cut",T),ke(n,"copy",T),ke(e.scroller,"paste",function(W){if(Wr(e,W)||q(r,W))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=W.clipboardData,n.dispatchEvent(Y)}),ke(e.lineSpace,"selectstart",function(W){Wr(e,W)||te(W)}),ke(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"})}}),ke(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Ft.prototype.createField=function(e){this.wrapper=_s(),this.textarea=this.wrapper.firstChild},Ft.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=kr(e,i.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+W.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+W.left-T.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ft.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),G&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&H>=9&&(this.hasSelection=null))},Ft.prototype.getField=function(){return this.textarea},Ft.prototype.supportsTouch=function(){return!1},Ft.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ft.prototype.blur=function(){this.textarea.blur()},Ft.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ft.prototype.receivedFocus=function(){this.slowPoll()},Ft.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()})},Ft.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)},Ft.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||it(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(G&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=n.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,Y=Math.min(r.length,n.length);W1e3||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},Ft.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ft.prototype.onKeyPress=function(){G&&H>=9&&(this.hasSelection=null),this.fastPoll()},Ft.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=di(i,e),W=r.scroller.scrollTop;if(!T||w)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(T)==-1&&zt(i,er)(i.doc,$r(T),xe);var Q=n.style.cssText,re=t.wrapper.style.cssText,pe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-pe.top-5)+"px; left: "+(e.clientX-pe.left-5)+`px; z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;F&&(ge=window.scrollY),r.input.focus(),F&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ce,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Ae(){if(n.selectionStart!=null){var Ne=i.somethingSelected(),je="\u200B"+(Ne?n.value:"");n.value="\u21DA",n.value=je,t.prevInput=Ne?"":"\u200B",n.selectionStart=1,n.selectionEnd=je.length,r.selForContextMenu=i.doc.sel}}function Ce(){if(t.contextMenuPending!=Ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=Q,G&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),n.selectionStart!=null){(!G||G&&H<9)&&Ae();var Ne=0,je=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?zt(i,Xo)(i):Ne++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(G&&H>=9&&Ae(),_){ce(e);var Ie=function(){Ve(window,"mouseup",Ie),setTimeout(Ce,20)};ke(window,"mouseup",Ie)}else setTimeout(Ce,50)},Ft.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ft.prototype.setUneditable=function(){},Ft.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=N();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;n=T.submit;try{var W=T.submit=function(){r(),T.submit=n,T.submit(),T.submit=W}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Mt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=Ve,e.on=ke,e.wheelEventPixels=dl,e.Doc=lr,e.splitLines=ot,e.countColumn=$,e.findColumn=Se,e.isWordChar=be,e.Pass=De,e.signal=oe,e.Line=li,e.changeEnd=Zr,e.scrollbarModel=To,e.Pos=Be,e.cmpPos=dt,e.modes=Ot,e.mimeModes=Et,e.resolveMode=Yt,e.getMode=gr,e.modeExtensions=cr,e.extendMode=zr,e.copyState=$t,e.startState=ti,e.innerMode=Nr,e.commands=Sn,e.keyMap=Hr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Ui,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=bn,e.TextMarker=Qr,e.LineWidget=yn,e.e_preventDefault=te,e.e_stopPropagation=ae,e.e_stop=ce,e.addClass=j,e.contains=b,e.rmClass=p,e.keyNames=qr}$l(Mt),ql(Mt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in lr.prototype)lr.prototype.hasOwnProperty(na)&&de(au,na)<0&&(Mt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(lr.prototype[na]));return le(lr),Mt.inputStyles={textarea:Ft,contenteditable:kt},Mt.defineMode=function(e){!Mt.defaults.mode&&e!="null"&&(Mt.defaults.mode=e),mr.apply(this,arguments)},Mt.defineMIME=Tr,Mt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Mt.defineMIME("text/plain","null"),Mt.defineExtension=function(e,t){Mt.prototype[e]=t},Mt.defineDocExtension=function(e,t){lr.prototype[e]=t},Mt.fromTextArea=iu,nu(Mt),Mt.version="5.58.2",Mt})},Y1PL:function(ht,$e,ue){"use strict";ue.r($e),ue.d($e,"ResizableTextArea",function(){return de});var fe=ue("wx14"),Z=ue("1OyB"),O=ue("vuIU"),J=ue("Ji7U"),U=ue("LK+K"),k=ue("q1tI"),G=ue("VTBJ"),H=ue("rePB"),F=ue("Zm9Q"),R=ue("Kwbf"),E=ue("c+Xe"),w=ue("m+aA"),M=ue("bdgK"),L=new Map;function A(xe){xe.forEach(function(Le){var Te,Se=Le.target;(Te=L.get(Se))===null||Te===void 0||Te.forEach(function(ve){return ve(Se)})})}var S=new M.default(A),d=null,o=null;function l(xe,Le){L.has(xe)||(L.set(xe,new Set),S.observe(xe)),L.get(xe).add(Le)}function u(xe,Le){L.has(xe)&&(L.get(xe).delete(Le),L.get(xe).size||(S.unobserve(xe),L.delete(xe)))}var C=function(xe){Object(J.a)(Te,xe);var Le=Object(U.a)(Te);function Te(){return Object(Z.a)(this,Te),Le.apply(this,arguments)}return Object(O.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(k.Component),v=k.createContext(null);function m(xe){var Le=xe.children,Te=xe.onBatchResize,Se=k.useRef(0),ve=k.useRef([]),z=k.useContext(v),s=k.useCallback(function(f,D,X){Se.current+=1;var B=Se.current;ve.current.push({size:f,element:D,data:X}),Promise.resolve().then(function(){B===Se.current&&(Te==null||Te(ve.current),ve.current=[])}),z==null||z(f,D,X)},[Te,z]);return k.createElement(v.Provider,{value:s},Le)}function _(xe){var Le=xe.children,Te=xe.disabled,Se=k.useRef(null),ve=k.useRef(null),z=k.useContext(v),s=k.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),f=k.isValidElement(Le)&&Object(E.c)(Le),D=f?Le.ref:null,X=k.useMemo(function(){return Object(E.a)(D,Se)},[D,Se]),B=k.useRef(xe);B.current=xe;var se=k.useCallback(function(be){var we=B.current,Oe=we.onResize,_e=we.data,Re=be.getBoundingClientRect(),Pe=Re.width,Fe=Re.height,Ge=be.offsetWidth,ze=be.offsetHeight,We=Math.floor(Pe),nt=Math.floor(Fe);if(s.current.width!==We||s.current.height!==nt||s.current.offsetWidth!==Ge||s.current.offsetHeight!==ze){var Ke={width:We,height:nt,offsetWidth:Ge,offsetHeight:ze};s.current=Ke;var Qe=Ge===Math.round(Pe)?Pe:Ge,ke=ze===Math.round(Fe)?Fe:ze,Ze=Object(G.a)(Object(G.a)({},Ke),{},{offsetWidth:Qe,offsetHeight:ke});z==null||z(Ze,be,_e),Oe&&Promise.resolve().then(function(){Oe(Ze,be)})}},[]);return k.useEffect(function(){var be=Object(w.a)(Se.current)||Object(w.a)(ve.current);return be&&!Te&&l(be,se),function(){return u(be,se)}},[Se.current,Te]),k.createElement(C,{ref:ve},f?k.cloneElement(Le,{ref:X}):Le)}var x="rc-observer-key";function p(xe){var Le=xe.children,Te=Object(F.a)(Le);return Te.map(function(Se,ve){var z=(Se==null?void 0:Se.key)||"".concat(x,"-").concat(ve);return k.createElement(_,Object(fe.a)({},xe,{key:z}),Se)})}p.Collection=m;var c=p,h=ue("bT9E"),a=ue("TSYQ"),y=ue.n(a),g=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],N={},j;function K(xe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Le&&N[Te])return N[Te];var Se=window.getComputedStyle(xe),ve=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),z=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),s=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),f=b.map(function(X){return"".concat(X,":").concat(Se.getPropertyValue(X))}).join(";"),D={sizingStyle:f,paddingSize:z,borderSize:s,boxSizing:ve};return Le&&Te&&(N[Te]=D),D}function V(xe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=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)),xe.getAttribute("wrap")?j.setAttribute("wrap",xe.getAttribute("wrap")):j.removeAttribute("wrap");var ve=K(xe,Le),z=ve.paddingSize,s=ve.borderSize,f=ve.boxSizing,D=ve.sizingStyle;j.setAttribute("style","".concat(D,";").concat(g)),j.value=xe.value||xe.placeholder||"";var X=Number.MIN_SAFE_INTEGER,B=Number.MAX_SAFE_INTEGER,se=j.scrollHeight,be;if(f==="border-box"?se+=s:f==="content-box"&&(se-=z),Te!==null||Se!==null){j.value=" ";var we=j.scrollHeight-z;Te!==null&&(X=we*Te,f==="border-box"&&(X=X+z+s),se=Math.max(X,se)),Se!==null&&(B=we*Se,f==="border-box"&&(B=B+z+s),be=se>B?"":"hidden",se=Math.min(B,se))}return{height:se,minHeight:X,maxHeight:B,overflowY:be,resize:"none"}}var P=ue("Gytx"),I=ue.n(P),$;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})($||($={}));var ne=function(xe){Object(J.a)(Te,xe);var Le=Object(U.a)(Te);function Te(Se){var ve;return Object(Z.a)(this,Te),ve=Le.call(this,Se),ve.nextFrameActionId=void 0,ve.resizeFrameId=void 0,ve.textArea=void 0,ve.saveTextArea=function(z){ve.textArea=z},ve.handleResize=function(z){var s=ve.state.resizeStatus,f=ve.props,D=f.autoSize,X=f.onResize;if(s!==$.NONE)return;typeof X=="function"&&X(z),D&&ve.resizeOnNextFrame()},ve.resizeOnNextFrame=function(){cancelAnimationFrame(ve.nextFrameActionId),ve.nextFrameActionId=requestAnimationFrame(ve.resizeTextarea)},ve.resizeTextarea=function(){var z=ve.props.autoSize;if(!z||!ve.textArea)return;var s=z.minRows,f=z.maxRows,D=V(ve.textArea,!1,s,f);ve.setState({textareaStyles:D,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ve.resizeFrameId),ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:$.RESIZED},function(){ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:$.NONE}),ve.fixFirefoxAutoScroll()})})})})},ve.renderTextArea=function(){var z=ve.props,s=z.prefixCls,f=s===void 0?"rc-textarea":s,D=z.autoSize,X=z.onResize,B=z.className,se=z.disabled,be=ve.state,we=be.textareaStyles,Oe=be.resizeStatus,_e=Object(h.a)(ve.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Re=y()(f,B,Object(H.a)({},"".concat(f,"-disabled"),se));"value"in _e&&(_e.value=_e.value||"");var Pe=Object(G.a)(Object(G.a)(Object(G.a)({},ve.props.style),we),Oe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return k.createElement(c,{onResize:ve.handleResize,disabled:!(D||X)},k.createElement("textarea",Object(fe.a)({},_e,{className:Re,style:Pe,ref:ve.saveTextArea})))},ve.state={textareaStyles:{},resizeStatus:$.NONE},ve}return Object(O.a)(Te,[{key:"componentDidUpdate",value:function(ve){(ve.value!==this.props.value||!I()(ve.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 ve=this.textArea.selectionStart,z=this.textArea.selectionEnd;this.textArea.setSelectionRange(ve,z)}}catch(s){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(k.Component),de=ne,me=function(xe){Object(J.a)(Te,xe);var Le=Object(U.a)(Te);function Te(Se){var ve;Object(Z.a)(this,Te),ve=Le.call(this,Se),ve.resizableTextArea=void 0,ve.focus=function(){ve.resizableTextArea.textArea.focus()},ve.saveTextArea=function(s){ve.resizableTextArea=s},ve.handleChange=function(s){var f=ve.props.onChange;ve.setValue(s.target.value,function(){ve.resizableTextArea.resizeTextarea()}),f&&f(s)},ve.handleKeyDown=function(s){var f=ve.props,D=f.onPressEnter,X=f.onKeyDown;s.keyCode===13&&D&&D(s),X&&X(s)};var z=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return ve.state={value:z},ve}return Object(O.a)(Te,[{key:"setValue",value:function(ve,z){"value"in this.props||this.setState({value:ve},z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return k.createElement(de,Object(fe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ve){return"value"in ve?{value:ve.value}:null}}]),Te}(k.Component),De=$e.default=me},Zss7:function(ht,$e,ue){var fe;(function(Z){var O=/^\s+/,J=/\s+$/,U=0,k=Z.round,G=Z.min,H=Z.max,F=Z.random;function R(s,f){if(s=s||"",f=f||{},s instanceof R)return s;if(!(this instanceof R))return new R(s,f);var D=E(s);this._originalInput=s,this._r=D.r,this._g=D.g,this._b=D.b,this._a=D.a,this._roundA=k(100*this._a)/100,this._format=f.format||D.format,this._gradientType=f.gradientType,this._r<1&&(this._r=k(this._r)),this._g<1&&(this._g=k(this._g)),this._b<1&&(this._b=k(this._b)),this._ok=D.ok,this._tc_id=U++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),f,D,X,B,se,be;return f=s.r/255,D=s.g/255,X=s.b/255,f<=.03928?B=f/12.92:B=Z.pow((f+.055)/1.055,2.4),D<=.03928?se=D/12.92:se=Z.pow((D+.055)/1.055,2.4),X<=.03928?be=X/12.92:be=Z.pow((X+.055)/1.055,2.4),.2126*B+.7152*se+.0722*be},setAlpha:function(s){return this._a=V(s),this._roundA=k(100*this._a)/100,this},toHsv:function(){var s=A(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=A(this._r,this._g,this._b),f=k(s.h*360),D=k(s.s*100),X=k(s.v*100);return this._a==1?"hsv("+f+", "+D+"%, "+X+"%)":"hsva("+f+", "+D+"%, "+X+"%, "+this._roundA+")"},toHsl:function(){var s=M(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=M(this._r,this._g,this._b),f=k(s.h*360),D=k(s.s*100),X=k(s.l*100);return this._a==1?"hsl("+f+", "+D+"%, "+X+"%)":"hsla("+f+", "+D+"%, "+X+"%, "+this._roundA+")"},toHex:function(s){return d(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return o(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:k(this._r),g:k(this._g),b:k(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+k(this._r)+", "+k(this._g)+", "+k(this._b)+")":"rgba("+k(this._r)+", "+k(this._g)+", "+k(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:k(P(this._r,255)*100)+"%",g:k(P(this._g,255)*100)+"%",b:k(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+k(P(this._r,255)*100)+"%, "+k(P(this._g,255)*100)+"%, "+k(P(this._b,255)*100)+"%)":"rgba("+k(P(this._r,255)*100)+"%, "+k(P(this._g,255)*100)+"%, "+k(P(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(s){var f="#"+l(this._r,this._g,this._b,this._a),D=f,X=this._gradientType?"GradientType = 1, ":"";if(s){var B=R(s);D="#"+l(B._r,B._g,B._b,B._a)}return"progid:DXImageTransform.Microsoft.gradient("+X+"startColorstr="+f+",endColorstr="+D+")"},toString:function(s){var f=!!s;s=s||this._format;var D=!1,X=this._a<1&&this._a>=0,B=!f&&X&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return B?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(D=this.toRgbString()),s==="prgb"&&(D=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(D=this.toHexString()),s==="hex3"&&(D=this.toHexString(!0)),s==="hex4"&&(D=this.toHex8String(!0)),s==="hex8"&&(D=this.toHex8String()),s==="name"&&(D=this.toName()),s==="hsl"&&(D=this.toHslString()),s==="hsv"&&(D=this.toHsvString()),D||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(s,f){var D=s.apply(null,[this].concat([].slice.call(f)));return this._r=D._r,this._g=D._g,this._b=D._b,this.setAlpha(D._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(s,f){return s.apply(null,[this].concat([].slice.call(f)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(s,f){if(typeof s=="object"){var D={};for(var X in s)s.hasOwnProperty(X)&&(X==="a"?D[X]=s[X]:D[X]=De(s[X]));s=D}return R(s,f)};function E(s){var f={r:0,g:0,b:0},D=1,X=null,B=null,se=null,be=!1,we=!1;return typeof s=="string"&&(s=ve(s)),typeof s=="object"&&(Se(s.r)&&Se(s.g)&&Se(s.b)?(f=w(s.r,s.g,s.b),be=!0,we=String(s.r).substr(-1)==="%"?"prgb":"rgb"):Se(s.h)&&Se(s.s)&&Se(s.v)?(X=De(s.s),B=De(s.v),f=S(s.h,X,B),be=!0,we="hsv"):Se(s.h)&&Se(s.s)&&Se(s.l)&&(X=De(s.s),se=De(s.l),f=L(s.h,X,se),be=!0,we="hsl"),s.hasOwnProperty("a")&&(D=s.a)),D=V(D),{ok:be,format:s.format||we,r:G(255,H(f.r,0)),g:G(255,H(f.g,0)),b:G(255,H(f.b,0)),a:D}}function w(s,f,D){return{r:P(s,255)*255,g:P(f,255)*255,b:P(D,255)*255}}function M(s,f,D){s=P(s,255),f=P(f,255),D=P(D,255);var X=H(s,f,D),B=G(s,f,D),se,be,we=(X+B)/2;if(X==B)se=be=0;else{var Oe=X-B;be=we>.5?Oe/(2-X-B):Oe/(X+B);switch(X){case s:se=(f-D)/Oe+(f1&&(Pe-=1),Pe<1/6?_e+(Re-_e)*6*Pe:Pe<1/2?Re:Pe<2/3?_e+(Re-_e)*(2/3-Pe)*6:_e}if(f===0)X=B=se=D;else{var we=D<.5?D*(1+f):D+f-D*f,Oe=2*D-we;X=be(Oe,we,s+1/3),B=be(Oe,we,s),se=be(Oe,we,s-1/3)}return{r:X*255,g:B*255,b:se*255}}function A(s,f,D){s=P(s,255),f=P(f,255),D=P(D,255);var X=H(s,f,D),B=G(s,f,D),se,be,we=X,Oe=X-B;if(be=X===0?0:Oe/X,X==B)se=0;else{switch(X){case s:se=(f-D)/Oe+(f>1)+720)%360;--f;)X.h=(X.h+B)%360,se.push(R(X));return se}function b(s,f){f=f||6;for(var D=R(s).toHsv(),X=D.h,B=D.s,se=D.v,be=[],we=1/f;f--;)be.push(R({h:X,s:B,v:se})),se=(se+we)%1;return be}R.mix=function(s,f,D){D=D===0?0:D||50;var X=R(s).toRgb(),B=R(f).toRgb(),se=D/100,be={r:(B.r-X.r)*se+X.r,g:(B.g-X.g)*se+X.g,b:(B.b-X.b)*se+X.b,a:(B.a-X.a)*se+X.a};return R(be)},R.readability=function(s,f){var D=R(s),X=R(f);return(Z.max(D.getLuminance(),X.getLuminance())+.05)/(Z.min(D.getLuminance(),X.getLuminance())+.05)},R.isReadable=function(s,f,D){var X=R.readability(s,f),B,se;se=!1,B=z(D);switch(B.level+B.size){case"AAsmall":case"AAAlarge":se=X>=4.5;break;case"AAlarge":se=X>=3;break;case"AAAsmall":se=X>=7;break}return se},R.mostReadable=function(s,f,D){var X=null,B=0,se,be,we,Oe;D=D||{},be=D.includeFallbackColors,we=D.level,Oe=D.size;for(var _e=0;_eB&&(B=se,X=R(f[_e]));return R.isReadable(s,X,{level:we,size:Oe})||!be?X:(D.includeFallbackColors=!1,R.mostReadable(s,["#fff","#000"],D))};var N=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},j=R.hexNames=K(N);function K(s){var f={};for(var D in s)s.hasOwnProperty(D)&&(f[s[D]]=D);return f}function V(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function P(s,f){ne(s)&&(s="100%");var D=de(s);return s=G(f,H(0,parseFloat(s))),D&&(s=parseInt(s*f,10)/100),Z.abs(s-f)<1e-6?1:s%f/parseFloat(f)}function I(s){return G(1,H(0,s))}function $(s){return parseInt(s,16)}function ne(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function de(s){return typeof s=="string"&&s.indexOf("%")!=-1}function me(s){return s.length==1?"0"+s:""+s}function De(s){return s<=1&&(s=s*100+"%"),s}function xe(s){return Z.round(parseFloat(s)*255).toString(16)}function Le(s){return $(s)/255}var Te=function(){var s="[-\\+]?\\d+%?",f="[-\\+]?\\d*\\.\\d+%?",D="(?:"+f+")|(?:"+s+")",X="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",B="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?";return{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+B),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Se(s){return!!Te.CSS_UNIT.exec(s)}function ve(s){s=s.replace(O,"").replace(J,"").toLowerCase();var f=!1;if(N[s])s=N[s],f=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var D;return(D=Te.rgb.exec(s))?{r:D[1],g:D[2],b:D[3]}:(D=Te.rgba.exec(s))?{r:D[1],g:D[2],b:D[3],a:D[4]}:(D=Te.hsl.exec(s))?{h:D[1],s:D[2],l:D[3]}:(D=Te.hsla.exec(s))?{h:D[1],s:D[2],l:D[3],a:D[4]}:(D=Te.hsv.exec(s))?{h:D[1],s:D[2],v:D[3]}:(D=Te.hsva.exec(s))?{h:D[1],s:D[2],v:D[3],a:D[4]}:(D=Te.hex8.exec(s))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),a:Le(D[4]),format:f?"name":"hex8"}:(D=Te.hex6.exec(s))?{r:$(D[1]),g:$(D[2]),b:$(D[3]),format:f?"name":"hex"}:(D=Te.hex4.exec(s))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),a:Le(D[4]+""+D[4]),format:f?"name":"hex8"}:(D=Te.hex3.exec(s))?{r:$(D[1]+""+D[1]),g:$(D[2]+""+D[2]),b:$(D[3]+""+D[3]),format:f?"name":"hex"}:!1}function z(s){var f,D;return s=s||{level:"AA",size:"small"},f=(s.level||"AA").toUpperCase(),D=(s.size||"small").toLowerCase(),f!=="AA"&&f!=="AAA"&&(f="AA"),D!=="small"&&D!=="large"&&(D="small"),{level:f,size:D}}ht.exports?ht.exports=R:!(fe=function(){return R}.call($e,ue,$e,ht),fe!==void 0&&(ht.exports=fe))})(Math)},bT9E:function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return Z});var fe=ue("VTBJ");function Z(O,J){var U=Object(fe.a)({},O);return Array.isArray(J)&&J.forEach(function(k){delete U[k]}),U}},c5Ni:function(ht,$e,ue){},dejd:function(ht,$e,ue){},dmUQ:function(ht,$e,ue){"use strict";var fe=ue("Ff2n"),Z=ue("rePB"),O=ue("1OyB"),J=ue("vuIU"),U=ue("Ji7U"),k=ue("md7G"),G=ue("foSv"),H=ue("q1tI"),F=ue.n(H),R=ue("TSYQ"),E=ue.n(R),w=ue("4IlW");function M(h,a){var y=Object.keys(h);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(h);a&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(h,b).enumerable})),y.push.apply(y,g)}return y}function L(h){for(var a=1;a1?de-1:0),De=1;De1?P-1:0),$=1;$=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var P=0;return V.indexOf(".")>=0&&(P=V.length-V.indexOf(".")-1),P},b.getInputDisplayValue=function(K){var V=K||b.state,P=V.focused,I=V.inputValue,$=V.value,ne;P?ne=I:ne=b.toPrecisionAsStep($),ne==null&&(ne="");var de=b.formatWrapper(ne);return m(b.props.decimalSeparator)&&(de=de.toString().replace(".",b.props.decimalSeparator)),de},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(K){}},b.restoreByAfter=function(K){if(K===void 0)return!1;var V=b.input.value,P=V.lastIndexOf(K);if(P===-1)return!1;var I=b.cursorBefore.length;return b.lastKeyCode===w.a.DELETE&&b.cursorBefore.charAt(I-1)===K[0]?(b.fixCaret(I,I),!0):P+K.length===V.length?(b.fixCaret(P,P),!0):!1},b.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,P){var I=K.substring(P);return b.restoreByAfter(I)})},b.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(K,V,P){b.pressingUpOrDown=!0,b.step("down",K,V,P)},b.up=function(K,V,P){b.pressingUpOrDown=!0,b.step("up",K,V,P)},b.saveInput=function(K){b.input=K};var N=g.value;N===void 0&&(N=g.defaultValue),b.state={focused:g.autoFocus};var j=b.getValidValue(b.toNumber(N));return b.state=L(L({},b.state),{},{inputValue:b.toPrecisionAsStep(j),value:j}),b}return Object(J.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var N=this.props,j=N.value,K=N.onChange,V=N.max,P=N.min,I=this.state.focused;if(b){if(!_(b.value,j)||!_(b.max,V)||!_(b.min,P)){var $=I?j:this.getValidValue(j),ne;this.pressingUpOrDown?ne=$:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ne})}var de="value"in this.props?j:this.state.value;"max"in this.props&&b.max!==V&&typeof de=="number"&&de>V&&K&&K(V),"min"in this.props&&b.min!==P&&typeof de=="number"&&de1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(b);return isNaN(K)?b:(Kj&&(K=j),K)}},{key:"setValue",value:function(b,N){var j=this.props.precision,K=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),V=this.state.value,P=V===void 0?null:V,I=this.state.inputValue,$=I===void 0?null:I,ne=typeof K=="number"?K.toFixed(j):"".concat(K),de=K!==P||ne!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},N)):this.setState({value:K,inputValue:this.toPrecisionAsStep(b)},N),de&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,K=j.precision,V=j.step;if(m(K))return K;var P=this.getPrecision(N),I=this.getPrecision(V),$=this.getPrecision(b);return b?Math.max($,P+I):P+I}},{key:"getPrecisionFactor",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(b,N);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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var N=Math.abs(this.getMaxPrecision(b));return isNaN(N)?b.toString():Number(b).toFixed(N)}},{key:"toNumber",value:function(b){var N=this.props.precision,j=this.state.focused,K=b&&b.length>16&&j;return this.isNotCompleteNumber(b)||K?b:m(N)?Math.round(b*Math.pow(10,N))/Math.pow(10,N):Number(b)}},{key:"upStep",value:function(b,N){var j=this.props.step,K=this.getPrecisionFactor(b,N),V=Math.abs(this.getMaxPrecision(b,N)),P=((K*b+K*j*N)/K).toFixed(V);return this.toNumber(P)}},{key:"downStep",value:function(b,N){var j=this.props.step,K=this.getPrecisionFactor(b,N),V=Math.abs(this.getMaxPrecision(b,N)),P=((K*b-K*j*N)/K).toFixed(V);return this.toNumber(P)}},{key:"step",value:function(b,N){var j=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var P=this.props;if(P.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var $=this["".concat(b,"Step")](I,K),ne=$>P.max||$P.max?$=P.max:$=me),q=(nt||nt===0)&&(isNaN(nt)||Number(nt)<=De),ee=oe||K||V,ie=q||K||V,le=E()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(Z.a)({},"".concat(j,"-handler-up-disabled"),ee)),te=E()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(Z.a)({},"".concat(j,"-handler-down-disabled"),ie)),ae=P?{onTouchStart:ee?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=P?{onTouchStart:ie?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ie?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return F.a.createElement("div",{className:Qe,style:xe,title:Le,onMouseEnter:Te,onMouseLeave:Se,onMouseOver:ve,onMouseOut:z,onFocus:function(){return null},onBlur:function(){return null}},F.a.createElement("div",{className:"".concat(j,"-handler-wrap")},F.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:le}),$||F.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),F.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ie,className:te}),ne||F.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),F.a.createElement("div",{className:"".concat(j,"-input-wrap")},F.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":De,"aria-valuemax":me,"aria-valuenow":nt,required:s,type:X,placeholder:B,onPaste:Fe,onClick:f,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:D,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Re,maxLength:_e,readOnly:V,disabled:K,max:me,min:De,step:Oe,name:Pe,title:Le,id:se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:we,inputMode:be,onInput:Ge},ke))))}}]),y}(F.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var p=x,c=$e.a=p},h78n:function(ht,$e,ue){"use strict";ue.d($e,"a",function(){return b});var fe=ue("q1tI"),Z=ue.n(fe),O=ue("TSYQ"),J=ue.n(O),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},k=function(K){var V=K.map(function(){return Object(fe.useRef)()}),P=Object(fe.useRef)();return Object(fe.useEffect)(function(){var I=Date.now(),$=!1;Object.keys(V).forEach(function(ne){var de=V[ne].current;if(!de)return;$=!0;var me=de.style;me.transitionDuration=".3s, .3s, .3s, .06s",P.current&&I-P.current<100&&(me.transitionDuration="0s, 0s")}),$&&(P.current=Date.now())}),[V]};function G(){return G=Object.assign||function(j){for(var K=1;Kj.length)&&(K=j.length);for(var V=0,P=new Array(K);V=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function A(j,K){if(j==null)return{};var V={},P=Object.keys(j),I,$;for($=0;$=0)continue;V[I]=j[I]}return V}var S=function(K){var V=K.className,P=K.percent,I=K.prefixCls,$=K.strokeColor,ne=K.strokeLinecap,de=K.strokeWidth,me=K.style,De=K.trailColor,xe=K.trailWidth,Le=K.transition,Te=L(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Se=Array.isArray(P)?P:[P],ve=Array.isArray($)?$:[$],z=k(Se),s=H(z,1),f=s[0],D=de/2,X=100-de/2,B="M ".concat(ne==="round"?D:0,",").concat(D,` L `).concat(ne==="round"?X:100,",").concat(D),se="0 0 100 ".concat(de),be=0;return Z.a.createElement("svg",G({className:J()("".concat(I,"-line"),V),viewBox:se,preserveAspectRatio:"none",style:me},Te),Z.a.createElement("path",{className:"".concat(I,"-line-trail"),d:B,strokeLinecap:ne,stroke:De,strokeWidth:xe||de,fillOpacity:"0"}),Se.map(function(we,Oe){var _e={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:Le||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Re=ve[Oe]||ve[ve.length-1];return be+=we,Z.a.createElement("path",{key:Oe,className:"".concat(I,"-line-path"),d:B,strokeLinecap:ne,stroke:Re,strokeWidth:de,fillOpacity:"0",ref:f[Oe],style:_e})}))};S.defaultProps=U;var d=S;function o(){return o=Object.assign||function(j){for(var K=1;Kj.length)&&(K=j.length);for(var V=0,P=new Array(K);V=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,P))continue;V[P]=j[P]}}return V}function p(j,K){if(j==null)return{};var V={},P=Object.keys(j),I,$;for($=0;$=0)continue;V[I]=j[I]}return V}var c=0;function h(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function y(j,K,V,P){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ne=50-P/2,de=0,me=-ne,De=0,xe=-2*ne;switch($){case"left":de=-ne,me=0,De=2*ne,xe=0;break;case"right":de=ne,me=0,De=-2*ne,xe=0;break;case"bottom":me=ne,xe=2*ne;break;default:}var Le="M 50,50 m ".concat(de,",").concat(me,` a `).concat(ne,",").concat(ne," 0 1 1 ").concat(De,",").concat(-xe,` a `).concat(ne,",").concat(ne," 0 1 1 ").concat(-De,",").concat(xe),Te=Math.PI*2*ne,Se={stroke:V,strokeDasharray:"".concat(K/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:Le,pathStyle:Se}}var g=function(K){var V=K.prefixCls,P=K.strokeWidth,I=K.trailWidth,$=K.gapDegree,ne=K.gapPosition,de=K.trailColor,me=K.strokeLinecap,De=K.style,xe=K.className,Le=K.strokeColor,Te=K.percent,Se=x(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ve=Object(fe.useMemo)(function(){return c+=1,c},[]),z=y(0,100,de,P,$,ne),s=z.pathString,f=z.pathStyle,D=a(Te),X=a(Le),B=X.find(function(_e){return Object.prototype.toString.call(_e)==="[object Object]"}),se=k(D),be=l(se,1),we=be[0],Oe=function(){var Re=0;return D.map(function(Pe,Fe){var Ge=X[Fe]||X[X.length-1],ze=Object.prototype.toString.call(Ge)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ve,")"):"",We=y(Re,Pe,Ge,P,$,ne);return Re+=Pe,Z.a.createElement("path",{key:Fe,className:"".concat(V,"-circle-path"),d:We.pathString,stroke:ze,strokeLinecap:me,strokeWidth:P,opacity:Pe===0?0:1,fillOpacity:"0",style:We.pathStyle,ref:we[Fe]})})};return Z.a.createElement("svg",o({className:J()("".concat(V,"-circle"),xe),viewBox:"0 0 100 100",style:De},Se),B&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ve),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(B).sort(function(_e,Re){return h(_e)-h(Re)}).map(function(_e,Re){return Z.a.createElement("stop",{key:Re,offset:_e,stopColor:B[_e]})}))),Z.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:s,stroke:de,strokeLinecap:me,strokeWidth:I||P,fillOpacity:"0",style:f}),Oe().reverse())};g.defaultProps=U;var b=g,N={Line:d,Circle:b}},kSUc:function(ht,$e,ue){},lZu9:function(ht,$e,ue){(function(fe){fe(ue("VrN/"),ue("1eCo"),ue("8EBN"))})(function(fe){"use strict";fe.defineMode("markdown",function(Z,O){var J=fe.getMode(Z,"text/html"),U=J.name=="null";function k(P){if(fe.findModeByName){var I=fe.findModeByName(P);I&&(P=I.mime||I.mimes[0])}var $=fe.getMode(Z,P);return $.name=="null"?null:$}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var G={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var H in G)G.hasOwnProperty(H)&&O.tokenTypeOverrides[H]&&(G[H]=O.tokenTypeOverrides[H]);var F=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,w=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\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]/,o=" ";function l(P,I,$){return I.f=I.inline=$,$(P,I)}function u(P,I,$){return I.f=I.block=$,$(P,I)}function C(P){return!P||!/\S/.test(P.string)}function v(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==_){var I=U;if(!I){var $=fe.innerMode(J,P.htmlState);I=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}I&&(P.f=h,P.block=m,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function m(P,I){var $=P.column()===I.indentation,ne=C(I.prevLine.stream),de=I.indentedCode,me=I.prevLine.hr,De=I.list!==!1,xe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var Le=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,De)){for(I.list=null;Le=4&&(de||I.prevLine.fencedCodeEnd||I.prevLine.header||ne))return P.skipToEnd(),I.indentedCode=!0,G.code;if(P.eatSpace())return null;if($&&I.indentation<=xe&&(ve=P.match(w))&&ve[1].length<=6)return I.quote=0,I.header=ve[1].length,I.thisLine.header=!0,O.highlightFormatting&&(I.formatting="header"),I.f=I.inline,p(I);if(I.indentation<=xe&&P.eat(">"))return I.quote=$?1:I.quote+1,O.highlightFormatting&&(I.formatting="quote"),P.eatSpace(),p(I);if(!Se&&!I.setext&&$&&I.indentation<=xe&&(ve=P.match(R))){var z=ve[1]?"ol":"ul";return I.indentation=Le+P.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,O.taskLists&&P.match(E,!1)&&(I.taskList=!0),I.f=I.inline,O.highlightFormatting&&(I.formatting=["list","list-"+z]),p(I)}else{if($&&I.indentation<=xe&&(ve=P.match(A,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ve[1]+"+ *$"),I.localMode=O.fencedCodeBlockHighlighting&&k(ve[2]||O.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=fe.startState(I.localMode)),I.f=I.block=x,O.highlightFormatting&&(I.formatting="code-block"),I.code=-1,p(I);if(I.setext||(!Te||!De)&&!I.quote&&I.list===!1&&!I.code&&!Se&&!S.test(P.string)&&(ve=P.lookAhead(1))&&(ve=ve.match(M)))return I.setext?(I.header=I.setext,I.setext=0,P.skipToEnd(),O.highlightFormatting&&(I.formatting="header")):(I.header=ve[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,p(I);if(Se)return P.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,G.hr;if(P.peek()==="[")return l(P,I,N)}return l(P,I,I.inline)}function _(P,I){var $=J.token(P,I.htmlState);if(!U){var ne=fe.innerMode(J,I.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||I.md_inside&&P.current().indexOf(">")>-1)&&(I.f=h,I.block=m,I.htmlState=null)}return $}function x(P,I){var $=I.listStack[I.listStack.length-1]||0,ne=I.indentation<$,de=$+3;if(I.fencedEndRE&&I.indentation<=de&&(ne||P.match(I.fencedEndRE))){O.highlightFormatting&&(I.formatting="code-block");var me;return ne||(me=p(I)),I.localMode=I.localState=null,I.block=m,I.f=h,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,ne?u(P,I,I.block):me}else return I.localMode?I.localMode.token(P,I.localState):(P.skipToEnd(),G.code)}function p(P){var I=[];if(P.formatting){I.push(G.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var $=0;$=P.quote?I.push(G.formatting+"-"+P.formatting[$]+"-"+P.quote):I.push("error"))}if(P.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(P.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(P.linkHref?I.push(G.linkHref,"url"):(P.strong&&I.push(G.strong),P.em&&I.push(G.em),P.strikethrough&&I.push(G.strikethrough),P.emoji&&I.push(G.emoji),P.linkText&&I.push(G.linkText),P.code&&I.push(G.code),P.image&&I.push(G.image),P.imageAltText&&I.push(G.imageAltText,"link"),P.imageMarker&&I.push(G.imageMarker)),P.header&&I.push(G.header,G.header+"-"+P.header),P.quote&&(I.push(G.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=P.quote?I.push(G.quote+"-"+P.quote):I.push(G.quote+"-"+O.maxBlockquoteDepth)),P.list!==!1){var ne=(P.listStack.length-1)%3;ne?ne===1?I.push(G.list2):I.push(G.list3):I.push(G.list1)}return P.trailingSpaceNewLine?I.push("trailing-space-new-line"):P.trailingSpace&&I.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function c(P,I){return P.match(L,!0)?p(I):void 0}function h(P,I){var $=I.text(P,I);if(typeof $!="undefined")return $;if(I.list)return I.list=null,p(I);if(I.taskList){var ne=P.match(E,!0)[1]===" ";return ne?I.taskOpen=!0:I.taskClosed=!0,O.highlightFormatting&&(I.formatting="task"),I.taskList=!1,p(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&P.match(/^#+$/,!0))return O.highlightFormatting&&(I.formatting="header"),p(I);var de=P.next();if(I.linkTitle){I.linkTitle=!1;var me=de;de==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var De="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(P.match(new RegExp(De),!0))return G.linkHref}if(de==="`"){var xe=I.formatting;O.highlightFormatting&&(I.formatting="code"),P.eatWhile("`");var Le=P.current().length;if(I.code==0&&(!I.quote||Le==1))return I.code=Le,p(I);if(Le==I.code){var Te=p(I);return I.code=0,Te}else return I.formatting=xe,p(I)}else if(I.code)return p(I);if(de==="\\"&&(P.next(),O.highlightFormatting)){var Se=p(I),ve=G.formatting+"-escape";return Se?Se+" "+ve:ve}if(de==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,O.highlightFormatting&&(I.formatting="image"),p(I);if(de==="["&&I.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,O.highlightFormatting&&(I.formatting="image"),p(I);if(de==="]"&&I.imageAltText){O.highlightFormatting&&(I.formatting="image");var Se=p(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=y,Se}if(de==="["&&!I.image)return I.linkText&&P.match(/^.*?\]/)||(I.linkText=!0,O.highlightFormatting&&(I.formatting="link")),p(I);if(de==="]"&&I.linkText){O.highlightFormatting&&(I.formatting="link");var Se=p(I);return I.linkText=!1,I.inline=I.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?y:h,Se}if(de==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,O.highlightFormatting&&(I.formatting="link");var Se=p(I);return Se?Se+=" ":Se="",Se+G.linkInline}if(de==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,O.highlightFormatting&&(I.formatting="link");var Se=p(I);return Se?Se+=" ":Se="",Se+G.linkEmail}if(O.xml&&de==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var z=P.string.indexOf(">",P.pos);if(z!=-1){var s=P.string.substring(P.start,z);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(s)&&(I.md_inside=!0)}return P.backUp(1),I.htmlState=fe.startState(J),u(P,I,_)}if(O.xml&&de==="<"&&P.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(de==="*"||de==="_"){for(var f=1,D=P.pos==1?" ":P.string.charAt(P.pos-2);f<3&&P.eat(de);)f++;var X=P.peek()||" ",B=!/\s/.test(X)&&(!d.test(X)||/\s/.test(D)||d.test(D)),se=!/\s/.test(D)&&(!d.test(D)||/\s/.test(X)||d.test(X)),be=null,we=null;if(f%2&&(!I.em&&B&&(de==="*"||!se||d.test(D))?be=!0:I.em==de&&se&&(de==="*"||!B||d.test(X))&&(be=!1)),f>1&&(!I.strong&&B&&(de==="*"||!se||d.test(D))?we=!0:I.strong==de&&se&&(de==="*"||!B||d.test(X))&&(we=!1)),we!=null||be!=null){O.highlightFormatting&&(I.formatting=be==null?"strong":we==null?"em":"strong em"),be===!0&&(I.em=de),we===!0&&(I.strong=de);var Te=p(I);return be===!1&&(I.em=!1),we===!1&&(I.strong=!1),Te}}else if(de===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return p(I);P.backUp(1)}if(O.strikethrough){if(de==="~"&&P.eatWhile(de)){if(I.strikethrough){O.highlightFormatting&&(I.formatting="strikethrough");var Te=p(I);return I.strikethrough=!1,Te}else if(P.match(/^[^\s]/,!1))return I.strikethrough=!0,O.highlightFormatting&&(I.formatting="strikethrough"),p(I)}else if(de===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return p(I);P.backUp(2)}}if(O.emoji&&de===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,O.highlightFormatting&&(I.formatting="emoji");var Oe=p(I);return I.emoji=!1,Oe}return de===" "&&(P.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),p(I)}function a(P,I){var $=P.next();if($===">"){I.f=I.inline=h,O.highlightFormatting&&(I.formatting="link");var ne=p(I);return ne?ne+=" ":ne="",ne+G.linkInline}return P.match(/^[^>]+/,!0),G.linkInline}function y(P,I){if(P.eatSpace())return null;var $=P.next();return $==="("||$==="["?(I.f=I.inline=b($==="("?")":"]"),O.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,p(I)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(P){return function(I,$){var ne=I.next();if(ne===P){$.f=$.inline=h,O.highlightFormatting&&($.formatting="link-string");var de=p($);return $.linkHref=!1,de}return I.match(g[P]),$.linkHref=!0,p($)}}function N(P,I){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=j,P.next(),O.highlightFormatting&&(I.formatting="link"),I.linkText=!0,p(I)):l(P,I,h)}function j(P,I){if(P.match(/^\]:/,!0)){I.f=I.inline=K,O.highlightFormatting&&(I.formatting="link");var $=p(I);return I.linkText=!1,$}return P.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(P,I){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?I.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=h,G.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:h,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&fe.copyState(J,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?fe.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,I){if(I.formatting=!1,P!=I.thisLine.stream){if(I.header=0,I.hr=!1,P.match(/^\s*$/,!0))return v(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:P},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=_)){var $=P.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=$,I.indentationDiff=null,$>0)return null}}return I.f(P,I)},innerMode:function(P){return P.block==_?{state:P.htmlState,mode:J}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:V}},indent:function(P,I,$){return P.block==_&&J.indent?J.indent(P.htmlState,I,$):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,I,$):fe.Pass},blankLine:v,getType:p,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),fe.defineMIME("text/markdown","markdown"),fe.defineMIME("text/x-markdown","markdown")})},osHv:function(ht,$e,ue){(function(fe){fe(ue("VrN/"))})(function(fe){"use strict";var Z=fe.Pos;function O(d,o){return d.line-o.line||d.ch-o.ch}var J="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=J+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",k=new RegExp("<(/?)(["+J+"]["+U+"]*)","g");function G(d,o,l,u){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function H(d,o){var l=d.cm.getTokenTypeAt(Z(d.line,o));return l&&/\btag\b/.test(l)}function F(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function R(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function E(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(F(d))continue;return}if(!H(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function w(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(R(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}k.lastIndex=o,d.ch=o;var l=k.exec(d.text);if(l&&l.index==o)return l}}function M(d){for(;;){k.lastIndex=d.ch;var o=k.exec(d.text);if(!o){if(F(d))continue;return}if(!H(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function L(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(R(d))continue;return}if(!H(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function A(d,o){for(var l=[];;){var u=M(d),C,v=d.line,m=d.ch-(u?u[0].length:0);if(!u||!(C=E(d)))return;if(C=="selfClose")continue;if(u[1]){for(var _=l.length-1;_>=0;--_)if(l[_]==u[2]){l.length=_;break}if(_<0&&(!o||o==u[2]))return{tag:u[2],from:Z(v,m),to:Z(d.line,d.ch)}}else l.push(u[2])}}function S(d,o){for(var l=[];;){var u=L(d);if(!u)return;if(u=="selfClose"){w(d);continue}var C=d.line,v=d.ch,m=w(d);if(!m)return;if(m[1])l.push(m[2]);else{for(var _=l.length-1;_>=0;--_)if(l[_]==m[2]){l.length=_;break}if(_<0&&(!o||o==m[2]))return{tag:m[2],from:Z(d.line,d.ch),to:Z(C,v)}}}}fe.registerHelper("fold","xml",function(d,o){for(var l=new G(d,o.line,0);;){var u=M(l);if(!u||l.line!=o.line)return;var C=E(l);if(!C)return;if(!u[1]&&C!="selfClose"){var v=Z(l.line,l.ch),m=A(l,u[2]);return m&&O(m.from,v)>0?{from:v,to:m.from}:null}}}),fe.findMatchingTag=function(d,o,l){var u=new G(d,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=E(u),v=C&&Z(u.line,u.ch),m=C&&w(u);if(!C||!m||O(u,o)>0)return;var _={from:Z(u.line,u.ch),to:v,tag:m[2]};return C=="selfClose"?{open:_,close:null,at:"open"}:m[1]?{open:S(u,m[2]),close:_,at:"close"}:(u=new G(d,v.line,v.ch,l),{open:_,close:A(u,m[2]),at:"open"})},fe.findEnclosingTag=function(d,o,l,u){for(var C=new G(d,o.line,o.ch,l);;){var v=S(C,u);if(!v)break;var m=new G(d,o.line,o.ch,l),_=A(m,v.tag);if(_)return{open:v,close:_}}},fe.scanForClosingTag=function(d,o,l,u){var C=new G(d,o.line,o.ch,u?{from:0,to:u}:null);return A(C,l)}})},p5ED:function(ht,$e,ue){"use strict";var fe=ue("+L6B"),Z=ue("2/Rp"),O=ue("5Dmo"),J=ue("3S7+"),U=ue("k1fw"),k=ue("9og8"),G=ue("tJVT"),H=ue("WmNS"),F=ue.n(H),R=ue("q1tI"),E=ue.n(R),w=ue("vHTk"),M=ue.n(w),L=ue("yEEn"),A=ue("ZW9T"),S=ue("1vsH"),d=ue("V0Rq"),o=ue("m3rI");$e.a=function(l){var u,C,v,m,_,x,p,c=l.editOffice,h=c===void 0?"view":c,a=l.data,y=l.theme,g=l.type,b=l.filename,N=l.monacoEditor,j=l.className,K=l.style,V=l.close,P=l.onClose,I=l.hasMask,$=l.disabledDownload,ne=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),de=Object(G.a)(ne,2),me=de[0],De=de[1],xe=Object(R.useState)(""),Le=Object(G.a)(xe,2),Te=Le[0],Se=Le[1],ve=Object(R.useState)(),z=Object(G.a)(ve,2),s=z[0],f=z[1],D=window.ENV==="build"?"/react/build":"",X=o.a.PROXY_SERVER||location.origin,B,se=1024*1024,be=10*se,we=Object(R.useRef)();(u=a)!==null&&u!==void 0&&u.startsWith("/api")&&g!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),g==="office"&&(B=Object(S.T)(a).filesize,B>be&&(g="other")),b&&N&&(N.filename=b),Object(R.useEffect)(function(){var Pe,Fe,Ge=(Pe=document.cookie)===null||Pe===void 0||((Fe=Pe.replace(/\s/g,""))===null||Fe===void 0)?void 0:Fe.split(";");Ge==null||Ge.map(function(ze){var We=ze.split("=");We[0]==="_educoder_session"&&Se(We[1])})},[]),Object(R.useEffect)(function(){g==="office"&&Oe()},[g,a]);var Oe=function(){var Pe=Object(k.a)(F.a.mark(function Fe(){var Ge,ze,We;return F.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return console.log("data:",a),Ge=a,a.startsWith("http")||(Ge=location.origin+Ge),ze=new URL(Ge).pathname.split("/").pop(),Ke.next=6,Object(d.V)({attachment_id:ze});case 6:We=Ke.sent,f(We);case 8:case"end":return Ke.stop()}},Fe)}));return function(){return Pe.apply(this,arguments)}}(),_e=function(){if(a.startsWith("http")||a.startsWith("blob:")){Re();return}Object(S.z)(b||"educoder",a,b)},Re=function(){Object(S.x)(b||"educoder",decodeURIComponent(a))};return E.a.createElement("div",{style:Object(U.a)({},K||{}),className:"".concat(I&&M.a.bgBlack," ").concat(g?M.a.wrp:"hide")},V&&E.a.createElement("div",{className:M.a.close,ref:we},!$&&E.a.createElement(J.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return we.current}},E.a.createElement("span",{onClick:Re},E.a.createElement("i",{className:"icon-quxiaozhiding"}))),E.a.createElement(J.a,{title:"\u5173\u95ED",getPopupContainer:function(){return we.current}},E.a.createElement("span",{className:"",onClick:P},E.a.createElement("i",{className:"icon-guanbi1"})))),E.a.createElement("div",{className:"".concat(M.a[j]," ").concat(j," ").concat(M.a.monaco," ").concat(g==="txt"?"show":"hide")},g==="txt"&&E.a.createElement(A.b,N)),g==="audio"&&E.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),g==="video"&&E.a.createElement(E.a.Fragment,null,((m=a)===null||m===void 0?void 0:m.indexOf("http"))>-1?E.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):E.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),g==="office"&&s&&E.a.createElement("iframe",{src:"".concat(D,"/office.html?key=").concat(s.key,"&url=").concat(X+s.url,"&callbackUrl=").concat(X+s.callbackUrl,"&fileType=").concat(s.fileType,"&title=").concat(s.title,"&model=").concat(h,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),g==="html"&&E.a.createElement("iframe",{src:a+"&disposition=inline"}),g==="pdf"&&E.a.createElement("iframe",{src:"".concat(D,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!$)}),g==="image"&&E.a.createElement("img",{src:"".concat(((_=a)===null||_===void 0?void 0:_.indexOf("http://"))>-1||((x=a)===null||x===void 0?void 0:x.indexOf("https://"))>-1||(p=a)!==null&&p!==void 0&&p.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),g==="other"&&E.a.createElement("div",null,E.a.createElement(Z.a,{type:"primary",size:"large",onClick:_e},E.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),g==="download"&&E.a.createElement(Z.a,{type:"primary",size:"large",onClick:_e},E.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ht,$e,ue){},rUJ1:function(ht,$e){const ue=/[&<>"']/,fe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,J={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>J[x];function k(x,p){if(p){if(ue.test(x))return x.replace(fe,U)}else if(Z.test(x))return x.replace(O,U);return x}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(x){return x.replace(G,(p,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const F=/(^|[^\[])\^/g;function R(x,p){x=x.source||x,p=p||"";const c={replace:(h,a)=>(a=a.source||a,a=a.replace(F,"$1"),x=x.replace(h,a),c),getRegex:()=>new RegExp(x,p)};return c}const E=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(x,p,c){if(x){let h;try{h=decodeURIComponent(H(c)).replace(E,"").toLowerCase()}catch(a){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}p&&!w.test(c)&&(c=o(p,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(h){return null}return c}const L={},A=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,p){L[" "+x]||(A.test(x)?L[" "+x]=x+"/":L[" "+x]=v(x,"/",!0)),x=L[" "+x];const c=x.indexOf(":")===-1;return p.substring(0,2)==="//"?c?p:x.replace(S,"$1")+p:p.charAt(0)==="/"?c?p:x.replace(d,"$1")+p:x+p}const l={exec:function(){}};function u(x){let p=1,c,h;for(;p{let N=!1,j=g;for(;--j>=0&&b[j]==="\\";)N=!N;return N?"|":" |"}),h=c.split(/ \|/);let a=0;if(h.length>p)h.splice(p);else for(;h.length0},!1)}function E(w,M){for(var L={main:[M]},A={main:[]},S={main:{}};R(L);)for(var d=Object.keys(L),o=0;o=2*_/p||b<=j)return;var K=Number.POSITIVE_INFINITY,V;for(V=d.level-1;V>h;V--){var P=c[V].maxBitrate;if(K=_*P/(8*.8*g),K=b)return;var I=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+` Current BW estimate: `+(Object(J.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+b.toFixed(3)+` s Estimated load time for the next fragment: `+K.toFixed(3)+` s Time to underbuffer: `+j.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(k.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:m})},A.onFragLoaded=function(d,o){var l=o.frag,u=o.part;if(l.type===F.PlaylistLevelType.MAIN&&Object(J.isFiniteNumber)(l.sn)){var C=u?u.stats:l.stats,v=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[l.level],_=(m.loaded?m.loaded.bytes:0)+C.loaded,x=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:_,duration:x},m.realBitrate=Math.round(8*_/x)}if(l.bitrateTest){var p={stats:C,frag:l,part:u,id:l.type};this.onFragBuffered(k.Events.FRAG_BUFFERED,p),l.bitrateTest=!1}}},A.onFragBuffered=function(d,o){var l=o.frag,u=o.part,C=u?u.stats:l.stats;if(C.aborted)return;if(l.type!==F.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},A.onError=function(d,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,C=l.config,v=l.minAutoLevel,m=l.media,_=o?o.duration:d?d.duration:0,x=m?m.currentTime:0,p=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,h=(G.BufferHelper.bufferInfo(m,x,C.maxBufferHole).end-x)/p,a=this.findBestLevel(c,v,u,h,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=_?Math.min(_,C.maxStarvationDelay):C.maxStarvationDelay,g=C.abrBandWidthFactor,b=C.abrBandWidthUpFactor;if(!h){var N=this.bitrateTestDelay;if(N){var j=_?Math.min(_,C.maxLoadingDelay):C.maxLoadingDelay;y=j-N,R.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),g=b=1}}return a=this.findBestLevel(c,v,u,h+y,g,b),Math.max(a,0)},A.findBestLevel=function(d,o,l,u,C,v){for(var m,_=this.fragCurrent,x=this.partCurrent,p=this.lastLoadedFragLevel,c=this.hls.levels,h=c[p],a=!!(h!=null&&(m=h.details)!==null&&m!==void 0&&m.live),y=h==null?void 0:h.codecSet,g=x?x.duration:_?_.duration:0,b=l;b>=o;b--){var N=c[b];if(!N||y&&N.codecSet!==y)continue;var j=N.details,K=(x?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||g,V=void 0;b<=p?V=C*d:V=v*d;var P=c[b].maxBitrate,I=P*K/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(V)+"/"+P+"/"+K+"/"+u+"/"+I),V>P&&(!I||a&&!this.bitrateTestDelay||I0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},p.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var h,a=this.levels,y=this.trackId,g=a==null||((h=a[y])===null||h===void 0)?void 0:h.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var b,N=performance.now(),j=this.retryDate;(!j||N>=j||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,P=K.part,I=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ne=I.flush(),de={frag:V,part:P,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(de),$&&_.prototype._handleFragmentLoadComplete.call(this,de)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var me=this.getLoadPosition(),De=G.BufferHelper.bufferInfo(this.mediaBuffer,me,this.config.maxBufferHole),xe=Object(A.fragmentWithinToleranceTest)(De.end,this.config.maxFragLookUpTolerance,V);xe<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+De.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},p.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:h,y=a.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},p.doTickIdle=function(){var h,a,y=this.hls,g=this.levels,b=this.media,N=this.trackId,j=y.config;if(!g||!g[N])return;if(!b&&(this.startFragRequested||!j.startFragPrefetch))return;var K=g[N],V=K.details;if(!V||V.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(P===null)return;var I=P.len,$=this.getMaxBufferLength(),ne=this.audioSwitch;if(I>=$&&!ne)return;if(!ne&&this._streamEnded(P,V)){y.trigger(k.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var de=V.fragments,me=de[0].start,De=P.end;if(ne){var xe=this.getLoadPosition();De=xe,V.PTSKnown&&xeme||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=me+.05))}var Le=this.getNextFragment(De,V);if(!Le){this.bufferFlushed=!0;return}((h=Le.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((a=Le.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Le,V):this.loadFragment(Le,V,De)},p.getMaxBufferLength=function(){var h=_.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?h:Math.max(h,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(h,a){var y=a.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(g){return new F.Level(g)})},p.onAudioTrackSwitching=function(h,a){var y=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(v):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(h,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(h,a){var y,g=this.levels,b=a.details,N=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var j=g[N],K=0;if(b.live||(y=j.details)!==null&&y!==void 0&&y.live){var V=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!V)return;!j.details&&b.hasProgramDateTime&&V.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(b,V),K=b.fragments[0].start):K=this.alignPlaylists(b,j.details)}j.details=b,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(j.details,K),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=U.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(h){var a,y=h.frag,g=h.part,b=h.payload,N=this.config,j=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var V=K[j];console.assert(V,"Audio track is defined on fragment load progress");var P=V.details;console.assert(P,"Audio track details are defined on fragment load progress");var I=N.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new M.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[y.cc],de=(a=y.initSegment)===null||a===void 0?void 0:a.data;if(ne!==void 0){var me=!1,De=g?g.index:-1,xe=De!==-1,Le=new L.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,b.byteLength,De,xe);$.push(b,de,I,"",y,g,P.totalduration,me,Le,ne)}else{o.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+j);var Te=this.waitingData=this.waitingData||{frag:y,part:g,cache:new w.default,complete:!1},Se=Te.cache;Se.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,h)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(h,a){var y=a.tracks.audio;y&&(this.mediaBuffer=y.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(h,a){var y=a.frag,g=a.part;if(y.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(g?" p: "+g.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,g)},p.onError=function(h,a){switch(a.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(R.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var y=!0,g=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);g&&g.len>.5&&(y=!this.reduceMaxBufferLength(g.len)),y&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(h,a){var y=a.type;y===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(h){var a,y="audio",g=this.hls,b=h.remuxResult,N=h.chunkMeta,j=this.getCurrentContext(N);if(!j){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var K=j.frag,V=j.part,P=b.audio,I=b.text,$=b.id3,ne=b.initSegment;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,K,N),g.trigger(k.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:y,tracks:ne.tracks})),P){var de=P.startPTS,me=P.endPTS,De=P.startDTS,xe=P.endDTS;V&&(V.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:me,startDTS:De,endDTS:xe}),K.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,de,me,De,xe),this.bufferFragmentData(P,K,V,N)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Le=l({frag:K,id:y},$);g.trigger(k.Events.FRAG_PARSING_METADATA,Le)}if(I){var Te=l({frag:K,id:y},I);g.trigger(k.Events.FRAG_PARSING_USERDATA,Te)}},p._bufferInitSegment=function(h,a,y){if(this.state!==U.State.PARSING)return;h.video&&delete h.video;var g=h.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(k.Events.BUFFER_CODECS,h);var b=g.initSegment;if(b!=null&&b.byteLength){var N={type:"audio",frag:a,part:null,chunkMeta:y,parent:a.type,data:b};this.hls.trigger(k.Events.BUFFER_APPENDING,N)}this.tick()},p.loadFragment=function(h,a,y){var g=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||g===H.FragmentState.NOT_LOADED||g===H.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):a.live&&!Object(J.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,h,a,y)))},p.completeAudioSwitch=function(){var h=this.hls,a=this.media,y=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:y})},x}(U.default);Z.default=m},"./src/controller/audio-track-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/errors.ts"),k=O("./src/controller/base-playlist-controller.ts"),G=O("./src/types/loader.ts");function H(M,L){for(var A=0;A=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],C=u.id,v=u.groupId,m=v===void 0?"":v,_=u.name,x=u.type,p=u.url;if(this.trackId=d,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(J.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:_,type:x,url:p}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(c)},A.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;lL.partTarget&&(u+=1)}if(Object(J.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(J.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},E.loadPlaylist=function(M){},E.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},E.playlistLoaded=function(M,L,A){var S=this,d=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||A!=null&&A.live){if(d.reloaded(A),A&&this.log("live playlist "+M+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),A&&d.fragments.length>0&&Object(k.mergeDetails)(A,d),!this.canLoad||!d.live)return;var u,C=void 0,v=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,_=d.lastPartSn,x=d.endSN,p=d.lastPartIndex,c=p!==-1,h=_===x,a=m?0:p;c?(C=h?x+1:_,v=h?a:p+1):C=x+1;var y=d.age,g=y+d.ageHeader,b=Math.min(g-d.partTarget,d.targetduration*1.5);if(b>0){if(A&&b>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+b+" with playlist age: "+d.age),b=0;else{var N=Math.floor(b/d.targetduration);if(C+=N,v!==void 0){var j=Math.round(b%d.targetduration/d.partTarget);v+=j}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+b+" skip sn "+N+" to part "+v)}d.tuneInGoal=b}if(u=this.getDeliveryDirectives(d,L.deliveryDirectives,C,v),m||!h){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,L.deliveryDirectives,C,v);var K=Object(k.computeReloadInterval)(d,o);C!==void 0&&d.canBlockReload&&(K-=d.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(u)},K)}else this.clearTimer()},E.getDeliveryDirectives=function(M,L,A,S){var d=Object(U.getSkipValue)(M,A);return L!=null&&L.skip&&M.deltaUpdateFailed&&(A=L.msn,S=L.part,d=U.HlsSkip.No),new U.HlsUrlParameters(A,S,d)},E.retryLoadingOrFail=function(M){var L=this,A=this.hls.config,S=this.retryCount-1&&(d=M.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return S},R}()},"./src/controller/base-stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"State",function(){return x}),O.d(Z,"default",function(){return p});var J=O("./src/polyfills/number.ts"),U=O("./src/task-loop.ts"),k=O("./src/controller/fragment-tracker.ts"),G=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts"),F=O("./src/events.ts"),R=O("./src/errors.ts"),E=O("./src/types/transmuxer.ts"),w=O("./src/utils/mp4-tools.ts"),M=O("./src/utils/discontinuities.ts"),L=O("./src/controller/fragment-finders.ts"),A=O("./src/controller/level-helper.ts"),S=O("./src/loader/fragment-loader.ts"),d=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function u(c,h){for(var a=0;ane;(V<$||de)&&(de&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=V),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,b){if(this.state!==x.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var N=this.levels[b.frag.level].details;N&&this.loadFragment(b.frag,N,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(F.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,b){this.log("Loading key for "+g.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=x.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(F.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,b,N){this._loadFragForPlayback(g,b,N)},a._loadFragForPlayback=function(g,b,N){var j=this,K=function(P){if(j.fragContextChanged(g)){j.warn("Fragment "+g.sn+(P.part?" p: "+P.part.index:"")+" of level "+g.level+" was dropped during download."),j.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,j._handleFragmentLoadProgress(P)};this._doFragLoad(g,b,N,K).then(function(V){if(!V)return;j.fragLoadError=0;var P=j.state;if(j.fragContextChanged(g)){(P===x.FRAG_LOADING||P===x.BACKTRACKING||!j.fragCurrent&&P===x.PARSING)&&(j.fragmentTracker.removeFragment(g),j.state=x.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+g.sn+" of level "+g.level),j.hls.trigger(F.Events.FRAG_LOADED,V),j.state===x.BACKTRACKING)){j.fragmentTracker.backtrack(g,V),j.resetFragmentLoading(g);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,b,N){if(N===void 0&&(N=null),!(g-b))return;var j={startOffset:g,endOffset:b,type:N};this.fragLoadError=0,this.hls.trigger(F.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(g){var b=this;this._doFragLoad(g).then(function(N){if(!N||b.fragContextChanged(g)||!b.levels)throw new Error("init load aborted");return N}).then(function(N){var j=b.hls,K=N.payload,V=g.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var P=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(I){var $=self.performance.now();return j.trigger(F.Events.FRAG_DECRYPTED,{frag:g,payload:I,stats:{tstart:P,tdecrypt:$}}),N.payload=I,N})}return N}).then(function(N){var j=b.fragCurrent,K=b.hls,V=b.levels;if(!V)throw new Error("init load aborted, missing levels");var P=V[g.level].details;console.assert(P,"Level details are defined when init segment is loaded");var I=g.stats;b.state=x.IDLE,b.fragLoadError=0,g.data=new Uint8Array(N.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),N.frag===j&&K.trigger(F.Events.FRAG_BUFFERED,{stats:I,frag:j,part:null,id:g.type}),b.tick()}).catch(function(N){b.warn(N),b.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var b=this.fragCurrent;return!g||!b||g.level!==b.level||g.sn!==b.sn||g.urlId!==b.urlId},a.fragBufferedComplete=function(g,b){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(G.BufferHelper.getBuffered(N))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var b=this.transmuxer;if(!b)return;var N=g.frag,j=g.part,K=g.partsLoaded,V=!K||K.length===0||K.some(function(I){return!I}),P=new E.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,j?j.index:-1,!V);b.flush(P)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,b,N,j){var K=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(g.start,N||0),this.config.lowLatencyMode&&b){var V=b.partList;if(V&&j){N>g.end&&b.fragmentHint&&(g=b.fragmentHint);var P=this.getNextPart(V,g,N);if(P>-1){var I=V[P];return this.log("Loading part sn: "+g.sn+" p: "+I.index+" cc: "+g.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+P+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=x.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:g,part:V[P],targetBufferTime:N}),this.doFragPartsLoad(g,V,P,j).catch(function($){return K.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(V,N))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(N.toFixed(3))),Object(J.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=x.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:g,targetBufferTime:N}),this.fragmentLoader.load(g,j).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(g,b,N,j){var K=this;return new Promise(function(V,P){var I=[],$=function ne(de){var me=b[de];K.fragmentLoader.loadPart(g,me,j).then(function(De){I[me.index]=De;var xe=De.part;K.hls.trigger(F.Events.FRAG_LOADED,De);var Le=b[de+1];if(Le&&Le.fragment===g)ne(de+1);else return V({frag:g,part:xe,partsLoaded:I})}).catch(P)};$(N)})},a.handleFragLoadError=function(g){var b=g.data;return b&&b.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(F.Events.ERROR,b),null},a._handleTransmuxerFlush=function(g){var b=this.getCurrentContext(g);if(!b||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var N=b.frag,j=b.part,K=b.level,V=self.performance.now();N.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(N,j,K,g.partial)},a.getCurrentContext=function(g){var b=this.levels,N=g.level,j=g.sn,K=g.part;if(!b||!b[N])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+N+". The current chunk will not be buffered."),null;var V=b[N],P=K>-1?Object(A.getPartWith)(V,j,K):null,I=P?P.fragment:Object(A.getFragmentWithSN)(V,j,this.fragCurrent);return I?{frag:I,part:P,level:V}:null},a.bufferFragmentData=function(g,b,N,j){if(!g||this.state!==x.PARSING)return;var K=g.data1,V=g.data2,P=K;if(K&&V&&(P=Object(w.appendUint8Array)(K,V)),!P||!P.length)return;var I={type:g.type,frag:b,part:N,chunkMeta:j,parent:b.type,data:P};this.hls.trigger(F.Events.BUFFER_APPENDING,I),g.dropped&&g.independent&&!N&&this.flushBufferGap(b)},a.flushBufferGap=function(g){var b=this.media;if(!b)return;if(!G.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,g.start);return}var N=b.currentTime,j=G.BufferHelper.bufferInfo(b,N,0),K=g.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),P=Math.max(Math.min(g.start-V,j.end-V),N+V);g.start-P>V&&this.flushMainBuffer(P,g.start)},a.getFwdBufferInfo=function(g,b){var N=this.config,j=this.getLoadPosition();if(!Object(J.isFiniteNumber)(j))return null;var K=G.BufferHelper.bufferInfo(g,j,N.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,b);if(V&&K.nextStart=N?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,b){var N,j,K=b.fragments,V=K.length;if(!V)return null;var P=this.config,I=K[0].start,$;if(b.live){var ne=P.initialLiveManifestSize;if(V-1&&N<$.start)break;var ne=$.loaded;!ne&&(K||$.independent||V)&&$.fragment===b&&(j=P),K=ne}return j},a.loadedEndOfParts=function(g,b){var N=g[g.length-1];return N&&b>N.start&&N.loaded},a.getInitialLiveFragment=function(g,b){var N=this.fragPrevious,j=null;if(N){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),j=Object(L.findFragmentByPDT)(b,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var K=N.sn+1;if(K>=g.startSN&&K<=g.endSN){var V=b[K-g.startSN];N.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(L.findFragWithCC)(b,N.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(j=this.getFragmentAtPosition(P,this.bitrateTest?g.fragmentEnd:g.edge,g))}return j},a.getFragmentAtPosition=function(g,b,N){var j=this.config,K=this.fragPrevious,V=N.fragments,P=N.endSN,I=N.fragmentHint,$=j.maxFragLookUpTolerance,ne=!!(j.lowLatencyMode&&N.partList&&I);ne&&I&&!this.bitrateTest&&(V=V.concat(I),P=I.sn);var de;if(gb-$?0:$;de=Object(L.findFragmentByPTS)(K,V,g,me)}else de=V[V.length-1];if(de){var De=de.sn-N.startSN,xe=K&&de.level===K.level,Le=V[De+1],Te=this.fragmentTracker.getState(de);if(Te===k.FragmentState.BACKTRACKED){de=null;for(var Se=De;V[Se]&&this.fragmentTracker.getState(V[Se])===k.FragmentState.BACKTRACKED;)K?de=V[Se--]:de=V[--Se];de||(de=Le)}else K&&de.sn===K.sn&&!ne&&(xe&&(de.sn=V-b.maxFragLookUpTolerance&&K<=P;if(j!==null&&N.duration>j&&(K"+g.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+P),de}return I},a.waitForCdnTuneIn=function(g){var b=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*b)},a.setStartPosition=function(g,b){var N=this.startPosition;if(N"+g))}}]),h}(U.default)},"./src/controller/buffer-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return L});var J=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),k=O("./src/utils/logger.ts"),G=O("./src/errors.ts"),H=O("./src/utils/buffer-helper.ts"),F=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),E=O("./src/controller/buffer-operation-queue.ts"),w=Object(F.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function A(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,C=o.mediaSource;k.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){k.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){k.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var S=A.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},S.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,k.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&w){var C=this.mediaSource=new w;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},S.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(k.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){k.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):k.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},S.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(C){k.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},S.onBufferCodecs=function(o,l){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(C){var m=u.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var _=l[v],x=_.codec,p=_.levelCodec,c=_.container,h=(m.levelCodec||m.codec).replace(M,"$1"),a=(p||x).replace(M,"$1");if(h!==a){var y=c+";codecs="+(p||x);u.appendChangeType(v,y)}}}else u.pendingTracks[v]=l[v]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(o,l){var u=this,C=this.operationQueue,v={execute:function(){var _=u.sourceBuffer[o];_&&(k.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),_.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(_){k.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",_)}};C.append(v,o)},S.onBufferAppending=function(o,l){var u=this,C=this.hls,v=this.operationQueue,m=this.tracks,_=l.data,x=l.type,p=l.frag,c=l.part,h=l.chunkMeta,a=h.buffering[x],y=self.performance.now();a.start=y;var g=p.stats.buffering,b=c?c.stats.buffering:null;g.start===0&&(g.start=y),b&&b.start===0&&(b.start=y);var N=m.audio,j=x==="audio"&&h.id===1&&(N==null?void 0:N.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),j){var P=u.sourceBuffer[x];if(P){var I=p.start-P.timestampOffset;Math.abs(I)>=.1&&(k.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+I+") sn: "+p.sn+")"),P.timestampOffset=p.start)}}u.appendExecutor(_,x)},onStart:function(){},onComplete:function(){var P=self.performance.now();a.executeEnd=a.end=P,g.first===0&&(g.first=P),b&&b.first===0&&(b.first=P);var I=u.sourceBuffer,$={};for(var ne in I)$[ne]=H.BufferHelper.getBuffered(I[ne]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:p,part:c,chunkMeta:h,parent:p.type,timeRanges:$})},onError:function(P){k.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",P);var I={type:G.ErrorTypes.MEDIA_ERROR,parent:p.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=G.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,I.details=G.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(k.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),C.trigger(U.Events.ERROR,I)}};v.append(K,x)},S.onBufferFlushing=function(o,l){var u=this,C=this.operationQueue,v=function(_){return{execute:u.removeExecutor.bind(u,_,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:_})},onError:function(p){k.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",p)}}};l.type?C.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){C.append(v(m),m)})},S.onFragParsed=function(o,l){var u=this,C=l.frag,v=l.part,m=[],_=v?v.elementaryStreams:C.elementaryStreams;_[R.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(_[R.ElementaryStreamTypes.AUDIO]&&m.push("audio"),_[R.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var c=self.performance.now();C.stats.buffering.end=c,v&&(v.stats.buffering.end=c);var h=v?v.stats:C.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,stats:h,id:C.type})};m.length===0&&k.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(x,m)},S.onFragChanged=function(o,l){this.flushBackBuffer()},S.onBufferEos=function(o,l){var u=this,C=this.getSourceBufferTypes().reduce(function(v,m){var _=u.sourceBuffer[m];return(!l.type||l.type===m)&&(_&&!_.ended&&(_.ended=!0,k.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!_||_.ended)},!0);C&&this.blockBuffers(function(){var v=u.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},S.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},S.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,C=this.sourceBuffer;if(!u||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(J.isFiniteNumber)(m)||m<0)return;var _=u.currentTime,x=l.levelTargetDuration,p=Math.max(m,x),c=Math.floor(_/x)*x-p;v.forEach(function(h){var a=C[h];if(a){var y=H.BufferHelper.getBuffered(a);y.length>0&&c>y.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:h}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,C=this.mediaSource,v=o.fragments[0].start+o.totalduration,m=u.duration,_=Object(J.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(k.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(v>_&&v>m||!Object(J.isFiniteNumber)(m))&&(k.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},S.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,C=u.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,u[0].start),m=Math.max(v,v+o.totalduration);l.setLiveSeekableRange(v,m)}},S.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!o||C===2){this.createSourceBuffers(u),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){l.executeNext(m)})}},S.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var v in o)if(!l[v]){var m=o[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var _=m.levelCodec||m.codec,x=m.container+";codecs="+_;k.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var p=l[v]=u.addSourceBuffer(x),c=v;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[v]={buffer:p,codec:_,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(h){k.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:x})}}C&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},S._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},S._onSBUpdateError=function(o,l){k.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},S.removeExecutor=function(o,l,u){var C=this.media,v=this.mediaSource,m=this.operationQueue,_=this.sourceBuffer,x=_[o];if(!C||!v||!x){k.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var p=Object(J.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(J.isFiniteNumber)(v.duration)?v.duration:Infinity,h=Math.max(0,l),a=Math.min(u,p,c);a>h?(k.logger.log("[buffer-controller]: Removing ["+h+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(h,a)):m.shiftAndExecuteNext(o)},S.appendExecutor=function(o,l){var u=this.operationQueue,C=this.sourceBuffer,v=C[l];if(!v){k.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(o)},S.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){k.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,v=l.map(function(m){return C.appendBlocker(m)});Promise.all(v).then(function(){o(),l.forEach(function(m){var _=u.sourceBuffer[m];(!_||!_.updating)&&C.shiftAndExecuteNext(m)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(o,l,u){var C=this.sourceBuffer[o];if(!C)return;var v=u.bind(this,o);this.listeners[o].push({event:l,listener:v}),C.addEventListener(l,v)},S.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return U});var J=O("./src/utils/logger.ts"),U=function(){function k(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var G=k.prototype;return G.append=function(F,R){var E=this.queues[R];E.push(F),E.length===1&&this.buffers[R]&&this.executeNext(R)},G.insertAbort=function(F,R){var E=this.queues[R];E.unshift(F),this.executeNext(R)},G.appendBlocker=function(F){var R,E=new Promise(function(M){R=M}),w={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,F),E},G.executeNext=function(F){var R=this.buffers,E=this.queues,w=R[F],M=E[F];if(M.length){var L=M[0];try{L.execute()}catch(A){J.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(A),(!w||!w.updating)&&(M.shift(),this.executeNext(F))}}},G.shiftAndExecuteNext=function(F){this.queues[F].shift(),this.executeNext(F)},G.current=function(F){return this.queues[F][0]},k}()},"./src/controller/cap-level-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts");function U(H,F){for(var R=0;R0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(E.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},F.getMaxLevel=function(E){var w=this,M=this.hls.levels;if(!M.length)return-1;var L=M.filter(function(A,S){return H.isLevelAllowed(S,w.restrictedLevels)&&S<=E});return this.clientRect=null,H.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},F.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()},F.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},F.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,w={width:0,height:0};if(E){var M=E.getBoundingClientRect();w.width=M.width,w.height=M.height,!w.width&&!w.height&&(w.width=M.right-M.left||E.width||0,w.height=M.bottom-M.top||E.height||0)}return this.clientRect=w,w},H.isLevelAllowed=function(E,w){return w===void 0&&(w=[]),w.indexOf(E)===-1},H.getMaxLevelByMediaSize=function(E,w,M){if(!E||!E.length)return-1;for(var L=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},A=E.length-1,S=0;S=w||d.height>=M)&&L(d,E[S+1])){A=S;break}}return A},k(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(w){}return E}}]),H}();Z.default=G},"./src/controller/cmcd-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return L});var J=O("./src/events.ts"),U=O("./src/types/cmcd.ts"),k=O("./src/utils/buffer-helper.ts"),G=O("./src/utils/logger.ts");function H(A,S){for(var d=0;d=A.length?{done:!0}:{done:!1,value:A[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(A,S){if(!A)return;if(typeof A=="string")return w(A,S);var d=Object.prototype.toString.call(A).slice(8,-1);if(d==="Object"&&A.constructor&&(d=A.constructor.name),d==="Map"||d==="Set")return Array.from(A);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return w(A,S)}function w(A,S){(S==null||S>A.length)&&(S=A.length);for(var d=0,o=new Array(S);dl&&(l=m.bitrate)}return l>0?l:NaN},S.getBufferLength=function(o){var l=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var C=k.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return C.len*1e3},S.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(_,x,p){l(_),this.loader.load(_,x,p)},F(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},S.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(_,x,p){l(_),this.loader.load(_,x,p)},F(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},A.serialize=function(o){for(var l=[],u=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},C=function(j){return Math.round(j)},v=function(j){return C(j/100)*100},m=function(j){return encodeURIComponent(j)},_={br:C,d:C,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:C},x=Object.keys(o||{}).sort(),p=R(x),c;!(c=p()).done;){var h=c.value,a=o[h];if(!u(a))continue;if(h==="v"&&a===1)continue;if(h=="pr"&&a===1)continue;var y=_[h];y&&(a=y(a));var g=typeof a,b=void 0;h==="ot"||h==="sf"||h==="st"?b=h+"="+a:g==="boolean"?b=h:g==="number"?b=h+"="+a:b=h+"="+JSON.stringify(a),l.push(b)}return l.join(",")},A.toHeaders=function(o){for(var l=Object.keys(o),u={},C=["Object","Request","Session","Status"],v=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},_=0,x=l;_R){this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=R-this._requestLicenseFailureCount+1;k.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,u)}break}},A._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},A._requestLicense=function(d,o){k.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){k.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(u,d,o);k.logger.log("Sending license request to URL: "+u);var v=this._generateLicenseRequestChallenge(l,d);C.send(v)}catch(m){k.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,u)},F(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Z.default=M},"./src/controller/fps-controller.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/events.ts"),U=O("./src/utils/logger.ts"),k=function(){function G(F){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=F,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(R){this.streamController=R},H.registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(R,E){var w=this.hls.config;if(w.capLevelOnFPSDrop){var M=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(R,E,w){var M=performance.now();if(E){if(this.lastTime){var L=M-this.lastTime,A=w-this.lastDroppedFrames,S=E-this.lastDecodedFrames,d=1e3*A/L,o=this.hls;if(o.trigger(J.Events.FPS_DROP,{currentDropped:A,currentDecoded:S,totalDroppedFrames:w}),d>0&&A>o.config.fpsDroppedMonitoringThreshold*S){var l=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(J.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=w,this.lastDecodedFrames=E}},H.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var E=R.getVideoPlaybackQuality();this.checkFPS(R,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},G}();Z.default=k},"./src/controller/fragment-finders.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"findFragmentByPDT",function(){return k}),O.d(Z,"findFragmentByPTS",function(){return G}),O.d(Z,"fragmentWithinToleranceTest",function(){return H}),O.d(Z,"pdtWithinToleranceTest",function(){return F}),O.d(Z,"findFragWithCC",function(){return R});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/binary-search.ts");function k(E,w,M){if(w===null||!Array.isArray(E)||!E.length||!Object(J.isFiniteNumber)(w))return null;var L=E[0].programDateTime;if(w<(L||0))return null;var A=E[E.length-1].endProgramDateTime;if(w>=(A||0))return null;M=M||0;for(var S=0;SE&&M.start?-1:0}function F(E,w,M){var L=Math.min(w,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,A=M.endProgramDateTime||0;return A-L>E}function R(E,w){return U.default.search(E,function(M){return M.ccw?-1:0})}},"./src/controller/fragment-tracker.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"FragmentState",function(){return k}),O.d(Z,"FragmentTracker",function(){return G});var J=O("./src/events.ts"),U=O("./src/types/loader.ts"),k;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(k||(k={}));var G=function(){function R(w){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=w,this._registerListeners()}var E=R.prototype;return E._registerListeners=function(){var M=this.hls;M.on(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(J.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var M=this.hls;M.off(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(J.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(M,L){if(L===U.PlaylistLevelType.MAIN){var A=this.activeFragment,S=this.activeParts;if(!A)return null;if(S)for(var d=S.length;d--;){var o=S[d],l=o?o.end:A.appendedPTS;if(o.start<=M&&l!==void 0&&M<=l)return d>9&&(this.activeParts=S.slice(d-9)),o}else if(A.start<=M&&A.appendedPTS!==void 0&&M<=A.appendedPTS)return A}return this.getBufferedFrag(M,L)},E.getBufferedFrag=function(M,L){for(var A=this.fragments,S=Object.keys(A),d=S.length;d--;){var o=A[S[d]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=M&&M<=l.end)return l}}return null},E.detectEvictedFragments=function(M,L,A){var S=this;Object.keys(this.fragments).forEach(function(d){var o=S.fragments[d];if(!o)return;if(!o.buffered){o.body.type===A&&S.removeFragment(o.body);return}var l=o.range[M];if(!l)return;l.time.some(function(u){var C=!S.isTimeBuffered(u.startPTS,u.endPTS,L);return C&&S.removeFragment(o.body),C})})},E.detectPartialFragments=function(M){var L=this,A=this.timeRanges,S=M.frag,d=M.part;if(!A||S.sn==="initSegment")return;var o=F(S),l=this.fragments[o];if(!l)return;Object.keys(A).forEach(function(u){var C=S.elementaryStreams[u];if(!C)return;var v=A[u],m=d!==null||C.partial===!0;l.range[u]=L.getBufferedTimes(S,d,m,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},E.fragBuffered=function(M){var L=F(M),A=this.fragments[L];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},E.getBufferedTimes=function(M,L,A,S){for(var d={time:[],partial:A},o=L?L.start:M.start,l=L?L.end:M.end,u=M.minEndPTS||l,C=M.maxStartPTS||o,v=0;v=m&&u<=_){d.time.push({startPTS:Math.max(o,S.start(v)),endPTS:Math.min(l,S.end(v))});break}else if(o<_&&l>m)d.partial=!0,d.time.push({startPTS:Math.max(o,S.start(v)),endPTS:Math.min(l,S.end(v))});else if(l<=m)break}return d},E.getPartialFragment=function(M){var L=null,A,S,d,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var v=u[C];if(!v)return;H(v)&&(S=v.body.start-l,d=v.body.end+l,M>=S&&M<=d&&(A=Math.min(M-S,d-M),o<=A&&(L=v.body,o=A)))}),L},E.getState=function(M){var L=F(M),A=this.fragments[L];return A?A.buffered?H(A)?k.PARTIAL:k.OK:A.backtrack?k.BACKTRACKED:k.APPENDING:k.NOT_LOADED},E.backtrack=function(M,L){var A=F(M),S=this.fragments[A];if(!S||S.backtrack)return null;var d=S.backtrack=L||S.loaded;return S.loaded=null,d},E.getBacktrackData=function(M){var L=F(M),A=this.fragments[L];if(A){var S,d=A.backtrack;if(d!=null&&(S=d.payload)!==null&&S!==void 0&&S.byteLength)return d;this.removeFragment(M)}return null},E.isTimeBuffered=function(M,L,A){for(var S,d,o=0;o=S&&L<=d)return!0;if(L<=S)return!1}return!1},E.onFragLoaded=function(M,L){var A=L.frag,S=L.part;if(A.sn==="initSegment"||A.bitrateTest||S)return;var d=F(A);this.fragments[d]={body:A,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(M,L){var A=this,S=L.frag,d=L.part,o=L.timeRanges;if(S.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=S,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var C=o[u];if(A.detectEvictedFragments(u,C),!d)for(var v=0;vM&&S.removeFragment(l)}})},E.removeFragment=function(M){var L=F(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[L]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function H(R){var E,w;return R.buffered&&(((E=R.range.video)===null||E===void 0?void 0:E.partial)||((w=R.range.audio)===null||w===void 0?void 0:w.partial))}function F(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),O.d(Z,"MAX_START_GAP_JUMP",function(){return F}),O.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d(Z,"SKIP_BUFFER_RANGE_START",function(){return E}),O.d(Z,"default",function(){return w});var J=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),k=O("./src/events.ts"),G=O("./src/utils/logger.ts"),H=250,F=2,R=.1,E=.05,w=function(){function M(A,S,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=A,this.media=S,this.fragmentTracker=d,this.hls=o}var L=M.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(S){var d=this.config,o=this.media,l=this.stalled,u=o.currentTime,C=o.seeking,v=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,u!==S){if(this.moved=!0,l!==null){if(this.stallReported){var _=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!J.BufferHelper.getBuffered(o).length)return;var x=J.BufferHelper.bufferInfo(o,u,0),p=x.len>0,c=x.nextStart||0;if(!p&&!c)return;if(C){var h=x.len>F,a=!c||c-u>F&&!this.fragmentTracker.getPartialFragment(u);if(h||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,g=Math.max(c,x.start||0)-u,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=b==null||((y=b.details)===null||y===void 0)?void 0:y.live,j=N?b.details.targetduration*2:F;if(g>0&&g<=j){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!C&&V>=H&&this._reportStall(x.len);var P=J.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(P,V)},L._tryFixBufferStall=function(S,d){var o=this.config,l=this.fragmentTracker,u=this.media,C=u.currentTime,v=l.getPartialFragment(C);if(v){var m=this._trySkipBufferHole(v);if(m)return}S.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(S){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+S+")"),d.trigger(k.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},L._trySkipBufferHole=function(S){for(var d=this.config,o=this.hls,l=this.media,u=l.currentTime,C=0,v=J.BufferHelper.getBuffered(l),m=0;m=C&&u<_){var x=Math.max(_+E,l.currentTime+R);return G.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,S&&o.trigger(k.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+x,frag:S}),x}C=v.end(m)}return 0},L._tryNudgeBuffer=function(){var S=this.config,d=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),_=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;M.playbackRate=Math.min(m,Math.max(1,_))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},E.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},E.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},H(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,L=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:L?M.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var L=M.holdBack,A=M.partHoldBack,S=M.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,u=d.lowLatencyMode,C=this.hls.userConfig,v=u&&A||L;(C.liveSyncDuration||C.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*S);var m=S,_=1;return v+Math.min(this.stallCount*_,m)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),L=this.targetLatency,A=this.levelDetails;if(M===null||L===null||A===null)return null;var S=A.edge,d=M-L-this.edgeStalled,o=S-A.totalduration,l=S-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var L=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-L,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,L=this.levelDetails;if(!M||!L)return 0;var A=M.buffered.length;return A?M.buffered.end(A-1):L.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return d});var J=O("./src/types/level.ts"),U=O("./src/events.ts"),k=O("./src/errors.ts"),G=O("./src/utils/codecs.ts"),H=O("./src/controller/level-helper.ts"),F=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var l=1;l0){c=_[0].bitrate,_.sort(function(V,P){return V.bitrate-P.bitrate}),this._levels=_;for(var N=0;N<_.length;N++)if(_[N].bitrate===c){this._firstLevel=N,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+c);break}var j=b&&!g,K={levels:_,audioTracks:x,subtitleTracks:p,firstLevel:this._firstLevel,stats:m.stats,audio:b,video:g,altAudio:!j&&x.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(v,m){if(o.prototype.onError.call(this,v,m),m.fatal)return;var _=m.context,x=this._levels[this.currentLevelIndex];if(_&&(_.type===R.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&_.groupId===x.audioGroupIds[x.urlId]||_.type===R.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&_.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,c=!0,h;switch(m.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=m.frag.level)):h=m.frag.level}break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(c=!1),h=_.level),p=!0;break;case k.ErrorDetails.REMUX_ALLOC_ERROR:h=m.level,p=!0;break}h!==void 0&&this.recoverLevel(m,h,p,c)},u.recoverLevel=function(v,m,_,x){var p=v.details,c=this._levels[m];if(c.loadError++,_){var h=this.retryLoadingOrFail(v);if(h)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=c.url.length;if(a>1&&c.loadError1){var x=(m.urlId+1)%_;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(p){p.urlId=x}),this.level=v}},u.onFragLoaded=function(v,m){var _=m.frag;if(_!==void 0&&_.type===R.PlaylistLevelType.MAIN){var x=this._levels[_.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(v,m){var _,x=m.level,p=m.details,c=this._levels[x];if(!c){var h;this.warn("Invalid level index "+x),(h=m.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(p.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,c.details)):(_=m.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(p.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(v,m){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var x=-1,p=this.hls.audioTracks[m.id].groupId,c=0;c<_.audioGroupIds.length;c++)if(_.audioGroupIds[c]===p){x=c;break}x!==_.urlId&&(_.urlId=x,this.startLoad())}},u.loadPlaylist=function(v){var m=this.currentLevelIndex,_=this._levels[m];if(this.canLoad&&_&&_.url.length>0){var x=_.urlId,p=_.url[x];if(v)try{p=v.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+x+" "+p),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:p,level:m,id:x,deliveryDirectives:v||null})}},u.removeLevel=function(v,m){var _=function(c,h){return h!==m},x=this._levels.filter(function(p,c){return c!==v?!0:p.url.length>1&&m!==void 0?(p.url=p.url.filter(_),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(_)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(_)),p.urlId=0,!0):!1}).map(function(p,c){var h=p.details;return h!=null&&h.fragments&&h.fragments.forEach(function(a){a.level=c}),p});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===v&&(m=_[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=_.length){var x=v<0;if(this.hls.trigger(U.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:x,reason:"invalid level idx"}),x)return;v=Math.min(v,_.length-1)}this.clearTimer();var p=this.currentLevelIndex,c=_[p],h=_[v];this.log("switching to level "+v+" from "+p),this.currentLevelIndex=v;var a=E({},h,{level:v,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var y=h.details;if(!y||y.live){var g=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(F.default)},"./src/controller/level-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"addGroupId",function(){return k}),O.d(Z,"assignTrackIdsByGroup",function(){return G}),O.d(Z,"updatePTS",function(){return H}),O.d(Z,"updateFragPTSDTS",function(){return R}),O.d(Z,"mergeDetails",function(){return E}),O.d(Z,"mapPartIntersection",function(){return w}),O.d(Z,"mapFragmentIntersection",function(){return M}),O.d(Z,"adjustSliding",function(){return L}),O.d(Z,"addSliding",function(){return A}),O.d(Z,"computeReloadInterval",function(){return S}),O.d(Z,"getFragmentWithSN",function(){return d}),O.d(Z,"getPartWith",function(){return o});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts");function k(l,u,C){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function G(l){var u={};l.forEach(function(C){var v=C.groupId||"";C.id=u[v]=u[v]||0,u[v]++})}function H(l,u,C){var v=l[u],m=l[C];F(v,m)}function F(l,u){var C=u.startPTS;if(Object(J.isFiniteNumber)(C)){var v=0,m;u.sn>l.sn?(v=C-l.start,m=l):(v=l.start-C,m=u),m.duration!==v&&(m.duration=v)}else if(u.sn>l.sn){var _=l.cc===u.cc;_&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function R(l,u,C,v,m,_){var x=v-C;x<=0&&(U.logger.warn("Fragment should have a positive duration",u),v=C+u.duration,_=m+u.duration);var p=C,c=v,h=u.startPTS,a=u.endPTS;if(Object(J.isFiniteNumber)(h)){var y=Math.abs(h-C);Object(J.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(y,u.deltaPTS):u.deltaPTS=y,p=Math.max(C,h),C=Math.min(C,h),m=Math.min(m,u.startDTS),c=Math.min(v,a),v=Math.max(v,a),_=Math.max(_,u.endDTS)}u.duration=v-C;var g=C-u.start;u.appendedPTS=v,u.start=u.startPTS=C,u.maxStartPTS=p,u.startDTS=m,u.endPTS=v,u.minEndPTS=c,u.endDTS=_;var b=u.sn;if(!l||bl.endSN)return 0;var N,j=b-l.startSN,K=l.fragments;for(K[j]=u,N=j;N>0;N--)F(K[N],K[N-1]);for(N=j;N=0;m--){var _=v[m].initSegment;if(_){C=_;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,p;if(M(l,u,function(N,j){N.relurl&&(x=N.cc-j.cc),Object(J.isFiniteNumber)(N.startPTS)&&Object(J.isFiniteNumber)(N.endPTS)&&(j.start=j.startPTS=N.startPTS,j.startDTS=N.startDTS,j.appendedPTS=N.appendedPTS,j.maxStartPTS=N.maxStartPTS,j.endPTS=N.endPTS,j.endDTS=N.endDTS,j.minEndPTS=N.minEndPTS,j.duration=N.endPTS-N.startPTS,j.duration&&(p=j),u.PTSKnown=u.alignedSliding=!0),j.elementaryStreams=N.elementaryStreams,j.loader=N.loader,j.stats=N.stats,j.urlId=N.urlId,N.initSegment&&(j.initSegment=N.initSegment,C=N.initSegment)}),C){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(N){var j;(!N.initSegment||N.initSegment.relurl===((j=C)===null||j===void 0?void 0:j.relurl))&&(N.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(N){return!N}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=u.skippedSegments;h--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y=v.length)return;A(u,v[C].start)}function A(l,u){if(u){for(var C=l.fragments,v=l.skippedSegments;v0&&m0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),c=h),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,h=this.levels,a=this.level,y=h==null||((c=h[a])===null||c===void 0)?void 0:c.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,b=self.performance.now(),N=this.retryDate;(!N||b>=N||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var c,h,a=this.hls,y=this.levelLastLoaded,g=this.levels,b=this.media,N=a.config,j=a.nextLoadLevel;if(y===null||!b&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[j])return;var K=g[j];this.level=a.nextLoadLevel=j;var V=K.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=U.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,R.PlaylistLevelType.MAIN);if(P===null)return;var I=P.len,$=this.getMaxBufferLength(K.maxBitrate);if(I>=$)return;if(this._streamEnded(P,V)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ne),this.state=U.State.ENDED;return}var de=P.end,me=this.getNextFragment(de,V);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"){var De=me.sn-V.startSN;De>1&&(me=V.fragments[De-1],this.fragmentTracker.removeFragment(me))}if(me&&this.fragmentTracker.getState(me)===F.FragmentState.OK&&this.nextLoadPosition>de){var xe=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,xe,R.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,V)}if(!me)return;me.initSegment&&!me.initSegment.data&&!this.bitrateTest&&(me=me.initSegment),((c=me.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((h=me.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(me,V):this.loadFragment(me,V,de)},x.loadFragment=function(c,h,a){var y,g=this.fragmentTracker.getState(c);if(this.fragCurrent=c,g===F.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(c);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else g=F.FragmentState.NOT_LOADED}g===F.FragmentState.NOT_LOADED||g===F.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,h,a)):g===F.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(c){var h=this.fragmentTracker.getAppendedFrag(c,R.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},x.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,R.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var c=this.levels,h=this.media;if(h!=null&&h.readyState){var a,y=this.getAppendedFrag(h.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!h.paused&&c){var g=this.hls.nextLoadLevel,b=c[g],N=this.fragLastKbps;N&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*N)+1:a=0}else a=0;var j=this.getBufferedFrag(h.currentTime+a);if(j){var K=this.followingBufferedFrag(j);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,P=K.duration,I=Math.max(j.end,V+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(c,h){m.prototype.flushMainBuffer.call(this,c,h,this.altAudio?"video":null)},x.onMediaAttached=function(c,h){m.prototype.onMediaAttached.call(this,c,h);var a=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var c=this.media,h=c?c.currentTime:null;Object(J.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(c,h){var a=!1,y=!1,g;h.levels.forEach(function(b){g=b.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=a&&y&&!Object(k.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},x.onLevelLoading=function(c,h){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var y=a[h.level];(!y.details||y.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(y.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(c,h){var a,y=this.levels,g=h.level,b=h.details,N=b.totalduration;if(!y){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+N);var j=this.fragCurrent;j&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==h.level&&j.loader&&(this.state=U.State.IDLE,j.loader.abort()));var K=y[g],V=0;if(b.live||(a=K.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;V=this.alignPlaylists(b,K.details)}if(K.details=b,this.levelLastLoaded=g,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:b,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=U.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,V),this.tick()},x._handleFragmentLoadProgress=function(c){var h,a=c.frag,y=c.part,g=c.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var N=b[a.level],j=N.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=N.videoCodec,V=j.PTSKnown||!j.live,P=(h=a.initSegment)===null||h===void 0?void 0:h.data,I=this._getAudioCodec(N),$=this.transmuxer=this.transmuxer||new w.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=y?y.index:-1,de=ne!==-1,me=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,ne,de),De=this.initPTS[a.cc];$.push(g,P,I,K,a,y,j.totalduration,V,me,De)},x.onAudioTrackSwitching=function(c,h){var a=this.altAudio,y=!!h.url,g=h.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;a&&N.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:g})}},x.onAudioTrackSwitched=function(c,h){var a=h.id,y=!!this.hls.audioTracks[a].url;if(y){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=y,this.tick()},x.onBufferCreated=function(c,h){var a=h.tracks,y,g,b=!1;for(var N in a){var j=a[N];if(j.id==="main"){if(g=N,y=j,N==="video"){var K=a[N];K&&(this.videoBuffer=K.buffer)}}else b=!0}b&&y?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(c,h){var a=h.frag,y=h.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(y?" p: "+y.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=y?y.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,y)},x.onError=function(c,h){switch(h.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,h);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=U.State.ERROR):!h.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,y=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);y&&y.len>.5&&(a=!this.reduceMaxBufferLength(y.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var c=this.media,h=this.gapController;if(!c||!h||!c.readyState)return;var a=H.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(c,h){var a=h.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,a,R.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(c,h){this.levels=h.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var c=this.media,h=c.currentTime,a=this.startPosition;if(a>=0&&h0&&(b1&&c.seeking===!1){var a=c.currentTime;if(H.BufferHelper.isBuffered(c,a)?h=this.getAppendedFrag(a):H.BufferHelper.isBuffered(c,a+.1)&&(h=this.getAppendedFrag(a+.1)),h){var y=this.fragPlaying,g=h.level;(!y||h.sn!==y.sn||y.level!==g||h.urlId!==y.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:h}),(!y||y.level!==g)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=h)}}},o(_,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var h=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"SubtitleStreamController",function(){return l});var J=O("./src/events.ts"),U=O("./src/utils/logger.ts"),k=O("./src/utils/buffer-helper.ts"),G=O("./src/controller/fragment-finders.ts"),H=O("./src/utils/discontinuities.ts"),F=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),E=O("./src/controller/base-stream-controller.ts"),w=O("./src/types/loader.ts"),M=O("./src/types/level.ts");function L(u,C){for(var v=0;v=h[g].start&&y<=h[g].end){a=h[g];break}var b=p.start+p.duration;a?a.end=b:(a={start:y,end:b},h.push(a)),this.fragmentTracker.fragBuffered(p)},v.onBufferFlushing=function(_,x){var p=x.startOffset,c=x.endOffset;if(p===0&&c!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var y=a[h].details,g=y.targetduration,b=c-g;if(b<=0)return;x.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(N){for(var j=0;j=y.length||h!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(p=g.details)!==null&&p!==void 0&&p.live){var b=this.mainDetails;if(c.deltaUpdateFailed||!b)return;var N=b.fragments[0];if(!g.details)c.hasProgramDateTime&&b.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(c,b):N&&Object(F.addSliding)(c,N.start);else{var j=this.alignPlaylists(c,g.details);j===0&&N&&Object(F.addSliding)(c,N.start)}}if(g.details=c,this.levelLastLoaded=h,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var K=Object(G.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},v._handleFragmentLoadComplete=function(_){var x=_.frag,p=_.payload,c=x.decryptdata,h=this.hls;if(this.fragContextChanged(x))return;if(p&&p.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),c.key.buffer,c.iv.buffer).then(function(y){var g=performance.now();h.trigger(J.Events.FRAG_DECRYPTED,{frag:x,payload:y,stats:{tstart:a,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var _,x=this.currentTrackId,p=this.levels;if(!p.length||!p[x]||!p[x].details)return;var c=p[x].details,h=c.targetduration,a=this.config,y=this.media,g=k.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-h,a.maxBufferHole),b=g.end,N=g.len,j=this.getMaxBufferLength()+h;if(N>j)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var K=c.fragments,V=K.length,P=c.edge,I,$=this.fragPrevious;if(b-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)},S.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},S.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=M(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},S.onSubtitleTrackLoaded=function(o,l){var u=l.id,C=l.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+u);return}var _=m.details;m.details=l.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,_))},S.onLevelLoading=function(o,l){this.switchLevel(l.level)},S.onLevelSwitching=function(o,l){this.switchLevel(l.level)},S.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(x){return!u||x.groupId===u});this.tracksInGroup=v;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var _={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(J.Events.SUBTITLE_TRACKS_UPDATED,_),m!==-1&&this.setSubtitleTrack(m,C)}},S.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u=C.length)return;this.clearTimer();var v=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var m=v.id,_=v.groupId,x=_===void 0?"":_,p=v.name,c=v.type,h=v.url;this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:p,type:c,url:h});var a=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:o})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=M(this.media.textTracks),u=0;u=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],v),x=!0,h/(v-C)>.5))return}if(x||_.push([C,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,C,v,m)}else{var y=this.Cues.newCue(null,C,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:y,track:u})}},o.onInitPtsFound=function(u,C){var v=this,m=C.frag,_=C.id,x=C.initPTS,p=C.timescale,c=this.unparsedVttFrags;_==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=p),c.length&&(this.unparsedVttFrags=[],c.forEach(function(h){v.onFragLoaded(U.Events.FRAG_LOADED,h)}))},o.getExistingTrack=function(u){var C=this.media;if(C)for(var v=0;v>>8^p&255^99,R[m]=p,E[p]=m;var c=v[m],h=v[c],a=v[h],y=v[p]*257^p*16843008;M[m]=y<<24|y>>>8,L[m]=y<<16|y>>>16,A[m]=y<<8|y>>>24,S[m]=y,y=a*16843009^h*65537^c*257^m*16843008,o[p]=y<<24|y>>>8,l[p]=y<<16|y>>>16,u[p]=y<<8|y>>>24,C[p]=y,m?(m=c^v[v[v[a^c]]],_^=v[v[_]]):m=_=1}},H.expandKey=function(R){for(var E=this.uint8ArrayToUint32Array_(R),w=!0,M=0;M>>6)+1;var y=(u[C+2]&60)>>>2;if(y>a.length-1){l.trigger(k.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return x=(u[C+2]&1)<<2,x|=(u[C+3]&192)>>>6,J.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+y),/firefox/i.test(c)?y>=6?(m=5,p=new Array(4),_=y-3):(m=2,p=new Array(2),_=y):c.indexOf("android")!==-1?(m=2,p=new Array(2),_=y):(m=5,p=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&y>=6?_=y-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(y>=6&&x===1||/vivaldi/i.test(c))||!v&&x===1)&&(m=2,p=new Array(2)),_=y)),p[0]=m<<3,p[0]|=(y&14)>>1,p[1]|=(y&1)<<7,p[1]|=x<<3,m===5&&(p[1]|=(_&14)>>1,p[2]=(_&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[y],channelCount:x,codec:"mp4a.40."+m,manifestCodec:h}}function H(l,u){return l[u]===255&&(l[u+1]&246)===240}function F(l,u){return l[u+1]&1?7:9}function R(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function E(l,u){return u+5=l.length)return!1;var v=R(l,u);if(v<=C)return!1;var m=u+v;return m===l.length||w(l,m)}return!1}function A(l,u,C,v,m){if(!l.samplerate){var _=G(u,C,v,m);if(!_)return;l.config=_.config,l.samplerate=_.samplerate,l.channelCount=_.channelCount,l.codec=_.codec,l.manifestCodec=_.manifestCodec,J.logger.log("parsed codec:"+l.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function S(l){return 1024*9e4/l}function d(l,u,C,v,m){var _=F(l,u),x=R(l,u);if(x-=_,x>0){var p=C+v*m;return{headerLength:_,frameLength:x,stamp:p}}}function o(l,u,C,v,m){var _=S(l.samplerate),x=d(u,C,v,m,_);if(x){var p=x.frameLength,c=x.headerLength,h=x.stamp,a=c+p,y=Math.max(0,C+a-u.length),g;y?(g=new Uint8Array(a-c),g.set(u.subarray(C+c,u.length),0)):g=u.subarray(C+c,C+a);var b={unit:g,pts:h};return y||l.samples.push(b),{sample:b,length:a,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"initPTSFn",function(){return R});var J=O("./src/polyfills/number.ts"),U=O("./src/demux/id3.ts"),k=O("./src/demux/dummy-demuxed-track.ts"),G=O("./src/utils/mp4-tools.ts"),H=O("./src/utils/typed-array.ts"),F=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=E.prototype;return w.resetInitSegment=function(L,A,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(L,A){return!1},w.appendFrame=function(L,A,S){},w.demux=function(L,A){this.cachedData&&(L=Object(G.appendUint8Array)(this.cachedData,L),this.cachedData=null);var S=U.getID3Data(L,0),d=S?S.length:0,o,l,u=this._audioTrack,C=this._id3Track,v=S?U.getTimeStamp(S):void 0,m=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(v,A)),S&&S.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),l=this.initPTS;dF?(this.word<<=F,this.bitsAvailable-=F):(F-=this.bitsAvailable,R=F>>3,F-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=F,this.bitsAvailable-=F)},G.readBits=function(F){var R=Math.min(this.bitsAvailable,F),E=this.word>>>32-R;return F>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=F-R,R>0&&this.bitsAvailable?E<>>F)!==0)return this.word<<=F,this.bitsAvailable-=F,F;return this.loadWord(),F+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var F=this.skipLZ();return this.readBits(F+1)-1},G.readEG=function(){var F=this.readUEG();return 1&F?1+F>>>1:-1*(F>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(F){for(var R=8,E=8,w,M=0;M0?m.subarray(x,x+p):void 0},G=function(m,_){var x=0;return x=(m[_]&127)<<21,x|=(m[_+1]&127)<<14,x|=(m[_+2]&127)<<7,x|=m[_+3]&127,x},H=function(m,_){return J(m,_)&&G(m,_+6)+10<=m.length-_},F=function(m){for(var _=w(m),x=0;x<_.length;x++){var p=_[x];if(R(p))return d(p)}return},R=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var _=String.fromCharCode(m[0],m[1],m[2],m[3]),x=G(m,4),p=10;return{type:_,size:x,data:m.subarray(p,p+x)}},w=function(m){for(var _=0,x=[];J(m,_);){var p=G(m,_+6);_+=10;for(var c=_+p;_+8>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:y=m[N++],b+=String.fromCharCode((a&31)<<6|y&63);break;case 14:y=m[N++],g=m[N++],b+=String.fromCharCode((a&15)<<12|(y&63)<<6|(g&63)<<0);break;default:}}return b},l={decodeTextFrame:A},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/demux/base-audio-demuxer.ts"),U=O("./src/demux/id3.ts"),k=O("./src/utils/logger.ts"),G=O("./src/demux/mpegaudio.ts");function H(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,F(E,w)}function F(E,w){return F=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},F(E,w)}var R=function(E){H(w,E);function w(){return E.apply(this,arguments)||this}var M=w.prototype;return M.resetInitSegment=function(A,S,d){E.prototype.resetInitSegment.call(this,A,S,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:d,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var S=U.getID3Data(A,0)||[],d=S.length,o=A.length;d0},H.demux=function(R){var E=R,w=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(J.appendUint8Array)(this.remainderData,R));var M=Object(J.segmentValidRange)(E);this.remainderData=M.remainder,w.samples=M.valid||new Uint8Array}else w.samples=E;return{audioTrack:Object(U.dummyTrack)(),avcTrack:w,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.flush=function(){var R=Object(U.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:R,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(R,E,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},G}();k.minProbeByteLength=1024,Z.default=k},"./src/demux/mpegaudio.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"appendFrame",function(){return F}),O.d(Z,"parseHeader",function(){return R}),O.d(Z,"isHeaderPattern",function(){return E}),O.d(Z,"isHeader",function(){return w}),O.d(Z,"canParse",function(){return M}),O.d(Z,"probe",function(){return L});var J=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],k=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function F(A,S,d,o,l){if(d+24>S.length)return;var u=R(S,d);if(u&&d+u.frameLength<=S.length){var C=u.samplesPerFrame*9e4/u.sampleRate,v=o+l*C,m={unit:S.subarray(d,d+u.frameLength),pts:v,dts:v};return A.config=[],A.channelCount=u.channelCount,A.samplerate=u.sampleRate,A.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function R(A,S){var d=A[S+1]>>3&3,o=A[S+1]>>1&3,l=A[S+2]>>4&15,u=A[S+2]>>2&3;if(d!==1&&l!==0&&l!==15&&u!==3){var C=A[S+2]>>1&1,v=A[S+3]>>6,m=d===3?3-o:o===3?3:4,_=U[m*14+l-1]*1e3,x=d===3?0:d===2?1:2,p=k[x*3+u],c=v===3?1:2,h=G[d][o],a=H[o],y=h*8*a,g=Math.floor(h*_/p+C)*a;if(J===null){var b=navigator.userAgent||"",N=b.match(/Chrome\/(\d+)/i);J=N?parseInt(N[1]):0}var j=!!J&&J<=87;return j&&o===2&&_>=224e3&&v===0&&(A[S+3]=A[S+3]|128),{sampleRate:p,channelCount:c,frameLength:g,samplesPerFrame:y}}}function E(A,S){return A[S]===255&&(A[S+1]&224)===224&&(A[S+1]&6)!==0}function w(A,S){return S+1=R.length){w();return}if(R[E].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(R,E,w,M),!M)return}},H.getAvcEncryptedData=function(R){for(var E=Math.floor((R.length-48)/160)*16+16,w=new Int8Array(E),M=0,L=32;L<=R.length-16;L+=160,M+=16)w.set(R.subarray(L,L+16),M);return w},H.getAvcDecryptedUnit=function(R,E){for(var w=new Uint8Array(E),M=0,L=32;L<=R.length-16;L+=160,M+=16)R.set(w.subarray(M,M+16),L);return R},H.decryptAvcSample=function(R,E,w,M,L,A){var S=Object(U.discardEPB)(L.data),d=this.getAvcEncryptedData(S),o=this;this.decryptBuffer(d.buffer,function(l){L.data=o.getAvcDecryptedUnit(S,l),A||o.decryptAvcSamples(R,E,w+1,M)})},H.decryptAvcSamples=function(R,E,w,M){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,w=0){if(E>=R.length){M();return}for(var L=R[E].units;!(w>=L.length);w++){var A=L[w];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(R,E,w,M,A,S),!S)return}}},G}();Z.default=k},"./src/demux/transmuxer-interface.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return L});var J=O("./node_modules/webworkify-webpack/index.js"),U=O.n(J),k=O("./src/events.ts"),G=O("./src/demux/transmuxer.ts"),H=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),E=O("./node_modules/eventemitter3/index.js"),w=O.n(E),M=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function A(d,o,l,u){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var v=d.config,m=function(h,a){a=a||{},a.frag=C.frag,a.id=C.id,d.trigger(h,a)};this.observer=new E.EventEmitter,this.observer.on(k.Events.FRAG_DECRYPTED,m),this.observer.on(k.Events.ERROR,m);var _={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var p;try{p=this.worker=J("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(c){d.trigger(k.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},p.postMessage({cmd:"init",typeSupported:_,vendor:x,id:o,config:JSON.stringify(v)})}catch(c){H.logger.warn("Error in worker:",c),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new G.default(this.observer,_,v,x,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,_,v,x,o)}var S=A.prototype;return S.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},S.push=function(o,l,u,C,v,m,_,x,p,c){var h=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,y=this.worker,g=m?m.start:v.start,b=v.decryptdata,N=this.frag,j=!(N&&v.cc===N.cc),K=!(N&&p.level===N.level),V=N?p.sn-N.sn:-1,P=this.part?p.part-this.part.index:1,I=!K&&(V===1||V===0&&P===1),$=self.performance.now();(K||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),m&&(P||!I)&&(m.stats.parsing.start=$);var ne=new G.TransmuxState(j,I,x,K,g);if(!I||j){H.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+` discontinuity: `+j+` trackSwitch: `+K+` contiguous: `+I+` accurateTimeOffset: `+x+` timeOffset: `+g);var de=new G.TransmuxConfig(u,C,l,_,c);this.configureTransmuxer(de)}if(this.frag=v,this.part=m,y)y.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:p,state:ne},o instanceof ArrayBuffer?[o]:[]);else if(a){var me=a.push(o,b,p,ne);Object(G.isPromise)(me)?me.then(function(De){h.handleTransmuxComplete(De)}):this.handleTransmuxComplete(me)}},S.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(u){var v=u.flush(o);Object(G.isPromise)(v)?v.then(function(m){l.handleFlushResult(m,o)}):this.handleFlushResult(v,o)}},S.handleFlushResult=function(o,l){var u=this;o.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(l)},S.onWorkerMessage=function(o){var l=o.data,u=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,u.trigger(l.event,l.data);break}}},S.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},S.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return F});var J=O("./src/demux/transmuxer.ts"),U=O("./src/events.ts"),k=O("./src/utils/logger.ts"),G=O("./node_modules/eventemitter3/index.js"),H=O.n(G);function F(L){var A=new G.EventEmitter,S=function(o,l){L.postMessage({event:o,data:l})};A.on(U.Events.FRAG_DECRYPTED,S),A.on(U.Events.ERROR,S),L.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new J.default(A,o.typeSupported,l,o.vendor,o.id),Object(k.enableLogs)(l.debug),S("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var u=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(J.isPromise)(u)?u.then(function(m){R(L,m)}):R(L,u);break}case"flush":{var C=o.chunkMeta,v=L.transmuxer.flush(C);Object(J.isPromise)(v)?v.then(function(m){w(L,m,C)}):w(L,v,C);break}default:break}})}function R(L,A){if(M(A.remuxResult))return;var S=[],d=A.remuxResult,o=d.audio,l=d.video;o&&E(S,o),l&&E(S,l),L.postMessage({event:"transmuxComplete",data:A},S)}function E(L,A){A.data1&&L.push(A.data1.buffer),A.data2&&L.push(A.data2.buffer)}function w(L,A,S){A.forEach(function(d){R(L,d)}),L.postMessage({event:"flush",data:S})}function M(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"isPromise",function(){return v}),O.d(Z,"TransmuxConfig",function(){return m}),O.d(Z,"TransmuxState",function(){return _});var J=O("./src/events.ts"),U=O("./src/errors.ts"),k=O("./src/crypt/decrypter.ts"),G=O("./src/demux/aacdemuxer.ts"),H=O("./src/demux/mp4demuxer.ts"),F=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),E=O("./src/remux/mp4-remuxer.ts"),w=O("./src/remux/passthrough-remuxer.ts"),M=O("./src/demux/chunk-cache.ts"),L=O("./src/utils/mp4-tools.ts"),A=O("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(x){A.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var d=[{demux:F.default,remux:E.default},{demux:H.default,remux:w.default},{demux:G.default,remux:E.default},{demux:R.default,remux:E.default}],o=1024;d.forEach(function(x){var p=x.demux;o=Math.max(o,p.minProbeByteLength)});var l=function(){function x(c,h,a,y,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new M.default,this.observer=c,this.typeSupported=h,this.config=a,this.vendor=y,this.id=g}var p=x.prototype;return p.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},p.push=function(h,a,y,g){var b=this,N=y.transmuxing;N.executeStart=S();var j=new Uint8Array(h),K=this.cache,V=this.config,P=this.currentTransmuxState,I=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=u(j,a);if($&&$.method==="AES-128"){var ne=this.getDecrypter();if(V.enableSoftwareAES){var de=ne.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!de)return N.executeEnd=S(),C(y);j=new Uint8Array(de)}else return this.decryptionPromise=ne.webCryptoDecrypt(j,$.key.buffer,$.iv.buffer).then(function(be){var we=b.push(be,null,y);return b.decryptionPromise=null,we}),this.decryptionPromise}var me=g||P,De=me.contiguous,xe=me.discontinuity,Le=me.trackSwitch,Te=me.accurateTimeOffset,Se=me.timeOffset,ve=I.audioCodec,z=I.videoCodec,s=I.defaultInitPts,f=I.duration,D=I.initSegmentData;if((xe||Le)&&this.resetInitSegment(D,ve,z,f),xe&&this.resetInitialTimestamp(s),De||this.resetContiguity(),this.needsProbing(j,xe,Le)){if(K.dataLength){var X=K.flush();j=Object(L.appendUint8Array)(X,j)}this.configureTransmuxer(j,I)}var B=this.transmux(j,$,Se,Te,y),se=this.currentTransmuxState;return se.contiguous=!0,se.discontinuity=!1,se.trackSwitch=!1,N.executeEnd=S(),B},p.flush=function(h){var a=this,y=h.transmuxing;y.executeStart=S();var g=this.decrypter,b=this.cache,N=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(h)});var K=[],V=N.timeOffset;if(g){var P=g.flush();P&&K.push(this.push(P,null,h))}var I=b.dataLength;b.reset();var $=this.demuxer,ne=this.remuxer;if(!$||!ne)return I>=o&&this.observer.emit(J.Events.ERROR,J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=S(),[C(h)];var de=$.flush(V);return v(de)?de.then(function(me){return a.flushRemux(K,me,h),K}):(this.flushRemux(K,de,h),K)},p.flushRemux=function(h,a,y){var g=a.audioTrack,b=a.avcTrack,N=a.id3Track,j=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,P=K.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var I=this.remuxer.remux(g,b,N,j,P,V,!0,this.id);h.push({remuxResult:I,chunkMeta:y}),y.transmuxing.executeEnd=S()},p.resetInitialTimestamp=function(h){var a=this.demuxer,y=this.remuxer;if(!a||!y)return;a.resetTimeStamp(h),y.resetTimeStamp(h)},p.resetContiguity=function(){var h=this.demuxer,a=this.remuxer;if(!h||!a)return;h.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(h,a,y,g){var b=this.demuxer,N=this.remuxer;if(!b||!N)return;b.resetInitSegment(a,y,g),N.resetInitSegment(h,a,y)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(h,a,y,g,b){var N;return a&&a.method==="SAMPLE-AES"?N=this.transmuxSampleAes(h,a,y,g,b):N=this.transmuxUnencrypted(h,y,g,b),N},p.transmuxUnencrypted=function(h,a,y,g){var b=this.demuxer.demux(h,a,!1,!this.config.progressive),N=b.audioTrack,j=b.avcTrack,K=b.id3Track,V=b.textTrack,P=this.remuxer.remux(N,j,K,V,a,y,!1,this.id);return{remuxResult:P,chunkMeta:g}},p.transmuxSampleAes=function(h,a,y,g,b){var N=this;return this.demuxer.demuxSampleAes(h,a,y).then(function(j){var K=N.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,y,g,!1,N.id);return{remuxResult:K,chunkMeta:b}})},p.configureTransmuxer=function(h,a){for(var y=this.config,g=this.observer,b=this.typeSupported,N=this.vendor,j=a.audioCodec,K=a.defaultInitPts,V=a.duration,P=a.initSegmentData,I=a.videoCodec,$,ne=0,de=d.length;ne0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(c=p),c}var C=function(p){return{remuxResult:{},chunkMeta:p}};function v(x){return"then"in x&&x.then instanceof Function}var m=function(p,c,h,a,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=c,this.initSegmentData=h,this.duration=a,this.defaultInitPts=y},_=function(p,c,h,a,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=c,this.accurateTimeOffset=h,this.trackSwitch=a,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"discardEPB",function(){return C});var J=O("./src/demux/adts.ts"),U=O("./src/demux/mpegaudio.ts"),k=O("./src/demux/exp-golomb.ts"),G=O("./src/demux/id3.ts"),H=O("./src/demux/sample-aes.ts"),F=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),E=O("./src/utils/logger.ts"),w=O("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},L=function(){function v(_,x,p){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=_,this.config=x,this.typeSupported=p}v.probe=function(x){var p=v.syncOffset(x);return p<0?!1:(p&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},v.syncOffset=function(x){for(var p=Math.min(1e3,x.length-3*188),c=0;c>4,ve=void 0;if(Se>1){if(ve=xe+5+x[xe+4],ve===xe+188)continue}else ve=xe+4;switch(Te){case N:Le&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(x.subarray(ve,xe+188)),j.size+=xe+188-ve);break;case K:Le&&(P&&(a=o(P))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),P={data:[],size:0}),P&&(P.data.push(x.subarray(ve,xe+188)),P.size+=xe+188-ve);break;case V:Le&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(x.subarray(ve,xe+188)),I.size+=xe+188-ve);break;case 0:Le&&(ve+=x[ve]+1),de=this._pmtId=S(x,ve);break;case de:{Le&&(ve+=x[ve]+1);var z=d(x,ve,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);N=z.avc,N>0&&(y.pid=N),K=z.audio,K>0&&(g.pid=K,g.isAAC=z.isAAC),V=z.id3,V>0&&(b.pid=V),$&&!ne&&(E.logger.log("reparse from beginning"),$=!1,xe=De-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=j,g.pesData=P,b.pesData=I;var s={audioTrack:g,avcTrack:y,id3Track:b,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(s),s},m.flush=function(){var x=this.remainderData;this.remainderData=null;var p;return x?p=this.demux(x,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},m.extractRemainingSamples=function(x){var p=x.audioTrack,c=x.avcTrack,h=x.id3Track,a=c.pesData,y=p.pesData,g=h.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),c.pesData=null):c.pesData=a,y&&(b=o(y))?(p.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),p.pesData=null):(y!=null&&y.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=y),g&&(b=o(g))?(this.parseID3PES(b),h.pesData=null):h.pesData=g},m.demuxSampleAes=function(x,p,c){var h=this.demux(x,c,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,p);return this.decrypt(h,a)},m.decrypt=function(x,p){return new Promise(function(c){var h=x.audioTrack,a=x.avcTrack;h.samples&&h.isAAC?p.decryptAacSamples(h.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){c(x)}):c(x)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){c(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,p){var c=this,h=this._avcTrack,a=this.parseAVCNALu(x.data),y=!1,g=this.avcSample,b,N=!1;x.data=null,g&&a.length&&!h.audFound&&(l(g,h),g=this.avcSample=A(!1,x.pts,x.dts,"")),a.forEach(function(j){switch(j.type){case 1:{b=!0,g||(g=c.avcSample=A(!0,x.pts,x.dts,"")),y&&(g.debug+="NDR "),g.frame=!0;var K=j.data;if(N&&K.length>4){var V=new k.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(g.key=!0)}break}case 5:b=!0,g||(g=c.avcSample=A(!0,x.pts,x.dts,"")),y&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{b=!0,y&&g&&(g.debug+="SEI ");var P=new k.default(C(j.data));P.readUByte();for(var I=0,$=0,ne=!1,de=0;!ne&&P.bytesAvailable>1;){I=0;do de=P.readUByte(),I+=de;while(de===255);$=0;do de=P.readUByte(),$+=de;while(de===255);if(I===4&&P.bytesAvailable!==0){ne=!0;var me=P.readUByte();if(me===181){var De=P.readUShort();if(De===49){var xe=P.readUInt();if(xe===1195456820){var Le=P.readUByte();if(Le===3){for(var Te=P.readUByte(),Se=P.readUByte(),ve=31&Te,z=[Te,Se],s=0;s16){for(var f=[],D=0;D<16;D++)f.push(P.readUByte().toString(16)),(D===3||D===5||D===7||D===9)&&f.push("-");for(var X=$-16,B=new Uint8Array(X),se=0;se=0){var P={data:x.subarray(K,g-h-1),type:V};y.push(P)}else{var I=this.getLastNalUnit();if(I&&(a&&g<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),N=g-h-1,N>0)){var $=new Uint8Array(I.data.byteLength+N);$.set(I.data,0),$.set(x.subarray(0,N),I.data.byteLength),I.data=$,I.state=0}}g=0&&h>=0){var ne={data:x.subarray(K,p),type:V,state:h};y.push(ne)}if(y.length===0){var de=this.getLastNalUnit();if(de){var me=new Uint8Array(de.data.byteLength+x.byteLength);me.set(de.data,0),me.set(x,de.data.byteLength),de.data=me}}return c.naluState=h,y},m.parseAACPES=function(x){var p=0,c=this._audioTrack,h=this.aacOverFlow,a=x.data;if(h){this.aacOverFlow=null;var y=h.sample.unit.byteLength,g=Math.min(h.missing,y),b=y-g;h.sample.unit.set(a.subarray(0,g),b),c.samples.push(h.sample),p=h.missing}var N,j;for(N=p,j=a.length;N1;){var y=new Uint8Array(a[0].length+a[1].length);y.set(a[0]),y.set(a[1],a[0].length),a[0]=y,a.splice(1,1)}_=a[0];var g=(_[0]<<16)+(_[1]<<8)+_[2];if(g===1){if(x=(_[4]<<8)+_[5],x&&x>v.size-6)return null;var b=_[7];b&192&&(c=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,b&64?(h=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,c-h>60*9e4&&(E.logger.warn(Math.round((c-h)/9e4)+"s delta between PTS and DTS, align them"),c=h)):h=c),p=_[8];var N=p+9;if(v.size<=N)return null;v.size-=N;for(var j=new Uint8Array(v.size),K=0,V=a.length;KP){N-=P;continue}else _=_.subarray(N),P-=N,N=0;j.set(_,m),m+=P}return x&&(x-=p+3),{data:j,pts:c,dts:h,len:x}}return null}function l(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var _=m.samples,x=_.length;if(x){var p=_[x-1];v.pts=p.pts,v.dts=p.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&E.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function u(v,m){var _=v.length;if(_>0){if(m.pts>=v[_-1].pts)v.push(m);else for(var x=_-1;x>=0;x--)if(m.ptsc)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,c=this.autoLevelCapping,h;return c===-1&&p&&p.length?h=p.length-1:h=c,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var c=this.audioTrackController;c&&(c.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:A.hlsDefaultConfig},set:function(p){m.defaultConfig=p}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isSupported",function(){return k}),O.d(Z,"changeTypeSupported",function(){return G});var J=O("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function k(){var H=Object(J.getMediaSource)();if(!H)return!1;var F=U(),R=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!F||F.prototype&&typeof F.prototype.appendBuffer=="function"&&typeof F.prototype.remove=="function";return!!R&&!!E}function G(){var H,F=U();return typeof(F==null||((H=F.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return L}),O.d(Z,"LoadError",function(){return S});var J=O("./src/polyfills/number.ts"),U=O("./src/errors.ts");function k(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,E(d,o)}function G(d){var o=typeof Map=="function"?new Map:void 0;return G=function(u){if(u===null||!R(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,C)}function C(){return H(u,arguments,w(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),E(C,u)},G(d)}function H(d,o,l){return F()?H=Reflect.construct:H=function(C,v,m){var _=[null];_.push.apply(_,v);var x=Function.bind.apply(C,_),p=new x;return m&&E(p,m.prototype),p},H.apply(null,arguments)}function F(){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 R(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function E(d,o){return E=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},E(d,o)}function w(d){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},w(d)}var M=Math.pow(2,17),L=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,C){var v=this,m=u.url;if(!m)return Promise.reject(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var _=this.config,x=_.fLoader,p=_.loader;return new Promise(function(c,h){v.loader&&v.loader.destroy();var a=v.loader=u.loader=x?new x(_):new p(_),y=A(u),g={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:M};u.stats=a.stats,a.load(y,g,{onSuccess:function(N,j,K,V){v.resetLoader(u,a),c({frag:u,part:null,payload:N.data,networkDetails:V})},onError:function(N,j,K){v.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:N,networkDetails:K}))},onAbort:function(N,j,K){v.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:K}))},onTimeout:function(N,j,K){v.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:K}))},onProgress:function(N,j,K,V){C&&C({frag:u,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(u,C,v){var m=this;this.abort();var _=this.config,x=_.fLoader,p=_.loader;return new Promise(function(c,h){m.loader&&m.loader.destroy();var a=m.loader=u.loader=x?new x(_):new p(_),y=A(u,C),g={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:M};C.stats=a.stats,a.load(y,g,{onSuccess:function(N,j,K,V){m.resetLoader(u,a),m.updateStatsFromPart(u,C);var P={frag:u,part:C,payload:N.data,networkDetails:V};v(P),c(P)},onError:function(N,j,K){m.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:N,networkDetails:K}))},onAbort:function(N,j,K){u.stats.aborted=C.stats.aborted,m.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:K}))},onTimeout:function(N,j,K){m.resetLoader(u,a),h(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:K}))}})})},o.updateStatsFromPart=function(u,C){var v=u.stats,m=C.stats,_=m.total;if(v.loaded+=m.loaded,_){var x=Math.round(u.duration/C.duration),p=Math.min(Math.round(v.loaded/_),x),c=x-p,h=c*Math.round(v.loaded/p);v.total=v.loaded+h}else v.total=Math.max(v.loaded,v.total);var a=v.loading,y=m.loading;a.start?a.first+=y.first-y.start:(a.start=y.start,a.first=y.first),a.end=y.end},o.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},d}();function A(d,o){o===void 0&&(o=null);var l=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(J.isFiniteNumber)(C)&&Object(J.isFiniteNumber)(v)&&(u.rangeStart=C,u.rangeEnd=v),u}var S=function(d){k(o,d);function o(l){for(var u,C=arguments.length,v=new Array(C>1?C-1:0),m=1;m>8*(15-_)&255;return m},u.setDecryptDataFromLevelKey=function(v,m){var _=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(_=H.LevelKey.fromURI(v.uri),_.method=v.method,_.iv=this.createInitializationVector(m),_.keyFormat="identity"),_},u.setElementaryStreamInfo=function(v,m,_,x,p,c){c===void 0&&(c=!1);var h=this.elementaryStreams,a=h[v];if(!a){h[v]={startPTS:m,endPTS:_,startDTS:x,endDTS:p,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,_),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,p)},u.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[L.AUDIO]=null,v[L.VIDEO]=null,v[L.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(J.isFiniteNumber)(this.programDateTime))return null;var v=Object(J.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(A),d=function(o){R(l,o);function l(u,C,v,m,_){var x;x=o.call(this,v)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new F.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=C,x.index=m;var p=u.enumeratedString("BYTERANGE");return p&&x.setByteRange(p,_),_&&(x.fragOffset=_.fragOffset+_.duration),x}return M(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(A)},"./src/loader/key-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return G});var J=O("./src/events.ts"),U=O("./src/errors.ts"),k=O("./src/utils/logger.ts"),G=function(){function H(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var F=H.prototype;return F._registerListeners=function(){this.hls.on(J.Events.KEY_LOADING,this.onKeyLoading,this)},F._unregisterListeners=function(){this.hls.off(J.Events.KEY_LOADING,this.onKeyLoading)},F.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var w=this.loaders[E];w&&w.destroy()}this.loaders={}},F.onKeyLoading=function(E,w){var M=w.frag,L=M.type,A=this.loaders[L];if(!M.decryptdata){k.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=M.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(A&&(k.logger.warn("abort previous key loader for type:"+L),A.abort()),!S){k.logger.warn("key uri is falsy");return}var o=d.loader,l=M.loader=this.loaders[L]=new o(d);this.decrypturl=S,this.decryptkey=null;var u={url:S,frag:M,responseType:"arraybuffer"},C={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,C,v)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(J.Events.KEY_LOADED,{frag:M}))},F.loadsuccess=function(E,w,M){var L=M.frag;if(!L.decryptdata){k.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(E.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(J.Events.KEY_LOADED,{frag:L})},F.loaderror=function(E,w){var M=w.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:E})},F.loadtimeout=function(E,w){var M=w.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},H}()},"./src/loader/level-details.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"LevelDetails",function(){return H});var J=O("./src/polyfills/number.ts");function U(F,R){for(var E=0;Ew.endSN||M>0||M===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},k(F,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(J.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var M=this.driftEnd-this.driftStart;return M*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),F}()},"./src/loader/level-key.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"LevelKey",function(){return H});var J=O("./node_modules/url-toolkit/src/url-toolkit.js"),U=O.n(J);function k(F,R){for(var E=0;E2){var h=c.shift()+".";return h+=parseInt(c.shift()).toString(16),h+=("000"+parseInt(c.shift()).toString(16)).substr(-4),h}return p},_.resolve=function(p,c){return U.buildAbsoluteURL(c,p,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(p,c){var h=[],a={},y=!1;M.lastIndex=0;for(var g;(g=M.exec(p))!=null;)if(g[1]){var b=new R.AttrList(g[1]),N={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:_.resolve(g[2],c)},j=b.decimalResolution("RESOLUTION");j&&(N.width=j.width,N.height=j.height),u((b.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=_.convertAVC1ToAVCOTI(N.videoCodec)),h.push(N)}else if(g[3]){var K=new R.AttrList(g[3]);K["DATA-ID"]&&(y=!0,a[K["DATA-ID"]]=K)}return{levels:h,sessionData:y?a:null}},_.parseMasterPlaylistMedia=function(p,c,h,a){a===void 0&&(a=[]);var y,g=[],b=0;for(L.lastIndex=0;(y=L.exec(p))!==null;){var N=new R.AttrList(y[1]);if(N.TYPE===h){var j={attrs:N,bitrate:0,id:b++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:h,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?_.resolve(N.URI,c):""};if(a.length){var K=_.findGroup(a,j.groupId)||a[0];C(j,K,"audioCodec"),C(j,K,"textCodec")}g.push(j)}}return g},_.parseLevelPlaylist=function(p,c,h,a,y){var g=new H.LevelDetails(c),b=g.fragments,N=null,j=0,K=0,V=0,P=0,I=null,$=new G.Fragment(a,c),ne,de,me,De=-1,xe=!1;for(A.lastIndex=0,g.m3u8=p;(ne=A.exec(p))!==null;){xe&&(xe=!1,$=new G.Fragment(a,c),$.start=V,$.sn=j,$.cc=P,$.level=h,N&&($.initSegment=N,$.rawProgramDateTime=N.rawProgramDateTime));var Le=ne[1];if(Le){$.duration=parseFloat(Le);var Te=(" "+ne[2]).slice(1);$.title=Te||null,$.tagList.push(Te?["INF",Le,Te]:["INF",Le])}else if(ne[3])Object(J.isFiniteNumber)($.duration)&&($.start=V,me&&($.levelkey=me),$.sn=j,$.level=h,$.cc=P,$.urlId=y,b.push($),$.relurl=(" "+ne[3]).slice(1),m($,I),I=$,V+=$.duration,j++,K=0,xe=!0);else if(ne[4]){var Se=(" "+ne[4]).slice(1);I?$.setByteRange(Se,I):$.setByteRange(Se)}else if(ne[5])$.rawProgramDateTime=(" "+ne[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),De===-1&&(De=b.length);else{if(ne=ne[0].match(S),!ne){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(de=1;de-1){E.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;we&&(me=F.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(me.method=we,me.keyFormat=Fe,Pe&&(me.keyID=Pe),Re&&(me.keyFormatVersions=Re),me.iv=_e));break}case"START":{var ze=new R.AttrList(z),We=ze.decimalFloatingPoint("TIME-OFFSET");Object(J.isFiniteNumber)(We)&&(g.startTimeOffset=We);break}case"MAP":{var nt=new R.AttrList(z);$.relurl=nt.URI,nt.BYTERANGE&&$.setByteRange(nt.BYTERANGE),$.level=h,$.sn="initSegment",me&&($.levelkey=me),$.initSegment=null,N=$,xe=!0;break}case"SERVER-CONTROL":{var Ke=new R.AttrList(z);g.canBlockReload=Ke.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Ke.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Ke.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Ke.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Ke.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new R.AttrList(z);g.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=g.partList;ke||(ke=g.partList=[]);var Ze=K>0?ke[ke.length-1]:void 0,Ve=K++,oe=new G.Part(new R.AttrList(z),$,c,Ve,Ze);ke.push(oe),$.duration+=oe.duration;break}case"PRELOAD-HINT":{var q=new R.AttrList(z);g.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new R.AttrList(z);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ee);break}default:E.logger.warn("line parsed but not handled: "+ne);break}}}I&&!I.relurl?(b.pop(),V-=I.duration,g.partList&&(g.fragmentHint=I)):g.partList&&(m($,I),$.cc=P,g.fragmentHint=$);var ie=b.length,le=b[0],te=b[ie-1];if(V+=g.skippedSegments*g.targetduration,V>0&&ie&&te){g.averagetargetduration=V/ie;var ae=te.sn;g.endSN=ae!=="initSegment"?ae:0,le&&(g.startCC=le.cc,le.initSegment||g.fragments.every(function(he){return he.relurl&&o(he.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,c),$.relurl=te.relurl,$.level=h,$.sn="initSegment",le.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(V+=g.fragmentHint.duration),g.totalduration=V,g.endCC=P,De>0&&v(b,De),g},_}();function u(_,x){["video","audio","text"].forEach(function(p){var c=_.filter(function(a){return Object(w.isCodecType)(a,p)});if(c.length){var h=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[p+"Codec"]=h.length>0?h[0]:c[0],_=_.filter(function(a){return c.indexOf(a)===-1})}}),x.unknownCodecs=_}function C(_,x,p){var c=x[p];c&&(_[p]=c)}function v(_,x){for(var p=_[x],c=x;c--;){var h=_[c];if(!h)return;h.programDateTime=p.programDateTime-h.duration*1e3,p=h}}function m(_,x){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):x!=null&&x.programDateTime&&(_.programDateTime=x.endProgramDateTime),Object(J.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/events.ts"),k=O("./src/errors.ts"),G=O("./src/utils/logger.ts"),H=O("./src/utils/mp4-tools.ts"),F=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),E=O("./src/utils/attr-list.ts");function w(A){var S=A.type;switch(S){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function M(A,S){var d=A.url;return(d===void 0||d.indexOf("data:")===0)&&(d=S.url),d}var L=function(){function A(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var S=A.prototype;return S.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,C=l.loader,v=u||C,m=new v(l);return o.loader=m,this.loaders[o.type]=m,m},S.getInternalLoader=function(o){return this.loaders[o.type]},S.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},S.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},S.onLevelLoading=function(o,l){var u=l.id,C=l.level,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:R.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},S.onAudioTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},S.onSubtitleTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},S.load=function(o){var l,u=this.hls.config,C=this.getInternalLoader(o);if(C){var v=C.context;if(v&&v.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var m,_,x,p;switch(o.type){case R.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,_=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,p=u.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:m=0,_=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,_=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,p=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var h=c.partTarget,a=c.targetduration;h&&a&&(_=Math.min(Math.max(h*3,a*.8)*1e3,_))}}var y={timeout:_,maxRetry:m,retryDelay:x,maxRetryDelay:p,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,y,g)},S.loadsuccess=function(o,l,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,C);return}this.resetInternalLoader(u.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,C):this.handleMasterPlaylist(o,l,u,C)},S.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},S.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},S.handleMasterPlaylist=function(o,l,u,C){var v=this.hls,m=o.data,_=M(o,u),x=F.default.parseMasterPlaylist(m,_),p=x.levels,c=x.sessionData;if(!p.length){this.handleManifestParsingError(o,u,"no level found in manifest",C);return}var h=p.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=p.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),y=F.default.parseMasterPlaylistMedia(m,_,"AUDIO",h),g=F.default.parseMasterPlaylistMedia(m,_,"SUBTITLES",a),b=F.default.parseMasterPlaylistMedia(m,_,"CLOSED-CAPTIONS");if(y.length){var N=y.some(function(j){return!j.url});!N&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:p,audioTracks:y,subtitles:g,captions:b,url:_,stats:l,networkDetails:C,sessionData:c})},S.handleTrackOrLevelPlaylist=function(o,l,u,C){var v=this.hls,m=u.id,_=u.level,x=u.type,p=M(o,u),c=Object(J.isFiniteNumber)(m)?m:0,h=Object(J.isFiniteNumber)(_)?_:c,a=w(u),y=F.default.parseLevelPlaylist(o.data,p,h,a,c);if(!y.fragments.length){v.trigger(U.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(x===R.PlaylistContextType.MANIFEST){var g={attrs:new E.AttrList({}),bitrate:0,details:y,name:"",url:p};v.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:p,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),y.needSidxRanges){var b,N=(b=y.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:N,isSidxRequest:!0,type:x,level:_,levelDetails:y,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=y,this.handlePlaylistLoaded(o,l,u,C)},S.handleSidxRequest=function(o,l){var u=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var C=u.references,v=l.levelDetails;C.forEach(function(m,_){var x=m.info,p=v.fragments[_];p.byteRange.length===0&&p.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),p.initSegment&&p.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(o,l,u,C){this.hls.trigger(U.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:C})},S.handleNetworkError=function(o,l,u,C){u===void 0&&(u=!1),G.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=k.ErrorDetails.UNKNOWN,m=!1,_=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:v=u?k.ErrorDetails.MANIFEST_LOAD_TIMEOUT:k.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case R.PlaylistContextType.LEVEL:v=u?k.ErrorDetails.LEVEL_LOAD_TIMEOUT:k.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.AUDIO_TRACK:v=u?k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:v=u?k.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:k.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}_&&this.resetInternalLoader(o.type);var x={type:k.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:o.url,loader:_,context:o,networkDetails:l};C&&(x.response=C),this.hls.trigger(U.Events.ERROR,x)},S.handlePlaylistLoaded=function(o,l,u,C){var v=u.type,m=u.level,_=u.id,x=u.groupId,p=u.loader,c=u.levelDetails,h=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",C);return}if(!p)return;c.live&&(p.getCacheAge&&(c.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(v){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:m||0,id:_||0,stats:l,networkDetails:C,deliveryDirectives:h});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:_||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:h});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:_||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:h});break}},A}();Z.default=L},"./src/polyfills/number.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"isFiniteNumber",function(){return J}),O.d(Z,"MAX_SAFE_INTEGER",function(){return U});var J=Number.isFinite||function(k){return typeof k=="number"&&isFinite(k)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(fe,Z,O){"use strict";O.r(Z);var J=function(){function U(){}return U.getSilentFrame=function(G,H){switch(G){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(H===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(H===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(H===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();Z.default=J},"./src/remux/mp4-generator.ts":function(fe,Z,O){"use strict";O.r(Z);var J=Math.pow(2,32)-1,U=function(){function k(){}return k.init=function(){k.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var H;for(H in k.types)k.types.hasOwnProperty(H)&&(k.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var F=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);k.HDLR_TYPES={video:F,audio:R};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);k.STTS=k.STSC=k.STCO=w,k.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),k.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),k.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),k.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);k.FTYP=k.box(k.types.ftyp,M,A,M,L),k.DINF=k.box(k.types.dinf,k.box(k.types.dref,E))},k.box=function(H){for(var F=8,R=arguments.length,E=new Array(R>1?R-1:0),w=1;w>24&255,A[1]=F>>16&255,A[2]=F>>8&255,A[3]=F&255,A.set(H,4),M=0,F=8;M>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},k.mdia=function(H){return k.box(k.types.mdia,k.mdhd(H.timescale,H.duration),k.hdlr(H.type),k.minf(H))},k.mfhd=function(H){return k.box(k.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},k.minf=function(H){return H.type==="audio"?k.box(k.types.minf,k.box(k.types.smhd,k.SMHD),k.DINF,k.stbl(H)):k.box(k.types.minf,k.box(k.types.vmhd,k.VMHD),k.DINF,k.stbl(H))},k.moof=function(H,F,R){return k.box(k.types.moof,k.mfhd(H),k.traf(R,F))},k.moov=function(H){for(var F=H.length,R=[];F--;)R[F]=k.trak(H[F]);return k.box.apply(null,[k.types.moov,k.mvhd(H[0].timescale,H[0].duration)].concat(R).concat(k.mvex(H)))},k.mvex=function(H){for(var F=H.length,R=[];F--;)R[F]=k.trex(H[F]);return k.box.apply(null,[k.types.mvex].concat(R))},k.mvhd=function(H,F){F*=H;var R=Math.floor(F/(J+1)),E=Math.floor(F%(J+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,R>>24,R>>16&255,R>>8&255,R&255,E>>24,E>>16&255,E>>8&255,E&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 k.box(k.types.mvhd,w)},k.sdtp=function(H){var F=H.samples||[],R=new Uint8Array(4+F.length),E,w;for(E=0;E>>8&255),F.push(M&255),F=F.concat(Array.prototype.slice.call(w));for(E=0;E>>8&255),R.push(M&255),R=R.concat(Array.prototype.slice.call(w));var L=k.box(k.types.avcC,new Uint8Array([1,F[3],F[4],F[5],252|3,224|H.sps.length].concat(F).concat([H.pps.length]).concat(R))),A=H.width,S=H.height,d=H.pixelRatio[0],o=H.pixelRatio[1];return k.box(k.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,A>>8&255,A&255,S>>8&255,S&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]),L,k.box(k.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),k.box(k.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},k.esds=function(H){var F=H.config.length;return new Uint8Array([0,0,0,0,3,23+F,0,1,0,4,15+F,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([F]).concat(H.config).concat([6,1,2]))},k.mp4a=function(H){var F=H.samplerate;return k.box(k.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]),k.box(k.types.esds,k.esds(H)))},k.mp3=function(H){var F=H.samplerate;return k.box(k.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]))},k.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?k.box(k.types.stsd,k.STSD,k.mp3(H)):k.box(k.types.stsd,k.STSD,k.mp4a(H)):k.box(k.types.stsd,k.STSD,k.avc1(H))},k.tkhd=function(H){var F=H.id,R=H.duration*H.timescale,E=H.width,w=H.height,M=Math.floor(R/(J+1)),L=Math.floor(R%(J+1));return k.box(k.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,L>>24,L>>16&255,L>>8&255,L&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,E>>8&255,E&255,0,0,w>>8&255,w&255,0,0]))},k.traf=function(H,F){var R=k.sdtp(H),E=H.id,w=Math.floor(F/(J+1)),M=Math.floor(F%(J+1));return k.box(k.types.traf,k.box(k.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),k.box(k.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,M>>24,M>>16&255,M>>8&255,M&255])),k.trun(H,R.length+16+20+8+16+8+8),R)},k.trak=function(H){return H.duration=H.duration||4294967295,k.box(k.types.trak,k.tkhd(H),k.mdia(H))},k.trex=function(H){var F=H.id;return k.box(k.types.trex,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},k.trun=function(H,F){var R=H.samples||[],E=R.length,w=12+16*E,M=new Uint8Array(w),L,A,S,d,o,l;for(F+=8+w,M.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255],0),L=0;L>>24&255,S>>>16&255,S>>>8&255,S&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return k.box(k.types.trun,M)},k.initSegment=function(H){k.types||k.init();var F=k.moov(H),R=new Uint8Array(k.FTYP.byteLength+F.byteLength);return R.set(k.FTYP),R.set(F,k.FTYP.byteLength),R},k}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,Z.default=U},"./src/remux/mp4-remuxer.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return l}),O.d(Z,"normalizePts",function(){return u});var J=O("./src/polyfills/number.ts"),U=O("./src/remux/aac-helper.ts"),k=O("./src/remux/mp4-generator.ts"),G=O("./src/events.ts"),H=O("./src/errors.ts"),F=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),E=O("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(_){for(var x=1;x0?y:g.pts},c[0].pts);return h&&F.logger.debug("PTS rollover detected"),a},x.remux=function(c,h,a,y,g,b,N,j){var K,V,P,I,$,ne,de=g,me=g,De=c.pid>-1,xe=h.pid>-1,Le=h.samples.length,Te=c.samples.length>0,Se=Le>1,ve=(!De||Te)&&(!xe||Se)||this.ISGenerated||N;if(ve){this.ISGenerated||(P=this.generateIS(c,h,g));var z=this.isVideoContiguous,s=-1;if(Se&&(s=C(h.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,s>0){F.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+Le+" video samples due to a missing keyframe");var f=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(s),h.dropped+=s,me+=(h.samples[0].pts-f)/(h.timescale||9e4)}else s===-1&&(F.logger.warn("[mp4-remuxer]: No keyframe found out of "+Le+" video samples"),ne=!1);if(this.ISGenerated){if(Te&&Se){var D=this.getVideoStartPts(h.samples),X=u(c.samples[0].pts,D)-D,B=X/h.inputTimeScale;de+=Math.max(0,B),me+=Math.max(0,-B)}if(Te){if(c.samplerate||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(c,h,g)),V=this.remuxAudio(c,de,this.isAudioContiguous,b,xe||Se||j===R.PlaylistLevelType.AUDIO?me:void 0),Se){var se=V?V.endPTS-V.startPTS:0;h.inputTimeScale||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(c,h,g)),K=this.remuxVideo(h,me,z,se)}}else Se&&(K=this.remuxVideo(h,me,z,0));K&&(K.firstKeyFrame=s,K.independent=s!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,g)),y.samples.length&&(I=this.remuxText(y,g))),{audio:V,video:K,initSegment:P,independent:ne,text:I,id3:$}},x.generateIS=function(c,h,a){var y=c.samples,g=h.samples,b=this.typeSupported,N={},j=!Object(J.isFiniteNumber)(this._initPTS),K="audio/mp4",V,P,I;if(j&&(V=P=Infinity),c.config&&y.length&&(c.timescale=c.samplerate,c.isAAC||(b.mpeg?(K="audio/mpeg",c.codec=""):b.mp3&&(c.codec="mp3")),N.audio={id:"audio",container:K,codec:c.codec,initSegment:!c.isAAC&&b.mpeg?new Uint8Array(0):k.default.initSegment([c]),metadata:{channelCount:c.channelCount}},j&&(I=c.inputTimeScale,V=P=y[0].pts-Math.round(I*a))),h.sps&&h.pps&&g.length&&(h.timescale=h.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:k.default.initSegment([h]),metadata:{width:h.width,height:h.height}},j)){I=h.inputTimeScale;var $=this.getVideoStartPts(g),ne=Math.round(I*a);P=Math.min(P,u(g[0].dts,$)-ne),V=Math.min(V,$-ne)}if(Object.keys(N).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=P),{tracks:N,initPTS:V,timescale:I}},x.remuxVideo=function(c,h,a,y){var g=c.inputTimeScale,b=c.samples,N=[],j=b.length,K=this._initPTS,V=this.nextAvcDts,P=8,I,$,ne,de=Number.POSITIVE_INFINITY,me=Number.NEGATIVE_INFINITY,De=0,xe=!1;if(!a||V===null){var Le=h*g,Te=b[0].pts-u(b[0].dts,b[0].pts);V=Le-Te}for(var Se=0;Seve.pts){var z=9e4*.2;De=Math.max(Math.min(De,ve.pts-ve.dts),-1*z)}ve.dts0?Se-1:Se].dts&&(xe=!0)}xe&&b.sort(function(vt,ot){var it=vt.dts-ot.dts,wt=vt.pts-ot.pts;return it||wt}),$=b[0].dts,ne=b[b.length-1].dts;var s=Math.round((ne-$)/(j-1));if(De<0){if(Des,be=B<-1;if(se||be){se?F.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(B,!0)+" ms ("+B+"dts) hole between fragments detected, filling it"):F.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-B,!0)+" ms ("+B+"dts) overlapping between fragments detected"),$=V;var we=b[0].pts-B;b[0].dts=$,b[0].pts=we,F.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(we,!0)+"/"+Object(E.toMsFromMpegTsClock)($,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(B,!0)+" ms")}}o&&($=Math.max(0,$));for(var Oe=0,_e=0,Re=0;Re0?ke-1:ke].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var ce=Math.floor(ae.maxBufferHole*g),ye=(y?de+y*g:this.nextAudioPts)-Ze.pts;ye>ce?(I=ye-he,I<0&&(I=he),F.logger.log("[mp4-remuxer]: It is approximately "+ye/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=he}else I=he}var Ee=Math.round(Ze.pts-Ze.dts);N.push(new v(Ze.key,I,oe,Ee))}if(N.length&&S&&S<70){var Me=N[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ne+I,this.isVideoContiguous=!0;var He=k.default.moof(c.sequenceNumber++,$,w({},c,{samples:N})),et="video",rt={data1:He,data2:Ke,startPTS:de/g,endPTS:(me+I)/g,startDTS:$/g,endDTS:V/g,type:et,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ke.length,"MDAT length must not be zero"),rt},x.remuxAudio=function(c,h,a,y,g){var b=c.inputTimeScale,N=c.samplerate?c.samplerate:b,j=b/N,K=c.isAAC?L:A,V=K*j,P=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,$=[],ne=c.samples,de=I?0:8,me=this.nextAudioPts||-1,De=h*b;if(this.isAudioContiguous=a=a||ne.length&&me>0&&(y&&Math.abs(De-me)<9e3||Math.abs(u(ne[0].pts-P,De)-me)<20*V),ne.forEach(function(le){le.pts=u(le.pts-P,De)}),!a||me<0){if(ne=ne.filter(function(le){return le.pts>=0}),!ne.length)return;g===0?me=0:y?me=Math.max(0,De):me=ne[0].pts}if(c.isAAC)for(var xe=g!==void 0,Le=this.config.maxAudioFramesDrift,Te=0,Se=me;Te=Le*V&&f0){_e+=de;try{Oe=new Uint8Array(_e)}catch(le){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!I){var Ke=new DataView(Oe.buffer);Ke.setUint32(0,_e),Oe.set(k.default.types.mdat,4)}}else return;Oe.set(ze,de);var Qe=ze.byteLength;de+=Qe,$.push(new v(!0,K,Qe,0)),we=We}var ke=$.length;if(!ke)return;var Ze=$[$.length-1];this.nextAudioPts=me=we+j*Ze.duration;var Ve=I?new Uint8Array(0):k.default.moof(c.sequenceNumber++,be/j,w({},c,{samples:$}));c.samples=[];var oe=be/b,q=me/b,ee="audio",ie={data1:Ve,data2:Oe,startPTS:oe,endPTS:q,startDTS:oe,endDTS:q,type:ee,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ie},x.remuxEmptyAudio=function(c,h,a,y){var g=c.inputTimeScale,b=c.samplerate?c.samplerate:g,N=g/b,j=this.nextAudioPts,K=(j!==null?j:y.startDTS*g)+this._initDTS,V=y.endDTS*g+this._initDTS,P=N*L,I=Math.ceil((V-K)/P),$=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(F.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){F.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ne=[],de=0;de4294967296;)_+=p;return _}function C(_){for(var x=0;x<_.length;x++)if(_[x].key)return x;return-1}var v=function(x,p,c,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=c,this.cts=h,this.flags=new m(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/polyfills/number.ts"),U=O("./src/utils/mp4-tools.ts"),k=O("./src/loader/fragment.ts"),G=O("./src/utils/logger.ts"),H=function(){function E(){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 w=E.prototype;return w.destroy=function(){},w.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(L,A,S){this.audioCodec=A,this.videoCodec=S,this.generateInitSegment(L),this.emitInitSegment=!0},w.generateInitSegment=function(L){var A=this.audioCodec,S=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(L);A||(A=R(d.audio,k.ElementaryStreamTypes.AUDIO)),S||(S=R(d.video,k.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:A+","+S,initSegment:L,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:A,initSegment:L,id:"audio"}:d.video?o.video={container:"video/mp4",codec:S,initSegment:L,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},w.remux=function(L,A,S,d,o){var l=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:d,id3:S,initSegment:void 0};Object(J.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var v=A.samples;if(!v||!v.length)return C;var m={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(v),_=this.initData),!_||!_.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(J.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=F(_,v,u));var x=Object(U.getDuration)(v,_),p=u,c=x+p;Object(U.offsetStartDTS)(_,v,l),x>0?this.lastEndDTS=c:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!_.audio,a=!!_.video,y="";h&&(y+="audio"),a&&(y+="video");var g={data1:v,startPTS:p,startDTS:p,endPTS:c,endDTS:c,type:y,hasAudio:h,hasVideo:a,nb:1,dropped:0};return C.audio=g.type==="audio"?g:void 0,C.video=g.type!=="audio"?g:void 0,C.text=d,C.id3=S,C.initSegment=m,C},E}(),F=function(w,M,L){return Object(U.getStartDTS)(w,M)-L};function R(E,w){var M=E==null?void 0:E.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||w===k.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=H},"./src/task-loop.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"default",function(){return J});var J=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var k=U.prototype;return k.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},k.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},k.onHandlerDestroyed=function(){},k.hasInterval=function(){return!!this._tickInterval},k.hasNextTick=function(){return!!this._tickTimer},k.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},k.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},k.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},k.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},k.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},k.doTick=function(){},U}()},"./src/types/cmcd.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"CMCDVersion",function(){return J}),O.d(Z,"CMCDObjectType",function(){return U}),O.d(Z,"CMCDStreamingFormat",function(){return k}),O.d(Z,"CMCDStreamType",function(){return G});var J=1,U;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(U||(U={}));var k;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(k||(k={}));var G;(function(H){H.VOD="v",H.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"HlsSkip",function(){return k}),O.d(Z,"getSkipValue",function(){return G}),O.d(Z,"HlsUrlParameters",function(){return H}),O.d(Z,"Level",function(){return F});function J(R,E){for(var w=0;wNumber.MAX_SAFE_INTEGER?Infinity:E},H.hexadecimalInteger=function(R){if(this[R]){var E=(this[R]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var w=new Uint8Array(E.length/2),M=0;MNumber.MAX_SAFE_INTEGER?Infinity:E},H.decimalFloatingPoint=function(R){return parseFloat(this[R])},H.optionalFloat=function(R,E){var w=this[R];return w?parseFloat(w):E},H.enumeratedString=function(R){return this[R]},H.bool=function(R){return this[R]==="YES"},H.decimalResolution=function(R){var E=J.exec(this[R]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},G.parseAttrList=function(R){var E,w={},M='"';for(U.lastIndex=0;(E=U.exec(R))!==null;){var L=E[2];L.indexOf(M)===0&&L.lastIndexOf(M)===L.length-1&&(L=L.slice(1,-1)),w[E[1]]=L}return w},G}()},"./src/utils/binary-search.ts":function(fe,Z,O){"use strict";O.r(Z);var J={search:function(k,G){for(var H=0,F=k.length-1,R=null,E=null;H<=F;){R=(H+F)/2|0,E=k[R];var w=G(E);if(w>0)H=R+1;else if(w<0)F=R-1;else return E}return null}};Z.default=J},"./src/utils/buffer-helper.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"BufferHelper",function(){return k});var J=O("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},k=function(){function G(){}return G.isBuffered=function(F,R){try{if(F){for(var E=G.getBuffered(F),w=0;w=E.start(w)&&R<=E.end(w))return!0}}catch(M){}return!1},G.bufferInfo=function(F,R,E){try{if(F){var w=G.getBuffered(F),M=[],L;for(L=0;LA&&(w[L-1].end=F[M].end):w.push(F[M])}else w.push(F[M])}else w=F;for(var S=0,d,o=R,l=R,u=0;u=C&&R=a&&J.logger.log(this.time+" ["+a+"] "+y)},p}(),S=function(c){for(var h=[],a=0;aH&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},c.moveCursor=function(a){var y=this.pos+a;if(a>1)for(var g=this.pos+1;g=144&&this.backSpace();var y=k(a);if(this.pos>=H){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var y;for(y=a;y0&&(a?g="["+y.join(" | ")+"]":g=y.join(` `)),g},c.getTextAndFormat=function(){return this.rows},p}(),C=function(){function p(h,a,y){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(y),this.nonDisplayedMemory=new u(y),this.lastOutputScreen=new u(y),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var c=p.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var y=0;y=46,y.italics)y.foreground="white";else{var g=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=b[g]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},p}(),v=function(){function p(h,a,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new A;this.channels=[null,new C(h,a,g),new C(h+1,y,g)],this.cmdHistory=x(),this.logger=g}var c=p.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,y){this.channels[a].setHandler(y)},c.addData=function(a,y){var g,b,N,j=!1;this.logger.time=a;for(var K=0;K ("+S([b,N])+")"),g=this.parseCmd(b,N),g||(g=this.parseMidrow(b,N)),g||(g=this.parsePAC(b,N)),g||(g=this.parseBackgroundAttributes(b,N)),!g&&(j=this.parseChars(b,N),j)){var V=this.currentChannel;if(V&&V>0){var P=this.channels[V];P.insertChars(j)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!j&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+S([b,N])+" orig: "+S([y[K],y[K+1]]))}},c.parseCmd=function(a,y){var g=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&y>=32&&y<=47,N=(a===23||a===31)&&y>=33&&y<=35;if(!(b||N))return!1;if(_(a,y,g))return m(null,null,g),this.logger.log(L.DEBUG,"Repeated command ("+S([a,y])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,K=this.channels[j];return a===20||a===21||a===28||a===29?y===32?K.ccRCL():y===33?K.ccBS():y===34?K.ccAOF():y===35?K.ccAON():y===36?K.ccDER():y===37?K.ccRU(2):y===38?K.ccRU(3):y===39?K.ccRU(4):y===40?K.ccFON():y===41?K.ccRDC():y===42?K.ccTR():y===43?K.ccRTD():y===44?K.ccEDM():y===45?K.ccCR():y===46?K.ccENM():y===47&&K.ccEOC():K.ccTO(y-32),m(a,y,g),this.currentChannel=j,!0},c.parseMidrow=function(a,y){var g=0;if((a===17||a===25)&&y>=32&&y<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[g];return b?(b.ccMIDROW(y),this.logger.log(L.DEBUG,"MIDROW ("+S([a,y])+")"),!0):!1}return!1},c.parsePAC=function(a,y){var g,b=this.cmdHistory,N=(a>=17&&a<=23||a>=25&&a<=31)&&y>=64&&y<=127,j=(a===16||a===24)&&y>=64&&y<=95;if(!(N||j))return!1;if(_(a,y,b))return m(null,null,b),!0;var K=a<=23?1:2;y>=64&&y<=95?g=K===1?F[a]:E[a]:g=K===1?R[a]:w[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(g,y)),m(a,y,b),this.currentChannel=K,!0):!1},c.interpretPAC=function(a,y){var g,b={color:null,italics:!1,indent:null,underline:!1,row:a};return y>95?g=y-96:g=y-64,b.underline=(g&1)===1,g<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((g-16)/2)*4,b},c.parseChars=function(a,y){var g,b=null,N=null;if(a>=25?(g=2,N=a-8):(g=1,N=a),N>=17&&N<=19){var j;N===17?j=y+80:N===18?j=y+112:j=y+144,this.logger.log(L.INFO,"Special char '"+k(j)+"' in channel "+g),b=[j]}else a>=32&&a<=127&&(b=y===0?[a]:[a,y]);if(b){var K=S(b);this.logger.log(L.DEBUG,"Char codes = "+K.join(",")),m(a,y,this.cmdHistory)}return b},c.parseBackgroundAttributes=function(a,y){var g=(a===16||a===24)&&y>=32&&y<=47,b=(a===23||a===31)&&y>=45&&y<=47;if(!(g||b))return!1;var N,j={};a===16||a===24?(N=Math.floor((y-32)/2),j.background=M[N],y%2===1&&(j.background=j.background+"_semi")):y===45?j.background="transparent":(j.foreground="black",y===47&&(j.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(j),m(a,y,this.cmdHistory),!0},c.reset=function(){for(var a=0;a=16?o--:o++;var m=Object(J.fixLineBreaks)(l.trim()),_=Object(U.generateCueId)(E,w,m);(!R||!R.cues||!R.cues.getCueById(_))&&(S=new u(E,w,m),S.id=_,S.line=C+1,S.align="left",S.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(S))}return R&&L.length&&(L.sort(function(x,p){return x.line==="auto"||p.line==="auto"?0:x.line>8&&p.line>8?p.line-x.line:x.line-p.line}),L.forEach(function(x){return Object(k.addCueToTrack)(R,x)})),L}};Z.default=H},"./src/utils/discontinuities.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"findFirstFragWithCC",function(){return G}),O.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),O.d(Z,"findDiscontinuousReferenceFrag",function(){return F}),O.d(Z,"adjustSlidingStart",function(){return E}),O.d(Z,"alignStream",function(){return w}),O.d(Z,"alignPDT",function(){return L}),O.d(Z,"alignFragmentByPDTDelta",function(){return A}),O.d(Z,"alignMediaPlaylistByPDT",function(){return S});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/logger.ts"),k=O("./src/controller/level-helper.ts");function G(d,o){for(var l=null,u=0,C=d.length;ul.startCC||d&&d.cc=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},k}();Z.default=U},"./src/utils/ewma.ts":function(fe,Z,O){"use strict";O.r(Z);var J=function(){function U(G,H,F){H===void 0&&(H=0),F===void 0&&(F=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=H,this.totalWeight_=F}var k=U.prototype;return k.sample=function(H,F){var R=Math.pow(this.alpha_,H);this.estimate_=F*(1-R)+R*this.estimate_,this.totalWeight_+=H},k.getTotalWeight=function(){return this.totalWeight_},k.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},U}();Z.default=J},"./src/utils/fetch-loader.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"fetchSupported",function(){return A});var J=O("./src/polyfills/number.ts"),U=O("./src/loader/load-stats.ts"),k=O("./src/demux/chunk-cache.ts");function G(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,w(u,C)}function H(u){var C=typeof Map=="function"?new Map:void 0;return H=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,_)}function _(){return F(m,arguments,M(this).constructor)}return _.prototype=Object.create(m.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),w(_,m)},H(u)}function F(u,C,v){return R()?F=Reflect.construct:F=function(_,x,p){var c=[null];c.push.apply(c,x);var h=Function.bind.apply(_,c),a=new h;return p&&w(a,p.prototype),a},F.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function E(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function w(u,C){return w=Object.setPrototypeOf||function(m,_){return m.__proto__=_,m},w(u,C)}function M(u){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},M(u)}function L(){return L=Object.assign||function(u){for(var C=1;C=p&&c(_,x,h.flush(),m)):c(_,x,N,m),g()}).catch(function(){return Promise.reject()})};return y()},u}();function d(u,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(L({},u.headers))};return u.rangeEnd&&v.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),v}function o(u,C){return new self.Request(u.url,C)}var l=function(u){G(C,u);function C(v,m,_){var x;return x=u.call(this,v)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=_,x}return C}(H(Error));Z.default=S},"./src/utils/imsc1-ttml-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"IMSC1_CODEC",function(){return E}),O.d(Z,"parseIMSC1",function(){return A});var J=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/vttparser.ts"),k=O("./src/utils/vttcue.ts"),G=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),F=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(p){for(var c=1;c"):J}function H(E){for(var w=arguments.length,M=new Array(w>1?w-1:0),L=1;L>24,C[v+1]=m>>16&255,C[v+2]=m>>8&255,C[v+3]=m&255}function w(C,v){var m=[];if(!v.length)return m;var _,x,p;"data"in C?(_=C.data,x=C.start,p=C.end):(_=C,x=0,p=_.byteLength);for(var c=x;c1?c+h:p;if(a===v[0])if(v.length===1)m.push({data:_,start:c+8,end:y});else{var g=w({data:_,start:c+8,end:y},v.slice(1));g.length&&G.apply(m,g)}c=y}return m}function M(C){var v=w(C,["moov"]),m=v[0],_=m?m.end:null,x=w(C,["sidx"]);if(!x||!x[0])return null;var p=[],c=x[0],h=c.data[0],a=h===0?8:16,y=R(c,a);a+=4;var g=0,b=0;h===0?a+=8:a+=16,a+=2;var N=c.end+b,j=F(c,a);a+=2;for(var K=0;K>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=R(c,V);V+=4,p.push({referenceSize:I,subsegmentDuration:ne,info:{duration:ne/y,start:N,end:N+I-1}}),N+=I,V+=4,a=V}return{earliestPresentationTime:g,timescale:y,version:h,referencesCount:j,references:p,moovEndOffset:_}}function L(C){for(var v=[],m=w(C,["moov","trak"]),_=0;_H)&&(this.startTime=H),this.endTime=F,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},k.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"sendAddTrackEvent",function(){return U}),O.d(Z,"addCueToTrack",function(){return k}),O.d(Z,"clearCurrentCues",function(){return G}),O.d(Z,"removeCuesInRange",function(){return H}),O.d(Z,"getCuesInRange",function(){return R});var J=O("./src/utils/logger.ts");function U(E,w){var M;try{M=new Event("addtrack")}catch(L){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=E,w.dispatchEvent(M)}function k(E,w){var M=E.mode;if(M==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(w.id))try{if(E.addCue(w),!E.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(A){J.logger.debug("[texttrack-utils]: "+A);var L=new self.TextTrackCue(w.startTime,w.endTime,w.text);L.id=w.id,E.addCue(L)}M==="disabled"&&(E.mode=M)}function G(E){var w=E.mode;if(w==="disabled"&&(E.mode="hidden"),E.cues)for(var M=E.cues.length;M--;)E.removeCue(E.cues[M]);w==="disabled"&&(E.mode=w)}function H(E,w,M){var L=E.mode;if(L==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var A=R(E.cues,w,M),S=0;SE[M].endTime)return-1;for(var L=0,A=M;L<=A;){var S=Math.floor((A+L)/2);if(wE[S].startTime&&L-1)for(var S=A,d=E.length;S=w&&o.endTime<=M)L.push(o);else if(o.startTime>M)return L}return L}},"./src/utils/time-ranges.ts":function(fe,Z,O){"use strict";O.r(Z);var J={toString:function(k){for(var G="",H=k.length,F=0;F1?w-1:0),L=1;L100)throw new Error("Position must be between 0 and 100.");p=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",F({},A,{get:function(){return c},set:function(g){var b=H(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");c=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",F({},A,{get:function(){return h},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");h=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",F({},A,{get:function(){return a},set:function(g){var b=H(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),L.displayState=void 0}return R.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"parseTimeStamp",function(){return k}),O.d(Z,"fixLineBreaks",function(){return w}),O.d(Z,"VTTParser",function(){return M});var J=O("./src/utils/vttcue.ts"),U=function(){function L(){}var A=L.prototype;return A.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},L}();function k(L){function A(d,o,l,u){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var S=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?A(S[2],S[3],0,S[4]):A(S[1],S[2],S[3],S[4]):null}var G=function(){function L(){this.values=Object.create(null)}var A=L.prototype;return A.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},A.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},A.has=function(d){return d in this.values},A.alt=function(d,o,l){for(var u=0;u=0&&l<=100)return this.set(d,l),!0}return!1},L}();function H(L,A,S,d){var o=d?L.split(d):[L];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(S);if(u.length!==2)continue;var C=u[0],v=u[1];A(C,v)}}var F=new J.default(0,0,""),R=F.align==="middle"?"middle":"center";function E(L,A,S){var d=L;function o(){var C=k(L);if(C===null)throw new Error("Malformed timestamp: "+d);return L=L.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,v){var m=new G;H(C,function(p,c){var h;switch(p){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===c){m.set(p,S[a].region);break}break;case"vertical":m.alt(p,c,["rl","lr"]);break;case"line":h=c.split(","),m.integer(p,h[0]),m.percent(p,h[0])&&m.set("snapToLines",!1),m.alt(p,h[0],["auto"]),h.length===2&&m.alt("lineAlign",h[1],["start",R,"end"]);break;case"position":h=c.split(","),m.percent(p,h[0]),h.length===2&&m.alt("positionAlign",h[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":m.percent(p,c);break;case"align":m.alt(p,c,["start",R,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var _=m.get("line","auto");_==="auto"&&F.line===-1&&(_=-1),v.line=_,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",R);var x=m.get("position","auto");x==="auto"&&F.position===50&&(x=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=x}function u(){L=L.replace(/^\s+/,"")}if(u(),A.startTime=o(),u(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);L=L.substr(3),u(),A.endTime=o(),u(),l(L,A)}function w(L){return L.replace(//gi,` `)}var M=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=L.prototype;return A.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var x=o.buffer,p=0;for(x=w(x);p")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(C,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var _=C.indexOf("-->")!==-1;if(!C||_&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=` `),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.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(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(fe,Z,O){"use strict";O.r(Z),O.d(Z,"generateCueId",function(){return M}),O.d(Z,"parseWebVTT",function(){return A});var J=O("./src/polyfills/number.ts"),U=O("./src/utils/vttparser.ts"),k=O("./src/demux/id3.ts"),G=O("./src/utils/timescale-conversion.ts"),H=O("./src/remux/mp4-remuxer.ts"),F=/\r\n|\n\r|\n|\r/g,R=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},E=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),C=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(J.isFiniteNumber)(o)||!Object(J.isFiniteNumber)(l)||!Object(J.isFiniteNumber)(u)||!Object(J.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*C,o},w=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function M(S,d,o){return w(S.toString())+w(d.toString())+w(o)}var L=function(d,o,l){var u=d[o],C=d[u.prevCC];if(!C||!C.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;d.ccOffset+=u.start-C.start,u.new=!1,u=C,C=d[u.prevCC]}d.presentationOffset=l};function A(S,d,o,l,u,C,v,m){var _=new U.VTTParser,x=Object(k.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(F,` `).split(` `),p=[],c=Object(G.toMpegTsClockFromTimescale)(d,o),h="00:00.000",a=0,y=0,g,b=!0,N=!1;_.oncue=function(j){var K=l[u],V=l.ccOffset,P=(a-c)/9e4;if(K!=null&&K.new&&(y!==void 0?V=l.ccOffset=K.start:L(l,u,P)),P&&(V=P-l.presentationOffset),N){var I=j.endTime-j.startTime,$=Object(H.normalizePts)((j.startTime+V-y)*9e4,C*9e4)/9e4;j.startTime=$,j.endTime=$+I}var ne=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(ne)),j.id||(j.id=M(j.startTime,j.endTime,ne)),j.endTime>0&&p.push(j)},_.onparsingerror=function(j){g=j},_.onflush=function(){if(g){m(g);return}v(p)},x.forEach(function(j){if(b)if(R(j,"X-TIMESTAMP-MAP=")){b=!1,N=!0,j.substr(16).split(",").forEach(function(K){R(K,"LOCAL:")?h=K.substr(6):R(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{y=E(h)/1e3}catch(K){N=!1,g=K}return}else j===""&&(b=!1);_.parse(j+` `)}),_.flush()}},"./src/utils/xhr-loader.ts":function(fe,Z,O){"use strict";O.r(Z);var J=O("./src/utils/logger.ts"),U=O("./src/loader/load-stats.ts"),k=/^age:\s*[\d.]+\s*$/m,G=function(){function H(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var F=H.prototype;return F.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},F.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},F.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},F.load=function(E,w,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=w,this.callbacks=M,this.retryDelay=w.retryDelay,this.loadInternal()},F.loadInternal=function(){var E=this.config,w=this.context;if(!E)return;var M=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var A=this.xhrSetup;try{if(A)try{A(M,w.url)}catch(o){M.open("GET",w.url,!0),A(M,w.url)}M.readyState||M.open("GET",w.url,!0);var S=this.context.headers;if(S)for(var d in S)M.setRequestHeader(d,S[d])}catch(o){this.callbacks.onError({code:M.status,text:o.message},w,M);return}w.rangeEnd&&M.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),M.send()},F.readystatechange=function(){var E=this.context,w=this.loader,M=this.stats;if(!E||!w)return;var L=w.readyState,A=this.config;if(M.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),L===4){w.onreadystatechange=null,w.onprogress=null;var S=w.status;if(S>=200&&S<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var d,o;if(E.responseType==="arraybuffer"?(d=w.response,o=d.byteLength):(d=w.responseText,o=d.length),M.loaded=M.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,E,d,w),!this.callbacks)return;var u={url:w.responseURL,data:d};this.callbacks.onSuccess(u,M,E,w)}else M.retry>=A.maxRetry||S>=400&&S<499?(J.logger.error(S+" while loading "+E.url),this.callbacks.onError({code:S,text:w.statusText},E,w)):(J.logger.warn(S+" while loading "+E.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,A.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},F.loadtimeout=function(){J.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},F.loadprogress=function(E){var w=this.stats;w.loaded=E.loaded,E.lengthComputable&&(w.total=E.total)},F.getCacheAge=function(){var E=null;if(this.loader&&k.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");E=w?parseFloat(w):null}return E},H}();Z.default=G}}).default})},vHTk:function(ht,$e,ue){ht.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ht,$e,ue){"use strict";ue.d($e,"c",function(){return U}),ue.d($e,"b",function(){return k}),ue.d($e,"d",function(){return G}),ue.d($e,"a",function(){return F}),ue.d($e,"e",function(){return R});var fe=ue("9og8"),Z=ue("WmNS"),O=ue.n(Z),J=ue("ErOA");function U(E){return Object(J.c)("libraries/".concat(E,".json"))}function k(){return Object(J.c)("library_tags.json")}function G(E){return H.apply(this,arguments)}function H(){return H=Object(fe.a)(O.a.mark(function E(w){var M;return O.a.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,Object(J.b)("attachments/".concat(w,".json"));case 2:return M=A.sent,A.abrupt("return",M.status===0);case 4:case"end":return A.stop()}},E)})),H.apply(this,arguments)}function F(E){return Object(J.f)("libraries.json",E)}function R(E,w){return Object(J.g)("libraries/".concat(E,".json"),w)}},y5JW:function(ht,$e,ue){"use strict";ue.d($e,"c",function(){return S}),ue.d($e,"a",function(){return d});var fe=ue("DZo9"),Z=ue("8z0m"),O=ue("+L6B"),J=ue("2/Rp"),U=ue("9og8"),k=ue("miYZ"),G=ue("tsqr"),H=ue("k1fw"),F=ue("oBTY"),R=ue("WmNS"),E=ue.n(R),w=ue("q1tI"),M=ue.n(w),L=ue("m3rI"),A=ue("wzkS"),S="\u3000\u3000";function d(o){var l=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,u)).toFixed(1)+" "+l[u]}$e.b=function(o){var l=o.value,u=l===void 0?[]:l,C=o.action,v=o.onChange,m=o.className,_=o.maxSize,x=_===void 0?150:_,p=o.title,c=p===void 0?"\u6587\u4EF6\u4E0A\u4F20":p,h=o.accept,a=h===void 0?null:h,y={multiple:!1,fileList:u,accept:a,withCredentials:!0,beforeUpload:function(N){var j=N.size/1024/1024;return!0},action:"".concat(L.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var j,K,V=Object(F.a)(N.fileList);if(V=V.map(function($){return $.name.indexOf(S)===-1&&($.name="".concat($.name).concat(S).concat(d($.size))),Object(H.a)({},$)}),N.file.status==="done"&&((j=N.file)===null||j===void 0||((K=j.response)===null||K===void 0)?void 0:K.status)===-1){var P,I;G.b.error((P=N.file)===null||P===void 0||((I=P.response)===null||I===void 0)?void 0:I.message),v([]);return}v(V)},onRemove:function(){var b=Object(U.a)(E.a.mark(function j(K){var V,P,I;return E.a.wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:if(V=K.size/1024/1024,!(K.status==="uploading")){ne.next=3;break}return ne.abrupt("return",!0);case 3:if(V0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:u.length>0,ghost:!0},c),M.a.createElement("span",{onClick:g,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",x,"M)"," ")))}}}]);