You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
372 lines
963 KiB
372 lines
963 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[256,5,6,7,17],{"+NIl":function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";ie.defineMode("stex",function(Q,R){"use strict";function Y(L,C){L.cmdState.push(C)}function U(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function _(L){var C=L.cmdState.pop();C&&C.closeBracket()}function j(L){for(var C=L.cmdState,E=C.length-1;E>=0;E--){var h=C[E];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function B(L,C,E){return function(){this.name=L,this.bracketNo=0,this.style=C,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(L,C){L.f=C}function p(L,C){var E;if(L.match(/^\\[a-zA-Z@]+/)){var h=L.current().slice(1);return E=P.hasOwnProperty(h)?P[h]:P.DEFAULT,E=new E,Y(C,E),A(C,M),E.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return A(C,function(l,d){return b(l,d,"\\]")}),"keyword";if(L.match("\\("))return A(C,function(l,d){return b(l,d,"\\)")}),"keyword";if(L.match("$$"))return A(C,function(l,d){return b(l,d,"$$")}),"keyword";if(L.match("$"))return A(C,function(l,d){return b(l,d,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=U(C),E)E.closeBracket(o),A(C,M);else return"error";return"bracket"}else return o=="{"||o=="["?(E=P.DEFAULT,E=new E,Y(C,E),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),E=j(C),E.name=="begin"&&(E.argument=L.current()),E.styleIdentifier())}function b(L,C,E){if(L.eatSpace())return null;if(E&&L.match(E))return A(C,p),"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 h=L.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(L.skipToEnd(),"comment"):"error"}function M(L,C){var E=L.peek(),h;return E=="{"||E=="["?(h=U(C),h.openBracket(E),L.eat(E),A(C,p),"bracket"):/[ \t\r]/.test(E)?(L.eat(E),null):(A(C,p),_(C),p(L,C))}return{startState:function(){var L=R.inMathMode?function(C,E){return b(C,E)}:p;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,C){return C.f(L,C)},blankLine:function(L){L.f=p,L.cmdState.length=0},lineComment:"%"}}),ie.defineMIME("text/x-stex","stex"),ie.defineMIME("text/x-latex","stex")})},"19Vz":function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){ie.defineOption("placeholder","",function(B,P,A){var p=A&&A!=ie.Init;if(P&&!p)B.on("blur",U),B.on("change",_),B.on("swapDoc",_),ie.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Y(B)}),_(B);else if(!P&&p){B.off("blur",U),B.off("change",_),B.off("swapDoc",_),ie.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),Q(B);var b=B.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&U(B)});function Q(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function R(B){Q(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var A=B.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),P.appendChild(A),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function Y(B){setTimeout(function(){var P=!1,A=B.getInputField();A.nodeName=="TEXTAREA"?P=!A.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),P?R(B):Q(B)},20)}function U(B){j(B)&&R(B)}function _(B){var P=B.getWrapperElement(),A=j(B);P.className=P.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?R(B):Q(B)}function j(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";var Q={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ie.defineMode("xml",function(Y,U){var _=Y.indentUnit,j={},B=U.htmlMode?Q:R;for(var P in B)j[P]=B[P];for(var P in U)j[P]=U[P];var A,p;function b(a,S){function x(F){return S.tokenize=F,F(a,S)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?x(C("atom","]]>")):null:a.match("--")?x(C("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),x(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),S.tokenize=C("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",S.tokenize=M,"tag bracket");if(v=="&"){var O;return a.eat("#")?a.eat("x")?O=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):O=a.eatWhile(/[\d]/)&&a.eat(";"):O=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),O?"atom":"error"}else return a.eatWhile(/[^&<]/),null}b.isInText=!0;function M(a,S){var x=a.next();if(x==">"||x=="/"&&a.eat(">"))return S.tokenize=b,A=x==">"?"endTag":"selfcloseTag","tag bracket";if(x=="=")return A="equals",null;if(x=="<"){S.tokenize=b,S.state=d,S.tagName=S.tagStart=null;var v=S.tokenize(a,S);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(x)?(S.tokenize=L(x),S.stringStartCol=a.column(),S.tokenize(a,S)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var S=function(x,v){for(;!x.eol();)if(x.next()==a){v.tokenize=M;break}return"string"};return S.isInAttribute=!0,S}function C(a,S){return function(x,v){for(;!x.eol();){if(x.match(S)){v.tokenize=b;break}x.next()}return a}}function E(a){return function(S,x){for(var v;(v=S.next())!=null;){if(v=="<")return x.tokenize=E(a+1),x.tokenize(S,x);if(v==">")if(a==1){x.tokenize=b;break}else return x.tokenize=E(a-1),x.tokenize(S,x)}return"meta"}}function h(a,S,x){this.prev=a.context,this.tagName=S,this.indent=a.indented,this.startOfLine=x,(j.doNotIndent.hasOwnProperty(S)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,S){for(var x;;){if(!a.context)return;if(x=a.context.tagName,!j.contextGrabbers.hasOwnProperty(x)||!j.contextGrabbers[x].hasOwnProperty(S))return;o(a)}}function d(a,S,x){return a=="openTag"?(x.tagStart=S.column(),w):a=="closeTag"?f:d}function w(a,S,x){return a=="word"?(x.tagName=S.current(),p="tag",T):j.allowMissingTagName&&a=="endTag"?(p="tag bracket",T(a,S,x)):(p="error",w)}function f(a,S,x){if(a=="word"){var v=S.current();return x.context&&x.context.tagName!=v&&j.implicitlyClosed.hasOwnProperty(x.context.tagName)&&o(x),x.context&&x.context.tagName==v||j.matchClosing===!1?(p="tag",y):(p="tag error",D)}else return j.allowMissingTagName&&a=="endTag"?(p="tag bracket",y(a,S,x)):(p="error",D)}function y(a,S,x){return a!="endTag"?(p="error",y):(o(x),d)}function D(a,S,x){return p="error",y(a,S,x)}function T(a,S,x){if(a=="word")return p="attribute",g;if(a=="endTag"||a=="selfcloseTag"){var v=x.tagName,O=x.tagStart;return x.tagName=x.tagStart=null,a=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(v)?l(x,v):(l(x,v),x.context=new h(x,v,O==x.indented)),d}return p="error",T}function g(a,S,x){return a=="equals"?c:(j.allowMissing||(p="error"),T(a,S,x))}function c(a,S,x){return a=="string"?u:a=="word"&&j.allowUnquoted?(p="string",T):(p="error",T(a,S,x))}function u(a,S,x){return a=="string"?u:T(a,S,x)}return{startState:function(a){var S={tokenize:b,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(S.baseIndent=a),S},token:function(a,S){if(!S.tagName&&a.sol()&&(S.indented=a.indentation()),a.eatSpace())return null;A=null;var x=S.tokenize(a,S);return(x||A)&&x!="comment"&&(p=null,S.state=S.state(A||x,a,S),p&&(x=p=="error"?x+" error":p)),x},indent:function(a,S,x){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+_;if(v&&v.noIndent)return ie.Pass;if(a.tokenize!=M&&a.tokenize!=b)return x?x.match(/^(\s*)/)[0].length:0;if(a.tagName)return j.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+_*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(S))return 0;var O=S&&/^<(\/)?([\w_:\.-]*)/.exec(S);if(O&&O[1])for(;v;)if(v.tagName==O[2]){v=v.prev;break}else if(j.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(O)for(;v;){var F=j.contextGrabbers[v.tagName];if(F&&F.hasOwnProperty(O[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+_:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=T)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var S=[],x=a.context;x;x=x.prev)x.tagName&&S.push(x.tagName);return S.reverse()}}}),ie.defineMIME("text/xml","xml"),ie.defineMIME("application/xml","xml"),ie.mimeModes.hasOwnProperty("text/html")||ie.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(ht,qe,se){"use strict";se.d(qe,"a",function(){return l}),se.d(qe,"b",function(){return T});var ie=se("Ty5D"),Q=se("dI71"),R=se("q1tI"),Y=se.n(R),U=se("YS25"),_=se("17x9"),j=se.n(_),B=se("wx14"),P=se("zLVn"),A=se("9R94"),p=function(c){Object(Q.a)(u,c);function u(){for(var S,x=arguments.length,v=new Array(x),O=0;O<x;O++)v[O]=arguments[O];return S=c.call.apply(c,[this].concat(v))||this,S.history=Object(U.a)(S.props),S}var a=u.prototype;return a.render=function(){return Y.a.createElement(ie.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),b=function(c){Object(Q.a)(u,c);function u(){for(var S,x=arguments.length,v=new Array(x),O=0;O<x;O++)v[O]=arguments[O];return S=c.call.apply(c,[this].concat(v))||this,S.history=Object(U.b)(S.props),S}var a=u.prototype;return a.render=function(){return Y.a.createElement(ie.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),M=function(u,a){return typeof u=="function"?u(a):u},L=function(u,a){return typeof u=="string"?Object(U.c)(u,null,null,a):u},C=function(u){return u},E=Y.a.forwardRef;typeof E=="undefined"&&(E=C);function h(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=E(function(c,u){var a=c.innerRef,S=c.navigate,x=c.onClick,v=Object(P.a)(c,["innerRef","navigate","onClick"]),O=v.target,F=Object(B.a)({},v,{onClick:function(V){try{x&&x(V)}catch(I){throw V.preventDefault(),I}!V.defaultPrevented&&V.button===0&&(!O||O==="_self")&&!h(V)&&(V.preventDefault(),S())}});return C!==E?F.ref=u||a:F.ref=a,Y.a.createElement("a",F)}),l=E(function(c,u){var a=c.component,S=a===void 0?o:a,x=c.replace,v=c.to,O=c.innerRef,F=Object(P.a)(c,["component","replace","to","innerRef"]);return Y.a.createElement(ie.e.Consumer,null,function(W){W||Object(A.a)(!1);var V=W.history,I=L(M(v,W.location),W.location),N=I?V.createHref(I):"",X=Object(B.a)({},F,{href:N,navigate:function(){var ae=M(v,W.location),de=x?V.replace:V.push;de(ae)}});return C!==E?X.ref=u||O:X.innerRef=O,Y.a.createElement(S,X)})});if(!1)var d,w;var f=function(u){return u},y=Y.a.forwardRef;typeof y=="undefined"&&(y=f);function D(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(S){return S}).join(" ")}var T=y(function(c,u){var a=c["aria-current"],S=a===void 0?"page":a,x=c.activeClassName,v=x===void 0?"active":x,O=c.activeStyle,F=c.className,W=c.exact,V=c.isActive,I=c.location,N=c.sensitive,X=c.strict,q=c.style,ae=c.to,de=c.innerRef,Ae=Object(P.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(ie.e.Consumer,null,function(be){be||Object(A.a)(!1);var Ce=I||be.location,Te=L(M(ae,Ce),Ce),Se=Te.pathname,pe=Se&&Se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=pe?Object(ie.f)(Ce.pathname,{path:pe,exact:W,sensitive:N,strict:X}):null,te=!!(V?V(ue,Ce):ue),fe=te?D(F,v):F,oe=te?Object(B.a)({},q,{},O):q,Le=Object(B.a)({"aria-current":te&&S||null,className:fe,style:oe,to:Te},Ae);return f!==y?Le.ref=u||de:Le.innerRef=de,Y.a.createElement(l,Le)})});if(!1)var g},"7Cbv":function(ht,qe,se){"use strict";var ie=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Q=new Uint8Array(16);function R(){if(!ie)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ie(Q)}var Y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(M){return typeof M=="string"&&Y.test(M)}for(var _=U,j=[],B=0;B<256;++B)j.push((B+256).toString(16).substr(1));function P(M){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(j[M[L+0]]+j[M[L+1]]+j[M[L+2]]+j[M[L+3]]+"-"+j[M[L+4]]+j[M[L+5]]+"-"+j[M[L+6]]+j[M[L+7]]+"-"+j[M[L+8]]+j[M[L+9]]+"-"+j[M[L+10]]+j[M[L+11]]+j[M[L+12]]+j[M[L+13]]+j[M[L+14]]+j[M[L+15]]).toLowerCase();if(!_(C))throw TypeError("Stringified UUID is invalid");return C}var A=P;function p(M,L,C){M=M||{};var E=M.random||(M.rng||R)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,L){C=C||0;for(var h=0;h<16;++h)L[C+h]=E[h];return L}return A(E)}var b=qe.a=p},"7ahc":function(ht,qe,se){"use strict";se.d(qe,"a",function(){return w});var ie=se("k1fw"),Q=se("0Owb"),R=se("+L6B"),Y=se("2/Rp"),U=se("y8nQ"),_=se("Vl3Y"),j=se("tJVT"),B=se("OaEy"),P=se("2fM7"),A=se("q1tI"),p=se.n(A),b=se("VrN/"),M=se.n(b),L=se("p77/"),C=se.n(L),E=se("c5Ni"),h=se.n(E),o=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};qe.b=function(f){var y=f.callback,D=f.onCancel,T=Object(A.useState)("python"),g=Object(j.a)(T,2),c=g[0],u=g[1];function a(x){u(d[x][1])}function S(x){y(x)}return p.a.createElement(_.a,Object(Q.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:S}),p.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},p.a.createElement(P.a,{onChange:a},Object.keys(d).map(function(x){return p.a.createElement(o,{key:x,value:x},d[x][0])}))),p.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},p.a.createElement(w,{mode:c})),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(Y.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function w(f){var y=f.value,D=f.onChange,T=f.mode,g=f.options,c=g===void 0?{}:g,u=Object(A.useRef)(),a=Object(A.useState)(),S=Object(j.a)(a,2),x=S[0],v=S[1];return Object(A.useEffect)(function(){if(x){function O(F){var W=F.getValue();D&&D(W)}return x.on("change",O),function(){x.off("change",O)}}},[x,D]),Object(A.useEffect)(function(){x&&x.setOption("mode",T)},[x,T]),Object(A.useEffect)(function(){x&&((y!==x.getValue()||y==="")&&setTimeout(function(){x.setValue(y||" ")},300))},[x,y]),Object(A.useEffect)(function(){if(u.current&&!x){var O=M.a.fromTextArea(u.current,Object(ie.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(O)}},[u.current,x]),p.a.createElement("div",{className:"my-codemirror-container"},p.a.createElement("textarea",{ref:u}))}},"8EBN":function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";ie.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Q=0;Q<ie.modeInfo.length;Q++){var R=ie.modeInfo[Q];R.mimes&&(R.mime=R.mimes[0])}ie.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var _=ie.modeInfo[U];if(_.mime==Y)return _;if(_.mimes){for(var j=0;j<_.mimes.length;j++)if(_.mimes[j]==Y)return _}}if(/\+xml$/.test(Y))return ie.findModeByMIME("application/xml");if(/\+json$/.test(Y))return ie.findModeByMIME("application/json")},ie.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var _=ie.modeInfo[U];if(_.ext){for(var j=0;j<_.ext.length;j++)if(_.ext[j]==Y)return _}}},ie.findModeByFileName=function(Y){for(var U=0;U<ie.modeInfo.length;U++){var _=ie.modeInfo[U];if(_.file&&_.file.test(Y))return _}var j=Y.lastIndexOf("."),B=j>-1&&Y.substring(j+1,Y.length);if(B)return ie.findModeByExtension(B)},ie.findModeByName=function(Y){Y=Y.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var _=ie.modeInfo[U];if(_.name.toLowerCase()==Y)return _;if(_.alias){for(var j=0;j<_.alias.length;j++)if(_.alias[j].toLowerCase()==Y)return _}}}})},"8hTe":function(ht,qe,se){ht.exports={button:"button___1wy9m"}},"9Bee":function(ht,qe,se){"use strict";var ie=se("DYRE"),Q=se("zeV3"),R=se("+L6B"),Y=se("2/Rp"),U=se("k1fw"),_=se("9og8"),j=se("tJVT"),B=se("WmNS"),P=se.n(B),A=se("q1tI"),p=se.n(A),b=se("vg9a"),M=se("DlQD"),L=se.n(M),C=se("rUJ1");function E(K,s){var m=K.match(/^(\s+)(?:```)/);if(m===null)return s;var G=m[1];return s.split(`
|
|
`).map(function(Z){var z=Z.match(/^\s+/);if(z===null)return Z;var ve=Object(j.a)(z,1),je=ve[0];return je.length>=G.length?Z.slice(G.length):Z}).join(`
|
|
`)}var h=[],o=["<ul>"],l=new L.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){h.length=0,o=["<ul>"]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(K,s,m,G){if(s>=K.length||K[s].level<=m)return s;var Z=K[s];G.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),s++;var z=[];return s=y(K,s,Z.level,z),z.length>0&&(G.push("<ul>"),z.forEach(function(ve){G.push(ve)}),G.push("</ul>")),G.push("</li>"),s=y(K,s,m,G),s}function D(){return y(h,0,0,o),o.push("</ul>"),o.join("")}var T={heading:function(s){var m=d.exec(s);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(s){var m=this.rules.block.fences.exec(s);if(m){var G=m[0],Z=E(G,m[3]||""),z=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(z)>=0){var ve=u(),je=Z;Z=ve,a[ve]={type:"block",expression:je}}return{type:"code",raw:G,lang:z,text:Z}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function S(){return a}function x(){c=0,a={}}function v(K){return K=K.replace(g,function(s,m){var G=u();return a[G]={type:"inline",expression:m},G}),K}var O=l.listitem;l.listitem=function(K){return O(v(K))};var F=l.paragraph;l.paragraph=function(K){return F(v(K))};var W=l.tablecell;l.tablecell=function(K,s){return W(v(K),s)},l.code=function(K,s,m){var G=(s||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(m?K:Object(C.escape)(K,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(m?K:Object(C.escape)(K,!0))+"</code></pre>"},l.heading=function(K,s,m){var G=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:G,level:s,text:K}),"<h"+s+' id="'+G+'">'+K+"</h"+s+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:T,renderer:l});var V=L.a,I=se("SJMd"),N=se("ulZh"),X=se.n(N),q=se("m3rI"),ae=se("Oy/b"),de=se("p5ED"),Ae=se("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var be=function(K,s){return(be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,G){m.__proto__=G}||function(m,G){for(var Z in G)Object.prototype.hasOwnProperty.call(G,Z)&&(m[Z]=G[Z])})(K,s)};function Ce(K,s){function m(){this.constructor=K}be(K,s),K.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function Te(K,s,m,G){return new(m||(m=Promise))(function(Z,z){function ve(ct){try{Re(G.next(ct))}catch(Ge){z(Ge)}}function je(ct){try{Re(G.throw(ct))}catch(Ge){z(Ge)}}function Re(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof m?Ge:new m(function(Ct){Ct(Ge)})).then(ve,je)}Re((G=G.apply(K,s||[])).next())})}function Se(K,s){var m,G,Z,z,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return z={next:je(0),throw:je(1),return:je(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function je(Re){return function(ct){return function(Ge){if(m)throw new TypeError("Generator is already executing.");for(;ve;)try{if(m=1,G&&(Z=2&Ge[0]?G.return:Ge[0]?G.throw||((Z=G.return)&&Z.call(G),0):G.next)&&!(Z=Z.call(G,Ge[1])).done)return Z;switch(G=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,G=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(K,ve)}catch(Ct){Ge=[6,Ct],G=0}finally{m=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Re,ct])}}}function pe(){for(var K=0,s=0,m=arguments.length;s<m;s++)K+=arguments[s].length;var G=Array(K),Z=0;for(s=0;s<m;s++)for(var z=arguments[s],ve=0,je=z.length;ve<je;ve++,Z++)G[Z]=z[ve];return G}var ue=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(s,m){for(var G=0,Z=m;G<Z.length;G++){var z=Z[G],ve=z[0],je=z[1];s.setAttribute(ve,je)}},K.createRect=function(s,m,G){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",s.toString()),Z.setAttribute("height",m.toString()),G&&K.setAttributes(Z,G),Z},K.createLine=function(s,m,G,Z,z){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",m.toString()),ve.setAttribute("x2",G.toString()),ve.setAttribute("y2",Z.toString()),z&&K.setAttributes(ve,z),ve},K.createPolygon=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",s),m&&K.setAttributes(G,m),G},K.createCircle=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(s/2).toString()),G.setAttribute("cy",(s/2).toString()),G.setAttribute("r",s.toString()),m&&K.setAttributes(G,m),G},K.createEllipse=function(s,m,G){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(s/2).toString()),Z.setAttribute("cy",(m/2).toString()),Z.setAttribute("rx",(s/2).toString()),Z.setAttribute("ry",(m/2).toString()),G&&K.setAttributes(Z,G),Z},K.createGroup=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&K.setAttributes(m,s),m},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(s,m,G,Z,z,ve,je){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Re,[["id",s],["orient",m],["markerWidth",G.toString()],["markerHeight",Z.toString()],["refX",z.toString()],["refY",ve.toString()]]),Re.appendChild(je),Re},K.createText=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),s&&K.setAttributes(m,s),m},K.createTSpan=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=s,m&&K.setAttributes(G,m),G},K.createImage=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&K.setAttributes(m,s),m},K.createPoint=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=s,G.y=m,G},K.createPath=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",s),m&&K.setAttributes(G,m),G},K}(),te=function(){function K(){}return K.addKey=function(s){K.key=s},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),fe=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(s,m,G){var Z=this;return new Promise(function(z){var ve=G!==void 0?G:document.createElement("canvas");s===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var je=document.createElementNS("http://www.w3.org/2000/svg","svg");je.setAttribute("xmlns","http://www.w3.org/2000/svg"),je.setAttribute("width",m.width.baseVal.valueAsString),je.setAttribute("height",m.height.baseVal.valueAsString),je.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),je.innerHTML=m.innerHTML,Z.naturalSize===!0?(je.width.baseVal.value=s.naturalWidth,je.height.baseVal.value=s.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(je.width.baseVal.value=Z.width,je.height.baseVal.value=Z.height),ve.width=je.width.baseVal.value,ve.height=je.height.baseVal.value;var Re=je.outerHTML,ct=ve.getContext("2d");Z.markersOnly!==!0&&ct.drawImage(s,0,0,ve.width,ve.height);var Ge=window.URL,Ct=new Image(ve.width,ve.height);Ct.setAttribute("crossOrigin","anonymous");var Mt=new Blob([Re],{type:"image/svg+xml"}),Wt=Ge.createObjectURL(Mt);Ct.onload=function(){ct.drawImage(Ct,0,0),Ge.revokeObjectURL(Wt);var jr=ve.toDataURL(Z.imageType,Z.imageQuality);z(jr)},Ct.src=Wt})},K}(),oe=function(){},Le=function(){function K(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},K.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new _e("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new _e("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new _e("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ee("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ee("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),_e=function(K,s){this.selector=K,this.style=s},Ee=function(K,s){this.localName=K,this.style=s},Pe=function(){function K(s,m,G,Z,z){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=m,this.markerItems=G,this.uiStyleSettings=Z,this.styles=z,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(s){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",this.uiContainer.appendChild(G),this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(G,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(z){var ve=document.createElement("div");ve.className=""+m.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",z.typeName),ve.innerHTML=z.icon,ve.addEventListener("click",function(){m.markerToolbarButtonClicked(ve,z)}),m.buttons.push(ve),m.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},K.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},K.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.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 m=0;m<this.markerButtons.length;m++)m<s||m===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},K.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},K.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(m){m.className=m.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(s,m,G){var Z=this,z=document.createElement("div");switch(z.className=""+this.toolbarButtonStyleClass.name,z.innerHTML=m,z.setAttribute("data-action",G),z.addEventListener("click",function(){Z.actionToolbarButtonClicked(z,G)}),G){case"select":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":z.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":z.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":z.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(z),this.buttons.push(z)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ee("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ee("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ee("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ee("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Ee("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ee("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new _e("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new _e("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},K.prototype.markerToolbarButtonClicked=function(s,m){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(s,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.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)},K.prototype.setActiveMarkerButton=function(s){var m=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===s});m&&this.setActiveButton(m)},K.prototype.setCurrentMarker=function(s){var m=this;this.currentMarker=s,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){m.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},K}(),Be=function(){function K(s,m,G,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=m,this.uiStyleSettings=G,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ee("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ee("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
padding: `+m+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ee("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;
|
|
`))},K.prototype.show=function(s){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(s){var m,G,Z=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(z){var ve;z.uiStyleSettings=Z.uiStyleSettings;var je=document.createElement("div");je.className=Z.toolboxButtonStyleClass.name+" "+((ve=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Z.toolboxButtonStyleColorsClass.name),je.innerHTML=z.icon,je.title=z.title,je.addEventListener("click",function(){Z.panelButtonClick(z)}),Z.panelButtons.push(je),Z.buttonRow.appendChild(je)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(s){var m=this,G=-1;if(s!==this.activePanel){G=this.panels.indexOf(s),this.panelRow.innerHTML="";var Z=s.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),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(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,ve){var je,Re;z.className=m.toolboxButtonStyleClass.name+" "+(ve===G?""+((je=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&je!==void 0?je:m.toolboxActiveButtonStyleColorsClass.name):""+((Re=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Re!==void 0?Re:m.toolboxButtonStyleColorsClass.name))})},K}(),Ve=function(K,s){this.title=K,this.icon=s},We=function(K){function s(m,G,Z,z){var ve=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=G,ve.currentColor=Z,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var z=m.getColorBox(Z);G.appendChild(z),m.colorBoxes.push(z)}),G},s.prototype.getColorBox=function(m){var G=this,Z=this.uiStyleSettings.toolbarHeight/4,z=this.uiStyleSettings.toolbarHeight-Z,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=z-2+"px",ve.style.height=z-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(z+2)/2+"px",ve.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){G.setCurrentColor(m,ve)});var je=document.createElement("div");return je.style.display="inline-block",je.style.width=z-2+"px",je.style.height=z-2+"px",je.style.backgroundColor=m,je.style.borderRadius=z/2+"px",m==="transparent"&&(je.style.fill=this.uiStyleSettings.toolboxAccentColor,je.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ve.appendChild(je),ve},s.prototype.setCurrentColor=function(m,G){var Z=this;this.currentColor=m,this.colorBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},s}(Ve),Fe=function(){function K(s,m,G){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=m,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(s){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(s,m){},K.prototype.dblClick=function(s,m){},K.prototype.manipulate=function(s){},K.prototype.pointerUp=function(s){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},K.prototype.scale=function(s,m){},K.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},K.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},K.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)}},K.typeName="MarkerBase",K}(),Ue=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.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},K}(),st=function(){function K(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},K}(),ot=function(){function K(){}return K.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},K.toSVGMatrix=function(s,m){return s.a=m.a,s.b=m.b,s.c=m.c,s.d=m.d,s.e=m.e,s.f=m.f,s},K}(),it=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.left=0,z.top=0,z.width=0,z.height=0,z.defaultSize={x:50,y:20},z.offsetX=0,z.offsetY=0,z.rotationAngle=0,z.CB_DISTANCE=10,z._suppressMarkerCreateEvent=!1,z.container.transform.baseVal.appendItem(ue.createTransform()),z.setupControlBox(),z}return Ce(s,K),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(m){this._visual=m;var G=ue.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!!K.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(m);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var z=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=z.x-this.width/2,this.top=z.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(m){var G=this.state;K.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},s.prototype.manipulate=function(m){var G=this.unrotatePoint(m);this.state==="creating"?this.resize(m):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(m)},s.prototype.resize=function(m){var G=this.manipulationStartLeft,Z=this.manipulationStartWidth,z=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+m.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+m.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-z;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+m.y-this.manipulationStartY}Z>=0?(this.left=G,this.width=Z):(this.left=G+Z,this.width=-Z),ve>=0?(this.top=z,this.height=ve):(this.top=z+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var G=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},s.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},s.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var G=this.container.getCTM(),Z=ue.createPoint(m.x,m.y);return{x:(Z=Z.matrixTransform(G)).x,y:Z.y}},s.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var G=this.container.getCTM();G=G.inverse();var Z=ue.createPoint(m.x,m.y);return{x:(Z=Z.matrixTransform(G)).x,y:Z.y}},s.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var m=ue.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=ue.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ue.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ue,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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 m=new st;return m.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,G=-m/2,Z=G,z=(this.width+this.CB_DISTANCE)/2-m/2,ve=(this.height+this.CB_DISTANCE)/2-m/2,je=this.height+this.CB_DISTANCE-m/2,Re=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,G,Z),this.positionGrip(this.controlGrips.topCenter.visual,z,Z),this.positionGrip(this.controlGrips.topRight.visual,Re,Z),this.positionGrip(this.controlGrips.centerLeft.visual,G,ve),this.positionGrip(this.controlGrips.centerRight.visual,Re,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,G,je),this.positionGrip(this.controlGrips.bottomCenter.visual,z,je),this.positionGrip(this.controlGrips.bottomRight.visual,Re,je),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,z,Z-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(m,G,Z){var z=m.transform.baseVal.getItem(0);z.setTranslate(G,Z),m.transform.baseVal.replaceItem(z,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:ot.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ot.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G);var Z=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:Z.x*m,y:Z.y*G});this.left=z.x,this.top=z.y,this.width=this.width*m,this.height=this.height*G,this.adjustControlBox()},s}(Fe),Je=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){K.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){K.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){K.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&ue.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},K.prototype.getState.call(this))},s.prototype.restoreState=function(m){var G=m;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize()},s.title="Rectangle marker",s}(it),rt=function(K){function s(m,G,Z,z){var ve=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=G,ve.currentWidth=Z,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function(Z){var z=document.createElement("div");z.style.display="flex",z.style.flexGrow="2",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=Z===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentWidth(Z,z)}),G.appendChild(z);var ve=document.createElement("div");ve.innerText=Z.toString(),ve.style.marginRight="5px",z.appendChild(ve);var je=document.createElement("div");je.style.minHeight="20px",je.style.flexGrow="2",je.style.display="flex",je.style.alignItems="center";var Re=document.createElement("hr");Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop=Z+"px solid "+m.uiStyleSettings.toolboxColor,Re.style.flexGrow="2",je.appendChild(Re),z.appendChild(je),m.widthBoxes.push(z)}),G},s.prototype.setCurrentWidth=function(m,G){var Z=this;this.currentWidth=m,this.widthBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ve),$e=function(K){function s(m,G,Z,z){var ve=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=G,ve.currentStyle=Z,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function(Z){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/m.styles.length-5+"%",z.style.borderColor=Z===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentStyle(Z,z)}),G.appendChild(z);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var je=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
|
|
</svg>`;ve.innerHTML=je,z.appendChild(ve),m.styleBoxes.push(z)}),G},s.prototype.setCurrentStyle=function(m,G){var Z=this;this.currentStyle=m,this.styleBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ve),Ze=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.strokeColor=Z.defaultColor,z.strokeWidth=Z.defaultStrokeWidth,z.strokeDasharray=Z.defaultStrokeDasharray,z.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new rt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(Je),Oe=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},ut=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.x1=0,z.y1=0,z.x2=0,z.y2=0,z.defaultLength=50,z.manipulationStartX=0,z.manipulationStartY=0,z.manipulationStartX1=0,z.manipulationStartY1=0,z.manipulationStartX2=0,z.manipulationStartY2=0,z.setupControlBox(),z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!!K.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(m){var G=this.state;K.prototype.pointerUp.call(this,m),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(m),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},s.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.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 m=new st;return m.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},s.prototype.positionGrip=function(m,G,Z){var z=m.transform.baseVal.getItem(0);z.setTranslate(G,Z),m.transform.baseVal.replaceItem(z,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.x1=this.x1*m,this.y1=this.y1*G,this.x2=this.x2*m,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},s}(Fe),at=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.strokeColor=Z.defaultColor,z.strokeWidth=Z.defaultStrokeWidth,z.strokeDasharray=Z.defaultStrokeDasharray,z.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new rt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),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()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,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 m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(ut),Ie=function(K){function s(m,G,Z,z){var ve=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=G,ve.currentFont=Z,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function(Z){var z=document.createElement("div");z.style.display="inline-block",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/m.fonts.length-5+"%",z.style.borderColor=Z===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentFont(Z,z)}),G.appendChild(z);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Z,ve.style.overflow="hidden";var je=document.createElement("div");je.style.whiteSpace="nowrap",je.style.overflow="hidden",je.style.textOverflow="ellipsis",je.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(je),z.appendChild(ve),m.fontBoxes.push(z)}),G},s.prototype.setCurrentFont=function(m,G){var Z=this;this.currentFont=m,this.fontBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ve),He=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.color="transparent",z.padding=5,z.DEFAULT_TEXT="your text here",z.text=z.DEFAULT_TEXT,z.isMoved=!1,z.color=Z.defaultColor,z.fontFamily=Z.defaultFontFamily,z.defaultSize={x:100,y:30},z.setColor=z.setColor.bind(z),z.setFont=z.setFont.bind(z),z.renderText=z.renderText.bind(z),z.sizeText=z.sizeText.bind(z),z.textEditDivClicked=z.textEditDivClicked.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.setSize=z.setSize.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return Ce(s,K),s.prototype.ownsTarget=function(m){if(K.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(Z){Z===m&&(G=!0)}),G},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.renderText=function(){var m=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(G){m.textElement.appendChild(ue.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var m=this.textElement.getBBox(),G=1;if(m.width>0&&m.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/m.width,z=(1*this.height-this.height*this.padding*2/100)/m.height;G=Math.min(Z,z)}return G},s.prototype.getTextPosition=function(m){var G=this.textElement.getBBox(),Z=0,z=0;return G.width>0&&G.height>0&&(Z=(this.width-G.width*m)/2,z=this.height/2-G.height*m/2),{x:Z,y:z}},s.prototype.sizeText=function(){var m=this.textElement.getBBox(),G=this.getTextScale(),Z=this.getTextPosition(G);Z.y-=m.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},s.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(m){K.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(m){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,m),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var m=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(G){G.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&G>.9;)G-=.1,m.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var Z=G.clipboardData.getData("text"),z=window.getSelection();if(!z.rangeCount)return!1;z.deleteFromDocument(),z.getRangeAt(0).insertNode(document.createTextNode(Z)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.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 m=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),z={x:Z.width*m,y:Z.height*m};G.x-=z.x/2,G.y-=z.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*m,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},s.prototype.dblClick=function(m,G){K.prototype.dblClick.call(this,m,G),this.showTextEditor()},s.prototype.setColor=function(m){this.textElement&&ue.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},s.prototype.setFont=function(m){this.textElement&&ue.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,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 m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var G=m;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',s}(it),xe=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.color="transparent",z.lineWidth=3,z.drawing=!1,z.pixelRatio=1,z.color=Z.defaultColor,z.lineWidth=Z.defaultStrokeWidth,z.pixelRatio=Z.freehandPixelRatio,z.setColor=z.setColor.bind(z),z.addCanvas=z.addCanvas.bind(z),z.finishCreation=z.finishCreation.bind(z),z.setLineWidth=z.setLineWidth.bind(z),z.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.lineWidthPanel=new rt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),z.lineWidthPanel.onWidthChanged=z.setLineWidth,z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var m=ue.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,G){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(m.x,m.y),this.drawing=!0):K.prototype.pointerDown.call(this,m,G)},s.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){K.prototype.resize.call(this,m),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,m)},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(),K.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=G[0],z=G[1],ve=G[2],je=G[3],Re=!1,ct=0;ct<this.canvasElement.height;ct++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)m.data[ct*this.canvasElement.width*4+4*Ge+3]>0&&(Re=!0,ct<z&&(z=ct),Ge<Z&&(Z=Ge),ct>je&&(je=ct),Ge>ve&&(ve=Ge));if(Re){this.left=Z/this.pixelRatio,this.top=z/this.pixelRatio,this.width=(ve-Z)/this.pixelRatio,this.height=(je-z)/this.pixelRatio;var Ct=document.createElement("canvas");Ct.width=ve-Z,Ct.height=je-z,Ct.getContext("2d").putImageData(this.canvasContext.getImageData(Z,z,ve-Z,je-z),0,0),this.drawingImgUrl=Ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},s.prototype.setLineWidth=function(m){this.lineWidth=m},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 m=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){this.createVisual(),K.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',s}(it),me=function(K){function s(m,G,Z){var z=K.call(this,m,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return z.typeBoxes=[],z.currentType=G,z.setCurrentType=z.setCurrentType.bind(z),z}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var Z=function(je){var Re="both";switch(je){case 0:Re="both";break;case 1:Re="start";break;case 2:Re="end";break;case 3:Re="none"}var ct=document.createElement("div");if(ct.style.display="flex",ct.style.flexGrow="2",ct.style.alignItems="center",ct.style.justifyContent="space-between",ct.style.padding="5px",ct.style.borderWidth="2px",ct.style.borderStyle="solid",ct.style.borderColor=Re===z.currentType?z.uiStyleSettings.toolboxAccentColor:"transparent",ct.addEventListener("click",function(){m.setCurrentType(Re,ct)}),G.appendChild(ct),Re==="both"||Re==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ge.style.marginLeft="5px",ct.appendChild(Ge)}var Ct=document.createElement("div");Ct.style.display="flex",Ct.style.alignItems="center",Ct.style.minHeight="20px",Ct.style.flexGrow="2";var Mt=document.createElement("hr");if(Mt.style.minWidth="20px",Mt.style.border="0px",Mt.style.borderTop="3px solid "+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee"),Mt.style.flexGrow="2",Ct.appendChild(Mt),ct.appendChild(Ct),Re==="both"||Re==="end"){var Wt=document.createElement("div");Wt.style.display="flex",Wt.style.alignItems="center",Wt.style.minHeight="20px",Wt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Wt.style.marginRight="5px",ct.appendChild(Wt)}z.typeBoxes.push(ct)},z=this,ve=0;ve<4;ve++)Z(ve);return G},s.prototype.setCurrentType=function(m,G){var Z=this;this.currentType=m,this.typeBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ve),ye=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.arrowType="end",z.arrowBaseHeight=10,z.arrowBaseWidth=10,z.getArrowPoints=z.getArrowPoints.bind(z),z.setArrowType=z.setArrowType.bind(z),z.arrowTypePanel=new me("Arrow type","end"),z.arrowTypePanel.onArrowTypeChanged=z.setArrowType,z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},s.prototype.getArrowPoints=function(m,G){var Z=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return m-Z/2+","+(G+z/2)+" "+m+","+(G-z/2)+" "+(m+Z/2)+","+(G+z/2)},s.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},s.prototype.setArrowType=function(m){this.arrowType=m,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 m=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(at),re=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.fillColor=Z.defaultFillColor,z.strokeWidth=0,z.fillPanel=new We("Color",Z.defaultColorSet,Z.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(Je),ne=function(K){function s(m,G,Z,z){var ve=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=G,ve.currentOpacity=Z,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ce(s,K),s.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function(Z){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="center",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=Z===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentOpacity(Z,z)}),G.appendChild(z);var ve=document.createElement("div");ve.innerText=100*Z+"%",z.appendChild(ve),m.opacityBoxes.push(z)}),G},s.prototype.setCurrentOpacity=function(m,G){var Z=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===G?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ve),le=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=Z.defaultHighlightColor,z.strokeWidth=0,z.opacity=Z.defaultHighlightOpacity,z.fillPanel=new We("Color",Z.defaultColorSet,z.fillColor),z.fillPanel.onColorChanged=z.setFillColor,z.opacityPanel=new ne("Opacity",Z.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Ce(s,K),s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&ue.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 m=K.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',s}(re),he='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ke=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.bgColor="transparent",z.tipPosition={x:0,y:0},z.tipBase1Position={x:0,y:0},z.tipBase2Position={x:0,y:0},z.tipMoving=!1,z.color=Z.defaultStrokeColor,z.bgColor=Z.defaultFillColor,z.fontFamily=Z.defaultFontFamily,z.defaultSize={x:100,y:30},z.setBgColor=z.setBgColor.bind(z),z.getTipPoints=z.getTipPoints.bind(z),z.positionTip=z.positionTip.bind(z),z.setTipPoints=z.setTipPoints.bind(z),z.colorPanel=new We("Text color",Z.defaultColorSet,z.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),z.colorPanel.onColorChanged=z.setColor,z.bgColorPanel=new We("Fill color",Z.defaultColorSet,z.bgColor,he),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new Ie("Font",Z.defaultFontFamilies,Z.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.tipGrip=new st,z.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),z.controlBox.appendChild(z.tipGrip.visual),z}return Ce(s,K),s.prototype.ownsTarget=function(m){return K.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},s.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(m,G){this.state==="new"&&K.prototype.pointerDown.call(this,m,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,m,G)},s.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,m);else{var G=this.state==="creating";K.prototype.pointerUp.call(this,m),this.setTipPoints(G),this.positionTip()}},s.prototype.manipulate=function(m){if(this.tipMoving){var G=this.unrotatePoint(m);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,m)},s.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",m]]),ue.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},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(m){m===void 0&&(m=!1);var G=Math.min(this.height/2,15),Z=this.height/5;m&&(this.tipPosition={x:G+Z/2,y:this.height+20});var z=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:0},this.tipBase2Position={x:G+Z,y:0}):(this.tipBase1Position={x:0,y:G},this.tipBase2Position={x:0,y:G+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-Z,y:0},this.tipBase2Position={x:this.width-G,y:0}):(this.tipBase1Position={x:this.width,y:G},this.tipBase2Position={x:this.width,y:G+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?z<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-Z,y:this.height},this.tipBase2Position={x:this.width-G,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-G-Z},this.tipBase2Position={x:this.width,y:this.height-G}):z<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:this.height},this.tipBase2Position={x:G+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-G},this.tipBase2Position={x:0,y:this.height-G-Z})},s.prototype.resize=function(m){K.prototype.resize.call(this,m),this.positionTip()},s.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},s.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var G=m;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,K.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*G},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',s}(He),Me=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.strokeColor=Z.defaultColor,z.strokeWidth=Z.defaultStrokeWidth,z.strokeDasharray=Z.defaultStrokeDasharray,z.fillColor=Z.defaultFillColor,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.setOpacity=z.setOpacity.bind(z),z.createVisual=z.createVisual.bind(z),z.strokePanel=new We("Line color",pe(Z.defaultColorSet,["transparent"]),Z.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new We("Fill color",pe(Z.defaultColorSet,["transparent"]),z.fillColor,he),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new rt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.opacityPanel=new ne("Opacity",Z.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){K.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){K.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(m){K.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var G=m;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(it),Ye=function(K){function s(m,G,Z){return K.call(this,m,G,Z)||this}return Ce(s,K),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},s.prototype.createTips=function(){this.tip1=ue.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(at),yt=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.strokePanel.colors=Z.defaultColorSet,z.fillColor="transparent",z}return Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(Me),At=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.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))},K.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.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}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),ze=function(K){function s(m,G,Z){var z=K.call(this,m,G,Z)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.curveX=0,z.curveY=0,z.manipulationStartCurveX=0,z.manipulationStartCurveY=0,z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.positionGrips=z.positionGrips.bind(z),z.addControlGrips=z.addControlGrips.bind(z),z.adjustVisual=z.adjustVisual.bind(z),z.setupControlBox=z.setupControlBox.bind(z),z.resize=z.resize.bind(z),z.strokeColor=Z.defaultColor,z.strokeWidth=Z.defaultStrokeWidth,z.strokeDasharray=Z.defaultStrokeDasharray,z.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new rt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Ce(s,K),s.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},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=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(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()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),K.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),K.prototype.resize.call(this,m),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(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},s.prototype.scale=function(m,G){this.curveX=this.curveX*m,this.curveY=this.curveY*G,K.prototype.scale.call(this,m,G)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',s}(ut),xt=function(){function K(s,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=m}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),mt=function(K){function s(m,G,Z){var z=K.call(this,m,!1)||this;return z.dataUrl=G,z.state=Z,z}return Ce(s,K),s}(xt),nt=function(K){function s(m,G,Z){Z===void 0&&(Z=!1);var z=K.call(this,m,Z)||this;return z.marker=G,z}return Ce(s,K),s}(xt),_t=function(){function K(){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 K.prototype.addEventListener=function(s,m){this[s].push(m)},K.prototype.removeEventListener=function(s,m){var G=this[s].indexOf(m);G>-1&&this[s].splice(G,1)},K}(),kt=function(){function K(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 Oe,this._isOpen=!1,this.undoRedoManager=new At,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 _t,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new Le(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(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ze,xe,ye,He,yt,Me,le,ke,Ye,re,at,ze]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ze,xe,ye,He,Me,le,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ze,xe,ye,He,le]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var m=this;this._availableMarkerTypes.splice(0),s.forEach(function(G){if(typeof G=="string"){var Z=m.ALL_MARKER_TYPES.find(function(z){return z.typeName===G});Z!==void 0&&m._availableMarkerTypes.push(Z)}else m._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&oe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=oe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new xt(s))})},K.prototype.render=function(){return Te(this,void 0,void 0,function(){var s;return Se(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(s=new fe).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 m.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},K.prototype.close=function(s){var m=this;if(s===void 0&&(s=!1),this.isOpen){var G=!1;s||this.eventListeners.beforeclose.forEach(function(Z){var z=new xt(m,!0);Z(z),z.defaultPrevented&&(G=!0)}),G||(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(Z){return Z(new xt(m))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var s,m=[],G=0;G<arguments.length;G++)m[G]=arguments[G];(s=this._availableMarkerTypes).push.apply(s,m)},K.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(m){s(m.dataUrl,m.state)})},K.prototype.removeRenderEventListener=function(s){},K.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},K.prototype.removeCloseEventListener=function(s){},K.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,G=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(m,G)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(s,m){this._isResizing=!0;var G=s/this.imageWidth,Z=m/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(m),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(G,Z),this._isResizing=!1},K.prototype.scaleMarkers=function(s,m){var G,Z=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(s,m):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(z){z!==Z._currentMarker&&z.scale(s,m)}),G!==void 0&&this.setCurrentMarker(G)},K.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},K.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=s.left-m.left,this.top=s.top-m.top},K.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},K.prototype.addDefs=function(){for(var s,m=[],G=0;G<arguments.length;G++)m[G]=arguments[G];this.defs=ue.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,m)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},K.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.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")},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.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 Pe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Be(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},K.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())},K.prototype.toolbarButtonClicked=function(s,m){if(s==="marker"&&m!==void 0)this.createNewMarker(m);else if(s==="action")switch(m){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()}},K.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var z=new nt(s,s._currentMarker,!0);Z(z),z.defaultPrevented&&(m=!0)}),!m){var G=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(Z){return Z(new nt(s,G))})}}},K.prototype.clear=function(){var s=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var je=new nt(s,void 0,!0);ve(je),je.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var G=function(ve){var je=Z.markers[ve];Z.setCurrentMarker(Z.markers[ve]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Re){return Re(new nt(s,je))})},Z=this,z=this.markers.length-1;z>=0;z--)G(z);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.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))},K.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)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===m.width&&G.height===m.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(z){return z(new xt(s))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(z){return z(new xt(s))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var s=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new xt(s))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var s=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new xt(s))}))},K.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},K.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},K.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var s,m,G=this;return Se(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return s=Z.sent(),m=this.getState(),this.eventListeners.render.forEach(function(z){return z(new mt(G,s,m))}),this.close(!0),[2]}})})},K.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return m.markers.push(G.getState())}),m},K.prototype.restoreState=function(s){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(G){var Z=m._availableMarkerTypes.find(function(ve){return ve.typeName===G.typeName});if(Z!==void 0){var z=m.addNewMarker(Z);z.restoreState(G),m.markers.push(z)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(G){return G(new xt(m))})},K.prototype.addNewMarker=function(s){var m=ue.createGroup();return this.markerImage.appendChild(m),new s(m,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(s){var m,G=this;(m=typeof s=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new nt(G,G._currentMarker))}))},K.prototype.markerCreated=function(s){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new nt(m,m._currentMarker))})},K.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},K.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},K.prototype.markerStateChanged=function(s){var m=this;this.eventListeners.markerchange.forEach(function(G){return G(new nt(m,s))})},K.prototype.setCurrentMarker=function(s){var m=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(G){return G(new nt(m,m._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(G){return G(new nt(m,m._currentMarker))}))},K.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(G){return G.ownsTarget(s.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},K.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(G){return G.ownsTarget(s.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},K.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()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(s,m){var G=this.markerImage.getBoundingClientRect();return{x:(s-G.left)/this.zoomLevel,y:(m-G.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.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()},K.prototype.addLicenseKey=function(s){te.addKey(s)},K.prototype.addEventListener=function(s,m){this.eventListeners.addEventListener(s,m)},K.prototype.removeEventListener=function(s,m){this.eventListeners.removeEventListener(s,m)},K.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(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.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(m){return m(new xt(s))}))},K.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new xt(s))}))},K.instanceCounter=0,K}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Kt=function(K,s){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,G){m.__proto__=G}||function(m,G){for(var Z in G)Object.prototype.hasOwnProperty.call(G,Z)&&(m[Z]=G[Z])})(K,s)};function Bt(K,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function m(){this.constructor=K}Kt(K,s),K.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function wt(K,s,m,G){return new(m||(m=Promise))(function(Z,z){function ve(ct){try{Re(G.next(ct))}catch(Ge){z(Ge)}}function je(ct){try{Re(G.throw(ct))}catch(Ge){z(Ge)}}function Re(ct){var Ge;ct.done?Z(ct.value):(Ge=ct.value,Ge instanceof m?Ge:new m(function(Ct){Ct(Ge)})).then(ve,je)}Re((G=G.apply(K,s||[])).next())})}function pr(K,s){var m,G,Z,z,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return z={next:je(0),throw:je(1),return:je(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function je(Re){return function(ct){return function(Ge){if(m)throw new TypeError("Generator is already executing.");for(;ve;)try{if(m=1,G&&(Z=2&Ge[0]?G.return:Ge[0]?G.throw||((Z=G.return)&&Z.call(G),0):G.next)&&!(Z=Z.call(G,Ge[1])).done)return Z;switch(G=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,G=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=Ge;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(Ge);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(K,ve)}catch(Ct){Ge=[6,Ct],G=0}finally{m=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([Re,ct])}}}var or=function(){function K(){}return K.addKey=function(s){K.key=s},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),gt=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(s,m){for(var G=0,Z=m;G<Z.length;G++){var z=Z[G],ve=z[0],je=z[1];s.setAttribute(ve,je)}},K.createRect=function(s,m,G){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",s.toString()),Z.setAttribute("height",m.toString()),G&&K.setAttributes(Z,G),Z},K.createLine=function(s,m,G,Z,z){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",m.toString()),ve.setAttribute("x2",G.toString()),ve.setAttribute("y2",Z.toString()),z&&K.setAttributes(ve,z),ve},K.createPolygon=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",s),m&&K.setAttributes(G,m),G},K.createCircle=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(s/2).toString()),G.setAttribute("cy",(s/2).toString()),G.setAttribute("r",s.toString()),m&&K.setAttributes(G,m),G},K.createEllipse=function(s,m,G){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(s/2).toString()),Z.setAttribute("cy",(m/2).toString()),Z.setAttribute("rx",(s/2).toString()),Z.setAttribute("ry",(m/2).toString()),G&&K.setAttributes(Z,G),Z},K.createGroup=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&K.setAttributes(m,s),m},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(s,m,G,Z,z,ve,je){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Re,[["id",s],["orient",m],["markerWidth",G.toString()],["markerHeight",Z.toString()],["refX",z.toString()],["refY",ve.toString()]]),Re.appendChild(je),Re},K.createText=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),s&&K.setAttributes(m,s),m},K.createTSpan=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=s,m&&K.setAttributes(G,m),G},K.createImage=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&K.setAttributes(m,s),m},K.createPoint=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=s,G.y=m,G},K.createPath=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",s),m&&K.setAttributes(G,m),G},K.createElement=function(s,m){var G=document.createElementNS("http://www.w3.org/2000/svg",s);return m&&K.setAttributes(G,m),G},K.getHollowRectanglePath=function(s,m,G,Z,z,ve,je,Re){return"M"+s+","+m+"V"+(m+Z)+"H"+(s+G)+"V"+m+"H"+z+"V"+ve+"H"+(z+je)+"V"+(ve+Re)+"H"+z+"V"+m+"Z"},K}(),Sr=function(){function K(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},K.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new sr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new sr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new sr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new mr("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new mr("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),sr=function(K,s){this.selector=K,this.style=s},mr=function(K,s){this.localName=K,this.style=s},wr=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},K.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},K.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(m){return s.appendChild(m.getUI())}),s},K}(),si=function(){function K(){}return K.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},K}(),Kr=function(K){function s(){var m=K!==null&&K.apply(this,arguments)||this;return m.buttons=[],m}return Bt(s,K),s.prototype.addButton=function(m){m.className=this.buttonClassName,m.colorsClassName=this.buttonColorsClassName,m.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(m)},s.prototype.getUI=function(){var m=K.prototype.getUI.call(this);return this.buttons.forEach(function(G){return m.appendChild(G.getUI())}),m},s}(si),It=function(){function K(s,m){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=m,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var s=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),ft=function(K){function s(){var m=K!==null&&K.apply(this,arguments)||this;return m.elements=[],m}return Bt(s,K),s.prototype.addElement=function(m){this.elements.push(m)},s.prototype.getUI=function(){var m=K.prototype.getUI.call(this);return this.elements.forEach(function(G){return m.appendChild(G)}),m},s}(si),Ur=function(){function K(s,m){this.horizontal=s,this.vertical=m}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(s){return s/this.ratio},K.prototype.getHorizontalLength=function(s){return s*this.ratio},K}(),li=function(){function K(){}return K.getIcon=function(s,m){if(s>0&&m>0){var G=new Ur(s,m),Z=G.ratio>=1?20:G.getHorizontalLength(20),z=G.ratio<1?20:G.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var je=gt.createDefs();ve.appendChild(je);var Re=gt.createElement("clipPath",[["id","text-bg-clip"]]);je.appendChild(Re);var ct=gt.createPath(gt.getHollowRectanglePath((24-Z)/2,(24-z)/2,Z,z,(24-Z)/2+2,(24-z)/2+2,Z-4,z-4));ve.appendChild(ct);var Ge=gt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(gt.createTSpan(s+":"+m)),ve.appendChild(Ge);var Ct=Ge.getBBox();gt.setAttributes(Ge,[["x",((24-Ct.width)/2).toString()],["y",((24-Ct.height)/2-Ct.y).toString()]]);var Mt=gt.createPath(gt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ct.width))/2,(24-Math.ceil(Ct.height))/2,Math.ceil(Ct.width),Math.ceil(Ct.height)));return Re.appendChild(Mt),gt.setAttributes(ct,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},K}(),Ar=function(K){function s(m,G,Z){var z=K.call(this,m,G)||this;return z.isDropdownOpen=!1,z.onClick=z.dropdownButtonClicked,z.dropdownButtons=Z,z}return Bt(s,K),s.prototype.setupDropdown=function(){var m=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=m.className,G.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(It),Ot=function(){function K(s,m){this.GRIP_SIZE=10,this.color=s,this.fillColor=m,this.visual=gt.createGroup(),this.visual.appendChild(gt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(gt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},K.prototype.setCenter=function(s,m){this.visual.childNodes.forEach(function(G){return gt.setAttributes(G,[["cx",s.toString()],["cy",m.toString()]])})},K}(),Vr=function(){function K(s,m,G,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=m,this.margin=G,this.container=Z,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(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&>.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var s=this;this.cropShadeElement=gt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=gt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;m<this.numberOfGridLines;m++)this.horizontalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(G){return s.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return s.gridContainer.appendChild(G)}),this.cropRectElement=gt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(s){this.cropRect=s;var m=Object.assign({},this.cropRect);this.zoomFactor!==1&&(m.width=this.cropRect.width*this.zoomFactor,m.height=this.cropRect.height*this.zoomFactor,m.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-m.width/2,m.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),gt.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var G=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(z,ve){var je=m.y+G*(ve+1);gt.setAttributes(z,[["x1",""+m.x],["y1",""+je],["x2",""+(m.x+m.width)],["y2",""+je]])});var Z=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(z,ve){var je=m.x+Z*(ve+1);gt.setAttributes(z,[["x1",""+je],["y1",""+m.y],["x2",""+je],["y2",""+(m.y+m.height)]])}),gt.setAttributes(this.cropShadeElement,[["d",gt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.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)},K.prototype.clientToLocalCoordinates=function(s,m){var G=this.container.getBoundingClientRect();return{x:s-G.left+this.margin,y:m-G.top+this.margin}},K.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(m)}s.preventDefault()},K.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},K.prototype.move=function(s){var m=s.x-this.previousPoint.x,G=s.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},K.prototype.resize=function(s){var m=Object.assign({},this.cropRect),G=s.x-this.previousPoint.x,Z=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+G<this.margin&&(G=this.margin-m.x),m.x+=G,m.width=this.cropRect.x+this.cropRect.width-m.x;break;case this.bottomRightGrip:case this.topRightGrip:m.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-m.width),m.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=Z,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=Z}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=s,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=G:this.cropRect.height=Z,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=s-this.cropRect.width/2,this.cropRect.y=m-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)}},K.prototype.getRescaledRect=function(s,m,G,Z,z,ve){var je=G/s,Re=Z/m;return{x:(z.x-ve)*je+ve,y:(z.y-ve)*Re+ve,width:z.width*je,height:z.height*Re}},K.prototype.scaleCanvas=function(s,m){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,m,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=m,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},K}(),ui=function(){function K(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(K.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.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},K.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},K.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},K.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();gt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},K.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var Z=G%5==0?this.height/3:this.height/6;m+="h4v"+-Z+"h1v"+Z}m+="v1H0Z",this.scaleShape=gt.createPath(m);var z=gt.createTransform();this.scaleShape.transform.baseVal.appendItem(z),s.appendChild(this.scaleShape),this.angleLabelElement=gt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=gt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=gt.createTSpan("");return ve.innerHTML="°",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},K}(),gi=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(s,m,G,Z,z,ve,je){var Re=this;return new Promise(function(ct){var Ge=document.createElement("canvas");Ge.width=s.width.baseVal.value-2*Z,Ge.height=s.height.baseVal.value-2*Z;var Ct=1,Mt=1;Re.naturalSize===!0?(Ct=m.naturalWidth/(s.width.baseVal.value-2*Z)/ve,Mt=m.naturalHeight/(s.height.baseVal.value-2*Z)/je,Ge.width=m.naturalWidth/ve,Ge.height=m.naturalHeight/je):Re.width!==void 0&&Re.height!==void 0&&(Ct=Re.width/G.width,Mt=Re.height/G.height,Ge.width*=Ct,Ge.height*=Mt);var Wt=Ge.getContext("2d");Wt.translate(Ge.width/2,Ge.height/2),Wt.rotate(z*Math.PI/180),Wt.scale(ve,je),Wt.translate(-Ge.width/2,-Ge.height/2),Wt.drawImage(m,0,0,Ge.width,Ge.height);var jr=document.createElement("canvas");jr.width=G.width*Ct,jr.height=G.height*Mt,jr.getContext("2d").putImageData(Wt.getImageData((G.x-Z)*Ct,(G.y-Z)*Mt,G.width*Ct,G.height*Mt),0,0),ct(jr.toDataURL(Re.imageType,Re.imageQuality))})},K}(),Xe=function(){function K(s){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=K.instanceCounter++,this.styles=new Sr(this.instanceNo),this.target=s,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),K.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},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},K.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},K.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},K.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},K.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=m+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(m,G)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",gt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},K.prototype.resize=function(s,m){this.imageWidth=Math.round(s),this.imageHeight=Math.round(m),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},K.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var m=s.toDataURL();gt.setAttributes(this.editingTarget,[["href",m]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=s.left-m.left-this.CANVAS_MARGIN,this.top=s.top-m.top-this.CANVAS_MARGIN},K.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=gt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=gt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=gt.createGroup(),this.editingTargetRotationScaleContainer=gt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=gt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var m=gt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(m),this.editingTargetContainer=gt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=gt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Vr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},K.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,m=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=s+"px "+m+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-m+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},K.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,m=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new wr,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 m=new Kr;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var G=[];this.aspectRatios.forEach(function(Mt){var Wt=new It(li.getIcon(Mt.horizontal,Mt.vertical),Mt.horizontal===0&&Mt.vertical===0?"FREE":Mt.horizontal+":"+Mt.vertical);Wt.onClick=function(){return s.ratioButtonClicked(Mt)},G.push(Wt)}),this.aspectRatioButton=new Ar(li.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Z=new It('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Z.isActive=this.isGridVisible,Z.onClick=function(){s.isGridVisible=!s.isGridVisible,Z.isActive=s.isGridVisible},m.addButton(Z);var z=new It('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(z.isActive=this.zoomToCropEnabled,z.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,z.isActive=s.zoomToCropEnabled},m.addButton(z),!or.isLicensed){var ve=new ft;this.topToolbar.addElementBlock(ve);var je=document.createElement("div");je.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Re=document.createElement("a");Re.style.color="currentColor",Re.href="https://markerjs.com/products/cropro",Re.target="_blank",Re.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',je.appendChild(Re),ve.addElement(je)}var ct=new Kr;ct.minWidth=3*this.toolbarHeight+"px",ct.contentAlign="end",this.topToolbar.addButtonBlock(ct);var Ge=new It('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,ct.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ct=new It('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ct.onClick=this.close,ct.addButton(Ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new wr,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 m=new Kr;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var G=new It('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");G.onClick=this.rotateLeftButtonClicked,m.addButton(G);var Z=new It('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Z.onClick=this.rotateRightButtonClicked,m.addButton(Z);var z=new ft;z.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(z),this.straightener=new ui("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(ct){s.rotateBy(ct),s.straightener.angle=s.rotationAngle},z.addElement(this.straightener.getUI());var ve=new Kr;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var je=new It('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");je.onClick=this.flipHorizontallyButtonClicked,ve.addButton(je);var Re=new It('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Re.onClick=this.flipVerticallyButtonClicked,ve.addButton(Re)},K.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(s){if(s){var m=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(s,m){var G=this.cropImage.getBoundingClientRect();return{x:s-G.left,y:m-G.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},K.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},K.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},K.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},K.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},K.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return wt(this,void 0,void 0,function(){var s,m;return pr(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return s=G.sent(),m=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(s,m)}),this.close(!0),[2]}})})},K.prototype.render=function(){return wt(this,void 0,void 0,function(){var s;return pr(this,function(m){switch(m.label){case 0:return(s=new gi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),gt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return m.sent(),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,m.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new mr("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 mr("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new mr("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new mr("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*s)+`px;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new mr("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new mr("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new sr("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new sr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new mr("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 mr("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new mr("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 mr("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new mr("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},K.instanceCounter=0,K}(),St=se("8hTe"),ei=se.n(St),hi=/<pre[^>]*>/g;function di(K){var s=document.createElement("div");return s.innerHTML=K,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Ri=qe.a=function(K){var s=K.value,m=s===void 0?"":s,G=K.edit,Z=G===void 0?!1:G,z=K.className,ve=K.showTextOnly,je=K.showLines,Re=K.replaces,ct=K.zoomImg,Ge=K.hasMask,Ct=K.style,Mt=Ct===void 0?{}:Ct,Wt=K.stylesPrev,jr=Wt===void 0?{}:Wt,Wr=String(m),lr=Object(A.useRef)(),Xr=Object(A.useRef)(),Ki=Object(A.useState)(""),Lr=Object(j.a)(Ki,2),kr=Lr[0],ti=Lr[1],vi=Object(A.useState)("office"),$r=Object(j.a)(vi,2),ri=$r[0],Hr=$r[1],fn=function(){var Ft=new Xe(Xr.current);Ft.displayMode="popup",Ft.addRenderEventListener(function(){var gr=Object(_.a)(P.a.mark(function Ut(vr){var Xt;return P.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:return lr.current.style.display="none",ir.next=3,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:vr}});case 3:Xt=ir.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 5:case"end":return ir.stop()}},Ut)}));return function(Ut){return gr.apply(this,arguments)}}()),Ft.show()},Vi=function(){var Ft=new kt(Xr.current);Ft.settings.displayMode="popup",Ft.addEventListener("render",function(){var gr=Object(_.a)(P.a.mark(function Ut(vr){var Xt;return P.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:if(lr.current.style.display="none",!Xr.current){ir.next=6;break}return ir.next=4,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:vr.dataUrl}});case 4:Xt=ir.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 6:case"end":return ir.stop()}},Ut)}));return function(Ut){return gr.apply(this,arguments)}}()),Ft.show(),window.markerArea=Ft},Mr=Object(A.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ft=/\"\/api\/attachments\/|\"\/attachments\/download\//g,gr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Wr=Wr.replace(qt,"("+q.a.API_SERVER+"/api/attachments/").replace(Ft,'"'+q.a.API_SERVER+"/api/attachments/").replace(gr,'"'+q.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),Wr=Wr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(yi){}var Ut=V(Wr),vr=S();if(Wr.match(/\[TOC\]/)&&(Ut=Ut.replace("<p>[TOC]</p>",D()),w()),Ut=Ut.replace(/(__special_katext_id_\d+__)/g,function(yi,ir){var nr=vr[ir],ii=nr.type,bi=nr.expression;return Object(ae.renderToString)(di(bi)||"",{displayMode:ii==="block",throwOnError:!1,output:"html"})}),Ut=Ut.replace(/▁/g,"\u2581\u2581\u2581"),x(),ve){var Xt=document.createElement("div");return Xt.innerHTML=Ut,Xt.innerText}return setTimeout(function(){return Oi()},500),Ut},[Wr]),Ir=Object(A.useRef)();f.WebkitLineClamp=je,je&&(Mt=Object(U.a)(Object(U.a)({},Mt),f));function _i(qt){var Ft=qt.target;if(Ft.tagName.toUpperCase()==="IMG"){if(ct){var gr=Ft.getAttribute("src");ti(gr),Hr("image")}}else if(Ft.tagName.toUpperCase()==="A"){var Ut=Ft.getAttribute("href");if(Ut.indexOf("office")>-1)qt.preventDefault(),ti(Ut),Hr("office");else if(Ut.indexOf("application/pdf")>-1)qt.preventDefault(),ti(Ut),Hr("pdf");else if(Ut.indexOf("type=text")>-1)qt.preventDefault(),ti(Ut),Hr("html");else if(Ut.startsWith("#")){qt.preventDefault();var vr=document.getElementById(Ut.replace("#",""));vr&&vr.scrollIntoView(!0)}}}var Oi=function(){var Ft,gr=(Ft=Ir.current)===null||Ft===void 0?void 0:Ft.querySelectorAll("video");gr==null||gr.forEach(function(Ut){if(Ut.oncontextmenu=function(){return!1},Ut.src.indexOf(".m3u8")>-1&&!Ut.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var vr=new X.a;vr.loadSource(Ut.src),vr.attachMedia(Ut)}}})};Object(A.useEffect)(function(){if(Ir.current&&Mr&&(Mr.match(hi)&&window.PR.prettyPrint()),Ir.current)return Ir.current.addEventListener("click",_i),function(){Ir.current.removeEventListener("click",_i),x(),w()}},[Mr,Ir.current,_i]);var Pi=function(Ft){if(!Z)return;Ft.target.nodeName==="IMG"?(lr.current.style.display="flex",lr.current.style.width=Ft.target.clientWidth+"px",lr.current.style.height=Ft.target.clientHeight+"px",lr.current.style.top=Ft.target.offsetTop+"px",lr.current.style.left=Ft.target.offsetLeft+"px",Xr.current.src=Ft.target.getAttribute("src")):lr.current.style.display="none"};return p.a.createElement("div",{style:{position:"relative"}},p.a.createElement("div",{ref:Ir,style:Object(U.a)({},Mt),className:"".concat(z||""," markdown-body ").concat(ei.a.mdBody),onMouseOver:Pi,dangerouslySetInnerHTML:{__html:Mr}}),p.a.createElement("div",{ref:lr,className:ei.a.button},p.a.createElement(Q.a,null,p.a.createElement(Y.a,{onClick:function(){return fn()}},"\u88C1\u526A"),p.a.createElement(Y.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),p.a.createElement("img",{ref:Xr,src:"https://ali-cdn.educoder.net/images/avatars/PortalImage/170?t=1659681136",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),p.a.createElement(de.a,{close:!0,data:kr,hasMask:Ge,type:kr!=null&&kr.length?ri:"",style:Object(U.a)({},jr),onClose:function(){return ti("")}}))}},"9VGf":function(ht,qe,se){"use strict";se.d(qe,"a",function(){return R});var ie=se("q1tI"),Q=se.n(ie);function R(Y,U){var _=Object(ie.useRef)();Object(ie.useEffect)(function(){_.current=Y}),Object(ie.useEffect)(function(){function j(){_.current()}if(U!==null){var B=setInterval(j,U);return function(){return clearInterval(B)}}},[U])}},BU3w:function(ht,qe,se){"use strict";se.d(qe,"a",function(){return _});var ie=se("MNnm"),Q="rc-util-key";function R(j){if(j.attachTo)return j.attachTo;var B=document.querySelector("head");return B||document.body}function Y(j){var B,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ie.a)())return null;var A=document.createElement("style");if((B=P.csp)===null||B===void 0?void 0:B.nonce){var p;A.nonce=(p=P.csp)===null||p===void 0?void 0:p.nonce}A.innerHTML=j;var b=R(P),M=b.firstChild;return P.prepend&&b.prepend?b.prepend(A):P.prepend&&M?b.insertBefore(A,M):b.appendChild(A),A}var U=new Map;function _(j,B){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=R(P);if(!U.has(A)){var p=Y("",P),b=p.parentNode;U.set(A,b),b.removeChild(p)}var M=Array.from(U.get(A).children).find(function(o){return o.tagName==="STYLE"&&o[Q]===B});if(M){var L,C;if(((L=P.csp)===null||L===void 0?void 0:L.nonce)&&M.nonce!==((C=P.csp)===null||C===void 0?void 0:C.nonce)){var E;M.nonce=(E=P.csp)===null||E===void 0?void 0:E.nonce}return M.innerHTML!==j&&(M.innerHTML=j),M}var h=Y(j,P);return h[Q]=B,h}},Bd2K:function(ht,qe,se){(function(ie){ie(se("VrN/"),se("osHv"))})(function(ie){ie.defineOption("autoCloseTags",!1,function(P,A,p){if(p!=ie.Init&&p&&P.removeKeyMap("autoCloseTags"),!A)return;var b={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(b["'/'"]=function(M){return _(M)}),(typeof A!="object"||A.whenOpening!==!1)&&(b["'>'"]=function(M){return Y(M)}),P.addKeyMap(b)});var Q=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Y(P){if(P.getOption("disableInput"))return ie.Pass;for(var A=P.listSelections(),p=[],b=P.getOption("autoCloseTags"),M=0;M<A.length;M++){if(!A[M].empty())return ie.Pass;var L=A[M].head,C=P.getTokenAt(L),E=ie.innerMode(P.getMode(),C.state),h=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return ie.Pass;var d=E.mode.configuration=="html",w=typeof b=="object"&&b.dontCloseTags||d&&Q,f=typeof b=="object"&&b.indentTags||d&&R;C.end>L.ch&&(l=l.slice(0,l.length-C.end+L.ch));var y=l.toLowerCase();if(!l||C.type=="string"&&(C.end!=L.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&o.close||C.string.indexOf("/")==L.ch-C.start-1||w&&j(w,y)>-1||B(P,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(h)||[],l,L,!0))return ie.Pass;var D=typeof b=="object"&&b.emptyTags;if(D&&j(D,l)>-1){p[M]={text:"/>",newPos:ie.Pos(L.line,L.ch+2)};continue}var T=f&&j(f,y)>-1;p[M]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+l+">",newPos:T?ie.Pos(L.line+1,0):ie.Pos(L.line,L.ch+1)}}for(var g=typeof b=="object"&&b.dontIndentOnAutoClose,M=A.length-1;M>=0;M--){var c=p[M];P.replaceRange(c.text,A[M].head,A[M].anchor,"+insert");var u=P.listSelections().slice(0);u[M]={head:c.newPos,anchor:c.newPos},P.setSelections(u),!g&&c.indent&&(P.indentLine(c.newPos.line,null,!0),P.indentLine(c.newPos.line+1,null,!0))}}function U(P,A){for(var p=P.listSelections(),b=[],M=A?"/":"</",L=P.getOption("autoCloseTags"),C=typeof L=="object"&&L.dontIndentOnSlash,E=0;E<p.length;E++){if(!p[E].empty())return ie.Pass;var h=p[E].head,o=P.getTokenAt(h),l=ie.innerMode(P.getMode(),o.state),d=l.state;if(A&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return ie.Pass;var w,f=l.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(f&&l.mode.name=="javascript")w=M+"script";else if(f&&l.mode.name=="css")w=M+"style";else{var y=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!y||y.length&&B(P,y,y[y.length-1],h))return ie.Pass;w=M+y[y.length-1]}P.getLine(h.line).charAt(o.end)!=">"&&(w+=">"),b[E]=w}if(P.replaceSelections(b),p=P.listSelections(),!C)for(var E=0;E<p.length;E++)(E==p.length-1||p[E].head.line<p[E+1].head.line)&&P.indentLine(p[E].head.line)}function _(P){return P.getOption("disableInput")?ie.Pass:U(P,!0)}ie.commands.closeTag=function(P){return U(P)};function j(P,A){if(P.indexOf)return P.indexOf(A);for(var p=0,b=P.length;p<b;++p)if(P[p]==A)return p;return-1}function B(P,A,p,b,M){if(!ie.scanForClosingTag)return!1;var L=Math.min(P.lastLine()+1,b.line+500),C=ie.scanForClosingTag(P,b,null,L);if(!C||C.tag!=p)return!1;for(var E=M?1:0,h=A.length-1;h>=0&&A[h]==p;h--)++E;b=C.to;for(var h=1;h<E;h++){var o=ie.scanForClosingTag(P,b,null,L);if(!o||o.tag!=p)return!1;b=o.to}return!0}})},BjJ7:function(ht,qe,se){"use strict";se.d(qe,"d",function(){return Q}),se.d(qe,"c",function(){return R}),se.d(qe,"e",function(){return Y}),se.d(qe,"b",function(){return U}),se.d(qe,"a",function(){return j});var ie=se("m3rI");function Q(B){var P=!0;if(B.length>0){for(var A=0;A<B.length;A++)if(B[A].compile_success==0||!B[A].compile_success){P=!1;break}}else P=!1;return P}function R(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],p=0;p<B.length;p++){var b=B[p],M=P?"".concat(P,"/").concat(b.name):"".concat(b.name);A.push({title:b.name,isLeaf:!(b.type==="tree"),key:M})}return A}function Y(B,P,A){for(var p=0;p<B.length;p++){var b=B[p];if(b.key===P){b.children=A;break}b.children&&Y(b.children,P,A)}return B}function U(B,P,A){var p;return function(){var b=this,M=arguments,L=function(){p=null,A||B.apply(b,M)},C=A&&!p;clearTimeout(p),p=setTimeout(L,P),C&&B.apply(b,M)}}var _=!0,j=ie.a.API_SERVER},"C+DQ":function(ht,qe,se){},D1Df:function(ht,qe,se){"use strict";function ie(v){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ie=function(F){return typeof F}:ie=function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},ie(v)}function Q(){return Q=Object.assign||function(v){for(var O=1;O<arguments.length;O++){var F=arguments[O];for(var W in F)Object.prototype.hasOwnProperty.call(F,W)&&(v[W]=F[W])}return v},Q.apply(this,arguments)}function R(v,O){var F=Object.keys(v);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(v);O&&(W=W.filter(function(V){return Object.getOwnPropertyDescriptor(v,V).enumerable})),F.push.apply(F,W)}return F}function Y(v){for(var O=1;O<arguments.length;O++){var F=arguments[O]!=null?arguments[O]:{};O%2?R(F,!0).forEach(function(W){C(v,W,F[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(F)):R(F).forEach(function(W){Object.defineProperty(v,W,Object.getOwnPropertyDescriptor(F,W))})}return v}function U(v,O){if(v==null)return{};var F=_(v,O),W,V;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(v);for(V=0;V<I.length;V++){if(W=I[V],O.indexOf(W)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(v,W))continue;F[W]=v[W]}}return F}function _(v,O){if(v==null)return{};var F={},W=Object.keys(v),V,I;for(I=0;I<W.length;I++){if(V=W[I],O.indexOf(V)>=0)continue;F[V]=v[V]}return F}function j(v,O){if(!(v instanceof O))throw new TypeError("Cannot call a class as a function")}function B(v,O){for(var F=0;F<O.length;F++){var W=O[F];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(v,W.key,W)}}function P(v,O,F){return O&&B(v.prototype,O),F&&B(v,F),v}function A(v,O){return O&&(ie(O)==="object"||typeof O=="function")?O:b(v)}function p(v){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(F){return F.__proto__||Object.getPrototypeOf(F)},p(v)}function b(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function M(v,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(O&&O.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),O&&L(v,O)}function L(v,O){return L=Object.setPrototypeOf||function(W,V){return W.__proto__=V,W},L(v,O)}function C(v,O,F){return O in v?Object.defineProperty(v,O,{value:F,enumerable:!0,configurable:!0,writable:!0}):v[O]=F,v}var E=se("q1tI"),h=se("17x9"),o=se("H38U"),l=se("aRTE");function d(v){for(var O="",F=0;F<v.length;F++){var W=v.charCodeAt(F);W<128?O+=String.fromCharCode(W):W<2048?(O+=String.fromCharCode(192|W>>6),O+=String.fromCharCode(128|W&63)):W<55296||W>=57344?(O+=String.fromCharCode(224|W>>12),O+=String.fromCharCode(128|W>>6&63),O+=String.fromCharCode(128|W&63)):(F++,W=65536+((W&1023)<<10|v.charCodeAt(F)&1023),O+=String.fromCharCode(240|W>>18),O+=String.fromCharCode(128|W>>12&63),O+=String.fromCharCode(128|W>>6&63),O+=String.fromCharCode(128|W&63))}return O}var w={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},f={},y=4,D=.1;function T(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=[];return v.forEach(function(W,V){var I=null;W.forEach(function(N,X){if(!N&&I!==null){F.push("M".concat(I+O," ").concat(V+O,"h").concat(X-I,"v1H").concat(I+O,"z")),I=null;return}if(X===W.length-1){if(!N)return;I===null?F.push("M".concat(X+O,",").concat(V+O," h1v1H").concat(X+O,"z")):F.push("M".concat(I+O,",").concat(V+O," h").concat(X+1-I,"v1H").concat(I+O,"z"));return}N&&I===null&&(I=X)})}),F.join("")}function g(v,O){return v.slice().map(function(F,W){return W<O.y||W>=O.y+O.h?F:F.map(function(V,I){return I<O.x||I>=O.x+O.w?V:!1})})}function c(v,O){var F=v.imageSettings,W=v.size,V=v.includeMargin;if(F==null)return null;var I=V?y:0,N=O.length+I*2,X=Math.floor(W*D),q=N/W,ae=(F.width||X)*q,de=(F.height||X)*q,Ae=F.x==null?O.length/2-ae/2:F.x*q,be=F.y==null?O.length/2-de/2:F.y*q,Ce=null;if(F.excavate){var Te=Math.floor(Ae),Se=Math.floor(be),pe=Math.ceil(ae+Ae-Te),ue=Math.ceil(de+be-Se);Ce={x:Te,y:Se,w:pe,h:ue}}return{x:Ae,y:be,h:de,w:ae,excavation:Ce}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(v){return!1}return!0}(),a=function(v){M(O,v);function O(){var F,W;j(this,O);for(var V=arguments.length,I=new Array(V),N=0;N<V;N++)I[N]=arguments[N];return W=A(this,(F=p(O)).call.apply(F,[this].concat(I))),C(b(W),"_canvas",void 0),C(b(W),"_image",void 0),C(b(W),"state",{imgLoaded:!1}),C(b(W),"handleImageLoad",function(){W.setState({imgLoaded:!0})}),W}return P(O,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var W=this.props,V=W.value,I=W.size,N=W.level,X=W.bgColor,q=W.fgColor,ae=W.includeMargin,de=W.imageSettings,Ae=new o(-1,l[N]);if(Ae.addData(d(V)),Ae.make(),this._canvas!=null){var be=this._canvas,Ce=be.getContext("2d");if(!Ce)return;var Te=Ae.modules;if(Te===null)return;var Se=ae?y:0,pe=Te.length+Se*2,ue=c(this.props,Te);de!=null&&ue!=null&&(ue.excavation!=null&&(Te=g(Te,ue.excavation)));var te=window.devicePixelRatio||1;be.height=be.width=I*te;var fe=I/pe*te;Ce.scale(fe,fe),Ce.fillStyle=X,Ce.fillRect(0,0,pe,pe),Ce.fillStyle=q,u?Ce.fill(new Path2D(T(Te,Se))):Te.forEach(function(oe,Le){oe.forEach(function(_e,Ee){_e&&Ce.fillRect(Ee+Se,Le+Se,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Ce.drawImage(this._image,ue.x+Se,ue.y+Se,ue.w,ue.h)}}},{key:"render",value:function(){var W=this,V=this.props,I=V.value,N=V.size,X=V.level,q=V.bgColor,ae=V.fgColor,de=V.style,Ae=V.includeMargin,be=V.imageSettings,Ce=U(V,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Te=Y({height:N,width:N},de),Se=null,pe=be&&be.src;return be!=null&&pe!=null&&(Se=E.createElement("img",{src:pe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return W._image=te}})),E.createElement(E.Fragment,null,E.createElement("canvas",Q({style:Te,height:N,width:N,ref:function(te){return W._canvas=te}},Ce)),Se)}}]),O}(E.PureComponent);C(a,"defaultProps",w);var S=function(v){M(O,v);function O(){return j(this,O),A(this,p(O).apply(this,arguments))}return P(O,[{key:"render",value:function(){var W=this.props,V=W.value,I=W.size,N=W.level,X=W.bgColor,q=W.fgColor,ae=W.includeMargin,de=W.imageSettings,Ae=U(W,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),be=new o(-1,l[N]);be.addData(d(V)),be.make();var Ce=be.modules;if(Ce===null)return null;var Te=ae?y:0,Se=Ce.length+Te*2,pe=c(this.props,Ce),ue=null;de!=null&&pe!=null&&(pe.excavation!=null&&(Ce=g(Ce,pe.excavation)),ue=E.createElement("image",{xlinkHref:de.src,height:pe.h,width:pe.w,x:pe.x+Te,y:pe.y+Te,preserveAspectRatio:"none"}));var te=T(Ce,Te);return E.createElement("svg",Q({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(Se," ").concat(Se)},Ae),E.createElement("path",{fill:X,d:"M0,0 h".concat(Se,"v").concat(Se,"H0z")}),E.createElement("path",{fill:q,d:te}),ue)}}]),O}(E.PureComponent);C(S,"defaultProps",w);var x=function(O){var F=O.renderAs,W=U(O,["renderAs"]),V=F==="svg"?S:a;return E.createElement(V,W)};x.defaultProps=Y({renderAs:"canvas"},w),ht.exports=x},DlQD:function(ht,qe,se){(function(ie,Q){ht.exports=Q()})(this,function(){"use strict";function ie(xe,me){for(var ye=0;ye<me.length;ye++){var re=me[ye];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(xe,re.key,re)}}function Q(xe,me,ye){return me&&ie(xe.prototype,me),ye&&ie(xe,ye),xe}function R(xe,me){if(!xe)return;if(typeof xe=="string")return Y(xe,me);var ye=Object.prototype.toString.call(xe).slice(8,-1);if(ye==="Object"&&xe.constructor&&(ye=xe.constructor.name),ye==="Map"||ye==="Set")return Array.from(xe);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return Y(xe,me)}function Y(xe,me){(me==null||me>xe.length)&&(me=xe.length);for(var ye=0,re=new Array(me);ye<me;ye++)re[ye]=xe[ye];return re}function U(xe,me){var ye;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(ye=R(xe))||me&&xe&&typeof xe.length=="number"){ye&&(xe=ye);var re=0;return function(){return re>=xe.length?{done:!0}:{done:!1,value:xe[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ye=xe[Symbol.iterator](),ye.next.bind(ye)}function _(xe,me){return me={exports:{}},xe(me,me.exports),me.exports}var j=_(function(xe){function me(){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 ye(re){xe.exports.defaults=re}xe.exports={defaults:me(),getDefaults:me,changeDefaults:ye}}),B=j.defaults,P=j.getDefaults,A=j.changeDefaults,p=/[&<>"']/,b=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,C={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(me){return C[me]};function h(xe,me){if(me){if(p.test(xe))return xe.replace(b,E)}else if(M.test(xe))return xe.replace(L,E);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(xe){return xe.replace(o,function(me,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(xe,me){xe=xe.source||xe,me=me||"";var ye={replace:function(ne,le){return le=le.source||le,le=le.replace(d,"$1"),xe=xe.replace(ne,le),ye},getRegex:function(){return new RegExp(xe,me)}};return ye}var f=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(xe,me,ye){if(xe){var re;try{re=decodeURIComponent(l(ye)).replace(f,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}me&&!y.test(ye)&&(ye=a(me,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(ne){return null}return ye}var T={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,me){T[" "+xe]||(g.test(xe)?T[" "+xe]=xe+"/":T[" "+xe]=O(xe,"/",!0)),xe=T[" "+xe];var ye=xe.indexOf(":")===-1;return me.substring(0,2)==="//"?ye?me:xe.replace(c,"$1")+me:me.charAt(0)==="/"?ye?me:xe.replace(u,"$1")+me:xe+me}var S={exec:function(){}};function x(xe){for(var me=1,ye,re;me<arguments.length;me++){ye=arguments[me];for(re in ye)Object.prototype.hasOwnProperty.call(ye,re)&&(xe[re]=ye[re])}return xe}function v(xe,me){var ye=xe.replace(/\|/g,function(le,he,ke){for(var Me=!1,Ye=he;--Ye>=0&&ke[Ye]==="\\";)Me=!Me;return Me?"|":" |"}),re=ye.split(/ \|/),ne=0;if(re.length>me)re.splice(me);else for(;re.length<me;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function O(xe,me,ye){var re=xe.length;if(re===0)return"";for(var ne=0;ne<re;){var le=xe.charAt(re-ne-1);if(le===me&&!ye)ne++;else if(le!==me&&ye)ne++;else break}return xe.substr(0,re-ne)}function F(xe,me){if(xe.indexOf(me[1])===-1)return-1;for(var ye=xe.length,re=0,ne=0;ne<ye;ne++)if(xe[ne]==="\\")ne++;else if(xe[ne]===me[0])re++;else if(xe[ne]===me[1]&&(re--,re<0))return ne;return-1}function W(xe){xe&&xe.sanitize&&!xe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:l,edit:w,cleanUrl:D,resolveUrl:a,noopTest:S,merge:x,splitCells:v,rtrim:O,findClosingBracket:F,checkSanitizeDeprecation:W},I=j.defaults,N=V.rtrim,X=V.splitCells,q=V.escape,ae=V.findClosingBracket;function de(xe,me,ye){var re=me.href,ne=me.title?q(me.title):null,le=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:ye,href:re,title:ne,text:le}:{type:"image",raw:ye,href:re,title:ne,text:q(le)}}function Ae(xe,me){var ye=xe.match(/^(\s+)(?:```)/);if(ye===null)return me;var re=ye[1];return me.split(`
|
|
`).map(function(ne){var le=ne.match(/^\s+/);if(le===null)return ne;var he=le[0];return he.length>=re.length?ne.slice(re.length):ne}).join(`
|
|
`)}var be=function(){function xe(ye){this.options=ye||I}var me=xe.prototype;return me.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
|
|
`}},me.code=function(re,ne){var le=this.rules.block.code.exec(re);if(le){var he=ne[ne.length-1];if(he&&he.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var ke=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?ke:N(ke,`
|
|
`)}}},me.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var le=ne[0],he=Ae(le,ne[3]||"");return{type:"code",raw:le,lang:ne[2]?ne[2].trim():ne[2],text:he}}},me.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},me.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var le={type:"table",header:X(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ne[0]};if(le.header.length===le.align.length){var he=le.align.length,ke;for(ke=0;ke<he;ke++)/^ *-+: *$/.test(le.align[ke])?le.align[ke]="right":/^ *:-+: *$/.test(le.align[ke])?le.align[ke]="center":/^ *:-+ *$/.test(le.align[ke])?le.align[ke]="left":le.align[ke]=null;for(he=le.cells.length,ke=0;ke<he;ke++)le.cells[ke]=X(le.cells[ke],le.header.length);return le}}},me.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},me.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var le=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:le}}},me.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var le=ne[0],he=ne[2],ke=he.length>1,Me=he[he.length-1]===")",Ye={type:"list",raw:le,ordered:ke,start:ke?+he.slice(0,-1):"",loose:!1,items:[]},yt=ne[0].match(this.rules.block.item),At=!1,ze,xt,mt,nt,_t,kt,Kt,Bt=yt.length,wt=0;wt<Bt;wt++)ze=yt[wt],le=ze,xt=ze.length,ze=ze.replace(/^ *([*+-]|\d+[.)]) */,""),~ze.indexOf(`
|
|
`)&&(xt-=ze.length,ze=this.options.pedantic?ze.replace(/^ {1,4}/gm,""):ze.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),wt!==Bt-1&&(mt=this.rules.block.bullet.exec(yt[wt+1])[0],(ke?mt.length===1||!Me&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==he)&&(nt=yt.slice(wt+1).join(`
|
|
`),Ye.raw=Ye.raw.substring(0,Ye.raw.length-nt.length),wt=Bt-1)),_t=At||/\n\n(?!\s*$)/.test(ze),wt!==Bt-1&&(At=ze.charAt(ze.length-1)===`
|
|
`,_t||(_t=At)),_t&&(Ye.loose=!0),kt=/^\[[ xX]\] /.test(ze),Kt=void 0,kt&&(Kt=ze[1]!==" ",ze=ze.replace(/^\[[ xX]\] +/,"")),Ye.items.push({type:"list_item",raw:le,task:kt,checked:Kt,loose:_t,text:ze});return Ye}},me.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):q(ne[0]):ne[0]}},me.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var le=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:ne[0],href:ne[2],title:ne[3]}}},me.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var le={type:"table",header:X(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
|
|
`):[]};if(le.header.length===le.align.length){le.raw=ne[0];var he=le.align.length,ke;for(ke=0;ke<he;ke++)/^ *-+: *$/.test(le.align[ke])?le.align[ke]="right":/^ *:-+: *$/.test(le.align[ke])?le.align[ke]="center":/^ *:-+ *$/.test(le.align[ke])?le.align[ke]="left":le.align[ke]=null;for(he=le.cells.length,ke=0;ke<he;ke++)le.cells[ke]=X(le.cells[ke].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},me.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},me.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
|
|
`?ne[1].slice(0,-1):ne[1]}},me.text=function(re,ne){var le=this.rules.block.text.exec(re);if(le){var he=ne[ne.length-1];return he&&he.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},me.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:q(ne[1])}},me.tag=function(re,ne,le){var he=this.rules.inline.tag.exec(re);if(he)return!ne&&/^<a /i.test(he[0])?ne=!0:ne&&/^<\/a>/i.test(he[0])&&(ne=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ne,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):q(he[0]):he[0]}},me.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var le=ae(ne[2],"()");if(le>-1){var he=ne[0].indexOf("!")===0?5:4,ke=he+ne[1].length+le;ne[2]=ne[2].substring(0,le),ne[0]=ne[0].substring(0,ke).trim(),ne[3]=""}var Me=ne[2],Ye="";if(this.options.pedantic){var yt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);yt?(Me=yt[1],Ye=yt[3]):Ye=""}else Ye=ne[3]?ne[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var At=de(ne,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:Ye&&Ye.replace(this.rules.inline._escapes,"$1")},ne[0]);return At}},me.reflink=function(re,ne){var le;if((le=this.rules.inline.reflink.exec(re))||(le=this.rules.inline.nolink.exec(re))){var he=(le[2]||le[1]).replace(/\s+/g," ");if(he=ne[he.toLowerCase()],!he||!he.href){var ke=le[0].charAt(0);return{type:"text",raw:ke,text:ke}}var Me=de(le,he,le[0]);return Me}},me.strong=function(re,ne,le){le===void 0&&(le="");var he=this.rules.inline.strong.start.exec(re);if(he&&(!he[1]||he[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ne=ne.slice(-1*re.length);var ke=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ke.lastIndex=0;for(var Me;(he=ke.exec(ne))!=null;)if(Me=this.rules.inline.strong.middle.exec(ne.slice(0,he.index+3)),Me)return{type:"strong",raw:re.slice(0,Me[0].length),text:re.slice(2,Me[0].length-2)}}},me.em=function(re,ne,le){le===void 0&&(le="");var he=this.rules.inline.em.start.exec(re);if(he&&(!he[1]||he[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ne=ne.slice(-1*re.length);var ke=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ke.lastIndex=0;for(var Me;(he=ke.exec(ne))!=null;)if(Me=this.rules.inline.em.middle.exec(ne.slice(0,he.index+2)),Me)return{type:"em",raw:re.slice(0,Me[0].length),text:re.slice(1,Me[0].length-1)}}},me.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var le=ne[2].replace(/\n/g," "),he=/[^ ]/.test(le),ke=le.startsWith(" ")&&le.endsWith(" ");return he&&ke&&(le=le.substring(1,le.length-1)),le=q(le,!0),{type:"codespan",raw:ne[0],text:le}}},me.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},me.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},me.autolink=function(re,ne){var le=this.rules.inline.autolink.exec(re);if(le){var he,ke;return le[2]==="@"?(he=q(this.options.mangle?ne(le[1]):le[1]),ke="mailto:"+he):(he=q(le[1]),ke=he),{type:"link",raw:le[0],text:he,href:ke,tokens:[{type:"text",raw:he,text:he}]}}},me.url=function(re,ne){var le;if(le=this.rules.inline.url.exec(re)){var he,ke;if(le[2]==="@")he=q(this.options.mangle?ne(le[0]):le[0]),ke="mailto:"+he;else{var Me;do Me=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Me!==le[0]);he=q(le[0]),le[1]==="www."?ke="http://"+he:ke=he}return{type:"link",raw:le[0],text:he,href:ke,tokens:[{type:"text",raw:he,text:he}]}}},me.inlineText=function(re,ne,le){var he=this.rules.inline.text.exec(re);if(he){var ke;return ne?ke=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):q(he[0]):he[0]:ke=q(this.options.smartypants?le(he[0]):he[0]),{type:"text",raw:he[0],text:ke}}},xe}(),Ce=V.noopTest,Te=V.edit,Se=V.merge,pe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Ce,table:Ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Te(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Te(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Te(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Te(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Te(pe._paragraph).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.blockquote=Te(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=Se({},pe),pe.gfm=Se({},pe.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*|$)"}),pe.gfm.nptable=Te(pe.gfm.nptable).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.gfm.table=Te(pe.gfm.table).replace("hr",pe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",pe._tag).getRegex(),pe.pedantic=Se({},pe.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Ce,paragraph:Te(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Te(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Te(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Te(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Te(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Te(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Te(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Te(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Te(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Te(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Te(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Te(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ue.autolink=Te(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=Te(ue.tag).replace("comment",pe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Te(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Te(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Te(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Se({},ue),ue.pedantic=Se({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Se({},ue.normal,{escape:Te(ue.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=Te(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Se({},ue.gfm,{br:Te(ue.br).replace("{2,}","*").getRegex(),text:Te(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:ue},fe=j.defaults,oe=te.block,Le=te.inline;function _e(xe){return xe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Ee(xe){var me="",ye,re,ne=xe.length;for(ye=0;ye<ne;ye++)re=xe.charCodeAt(ye),Math.random()>.5&&(re="x"+re.toString(16)),me+="&#"+re+";";return me}var Pe=function(){function xe(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||fe,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:oe.normal,inline:Le.normal};this.options.pedantic?(re.block=oe.pedantic,re.inline=Le.pedantic):this.options.gfm&&(re.block=oe.gfm,this.options.breaks?re.inline=Le.breaks:re.inline=Le.gfm),this.tokenizer.rules=re}xe.lex=function(re,ne){var le=new xe(ne);return le.lex(re)};var me=xe.prototype;return me.lex=function(re){return re=re.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},me.blockTokens=function(re,ne,le){ne===void 0&&(ne=[]),le===void 0&&(le=!0),re=re.replace(/^ +$/gm,"");for(var he,ke,Me,Ye;re;){if(he=this.tokenizer.space(re)){re=re.substring(he.raw.length),he.type&&ne.push(he);continue}if(he=this.tokenizer.code(re,ne)){re=re.substring(he.raw.length),he.type?ne.push(he):(Ye=ne[ne.length-1],Ye.raw+=`
|
|
`+he.raw,Ye.text+=`
|
|
`+he.text);continue}if(he=this.tokenizer.fences(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.heading(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.nptable(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.hr(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.blockquote(re)){re=re.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],le),ne.push(he);continue}if(he=this.tokenizer.list(re)){for(re=re.substring(he.raw.length),Me=he.items.length,ke=0;ke<Me;ke++)he.items[ke].tokens=this.blockTokens(he.items[ke].text,[],!1);ne.push(he);continue}if(he=this.tokenizer.html(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(le&&(he=this.tokenizer.def(re))){re=re.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.lheading(re)){re=re.substring(he.raw.length),ne.push(he);continue}if(le&&(he=this.tokenizer.paragraph(re))){re=re.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.text(re,ne)){re=re.substring(he.raw.length),he.type?ne.push(he):(Ye=ne[ne.length-1],Ye.raw+=`
|
|
`+he.raw,Ye.text+=`
|
|
`+he.text);continue}if(re){var yt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return ne},me.inline=function(re){var ne,le,he,ke,Me,Ye,yt=re.length;for(ne=0;ne<yt;ne++){Ye=re[ne];switch(Ye.type){case"paragraph":case"text":case"heading":{Ye.tokens=[],this.inlineTokens(Ye.text,Ye.tokens);break}case"table":{for(Ye.tokens={header:[],cells:[]},ke=Ye.header.length,le=0;le<ke;le++)Ye.tokens.header[le]=[],this.inlineTokens(Ye.header[le],Ye.tokens.header[le]);for(ke=Ye.cells.length,le=0;le<ke;le++)for(Me=Ye.cells[le],Ye.tokens.cells[le]=[],he=0;he<Me.length;he++)Ye.tokens.cells[le][he]=[],this.inlineTokens(Me[he],Ye.tokens.cells[le][he]);break}case"blockquote":{this.inline(Ye.tokens);break}case"list":{for(ke=Ye.items.length,le=0;le<ke;le++)this.inline(Ye.items[le].tokens);break}}}return re},me.inlineTokens=function(re,ne,le,he,ke){ne===void 0&&(ne=[]),le===void 0&&(le=!1),he===void 0&&(he=!1),ke===void 0&&(ke="");var Me,Ye=re,yt;if(this.tokens.links){var At=Object.keys(this.tokens.links);if(At.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(Ye))!=null;)At.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(Ye))!=null;)Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Me=this.tokenizer.escape(re)){re=re.substring(Me.raw.length),ne.push(Me);continue}if(Me=this.tokenizer.tag(re,le,he)){re=re.substring(Me.raw.length),le=Me.inLink,he=Me.inRawBlock,ne.push(Me);continue}if(Me=this.tokenizer.link(re)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,he)),ne.push(Me);continue}if(Me=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,he)),ne.push(Me);continue}if(Me=this.tokenizer.strong(re,Ye,ke)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,he),ne.push(Me);continue}if(Me=this.tokenizer.em(re,Ye,ke)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,he),ne.push(Me);continue}if(Me=this.tokenizer.codespan(re)){re=re.substring(Me.raw.length),ne.push(Me);continue}if(Me=this.tokenizer.br(re)){re=re.substring(Me.raw.length),ne.push(Me);continue}if(Me=this.tokenizer.del(re)){re=re.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,he),ne.push(Me);continue}if(Me=this.tokenizer.autolink(re,Ee)){re=re.substring(Me.raw.length),ne.push(Me);continue}if(!le&&(Me=this.tokenizer.url(re,Ee))){re=re.substring(Me.raw.length),ne.push(Me);continue}if(Me=this.tokenizer.inlineText(re,he,_e)){re=re.substring(Me.raw.length),ke=Me.raw.slice(-1),ne.push(Me);continue}if(re){var ze="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return ne},Q(xe,null,[{key:"rules",get:function(){return{block:oe,inline:Le}}}]),xe}(),Be=j.defaults,Ve=V.cleanUrl,We=V.escape,Fe=function(){function xe(ye){this.options=ye||Be}var me=xe.prototype;return me.code=function(re,ne,le){var he=(ne||"").match(/\S*/)[0];if(this.options.highlight){var ke=this.options.highlight(re,he);ke!=null&&ke!==re&&(le=!0,re=ke)}return he?'<pre><code class="'+this.options.langPrefix+We(he,!0)+'">'+(le?re:We(re,!0))+`</code></pre>
|
|
`:"<pre><code>"+(le?re:We(re,!0))+`</code></pre>
|
|
`},me.blockquote=function(re){return`<blockquote>
|
|
`+re+`</blockquote>
|
|
`},me.html=function(re){return re},me.heading=function(re,ne,le,he){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+he.slug(le)+'">'+re+"</h"+ne+`>
|
|
`:"<h"+ne+">"+re+"</h"+ne+`>
|
|
`},me.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},me.list=function(re,ne,le){var he=ne?"ol":"ul",ke=ne&&le!==1?' start="'+le+'"':"";return"<"+he+ke+`>
|
|
`+re+"</"+he+`>
|
|
`},me.listitem=function(re){return"<li>"+re+`</li>
|
|
`},me.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},me.paragraph=function(re){return"<p>"+re+`</p>
|
|
`},me.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
|
|
<thead>
|
|
`+re+`</thead>
|
|
`+ne+`</table>
|
|
`},me.tablerow=function(re){return`<tr>
|
|
`+re+`</tr>
|
|
`},me.tablecell=function(re,ne){var le=ne.header?"th":"td",he=ne.align?"<"+le+' align="'+ne.align+'">':"<"+le+">";return he+re+"</"+le+`>
|
|
`},me.strong=function(re){return"<strong>"+re+"</strong>"},me.em=function(re){return"<em>"+re+"</em>"},me.codespan=function(re){return"<code>"+re+"</code>"},me.br=function(){return this.options.xhtml?"<br/>":"<br>"},me.del=function(re){return"<del>"+re+"</del>"},me.link=function(re,ne,le){if(re=Ve(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var he='<a href="'+We(re)+'"';return ne&&(he+=' title="'+ne+'"'),he+=">"+le+"</a>",he},me.image=function(re,ne,le){if(re=Ve(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var he='<img src="'+re+'" alt="'+le+'"';return ne&&(he+=' title="'+ne+'"'),he+=this.options.xhtml?"/>":">",he},me.text=function(re){return re},xe}(),Ue=function(){function xe(){}var me=xe.prototype;return me.strong=function(re){return re},me.em=function(re){return re},me.codespan=function(re){return re},me.del=function(re){return re},me.html=function(re){return re},me.text=function(re){return re},me.link=function(re,ne,le){return""+le},me.image=function(re,ne,le){return""+le},me.br=function(){return""},xe}(),st=function(){function xe(){this.seen={}}var me=xe.prototype;return me.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var le=ne;do this.seen[le]++,ne=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},xe}(),ot=j.defaults,it=V.unescape,Je=function(){function xe(ye){this.options=ye||ot,this.options.renderer=this.options.renderer||new Fe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new st}xe.parse=function(re,ne){var le=new xe(ne);return le.parse(re)};var me=xe.prototype;return me.parse=function(re,ne){ne===void 0&&(ne=!0);var le="",he,ke,Me,Ye,yt,At,ze,xt,mt,nt,_t,kt,Kt,Bt,wt,pr,or,gt,Sr=re.length;for(he=0;he<Sr;he++){nt=re[he];switch(nt.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(nt.tokens),nt.depth,it(this.parseInline(nt.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(nt.text,nt.lang,nt.escaped);continue}case"table":{for(xt="",ze="",Ye=nt.header.length,ke=0;ke<Ye;ke++)ze+=this.renderer.tablecell(this.parseInline(nt.tokens.header[ke]),{header:!0,align:nt.align[ke]});for(xt+=this.renderer.tablerow(ze),mt="",Ye=nt.cells.length,ke=0;ke<Ye;ke++){for(At=nt.tokens.cells[ke],ze="",yt=At.length,Me=0;Me<yt;Me++)ze+=this.renderer.tablecell(this.parseInline(At[Me]),{header:!1,align:nt.align[Me]});mt+=this.renderer.tablerow(ze)}le+=this.renderer.table(xt,mt);continue}case"blockquote":{mt=this.parse(nt.tokens),le+=this.renderer.blockquote(mt);continue}case"list":{for(_t=nt.ordered,kt=nt.start,Kt=nt.loose,Ye=nt.items.length,mt="",ke=0;ke<Ye;ke++)wt=nt.items[ke],pr=wt.checked,or=wt.task,Bt="",wt.task&&(gt=this.renderer.checkbox(pr),Kt?wt.tokens.length>0&&wt.tokens[0].type==="text"?(wt.tokens[0].text=gt+" "+wt.tokens[0].text,wt.tokens[0].tokens&&wt.tokens[0].tokens.length>0&&wt.tokens[0].tokens[0].type==="text"&&(wt.tokens[0].tokens[0].text=gt+" "+wt.tokens[0].tokens[0].text)):wt.tokens.unshift({type:"text",text:gt}):Bt+=gt),Bt+=this.parse(wt.tokens,Kt),mt+=this.renderer.listitem(Bt,or,pr);le+=this.renderer.list(mt,_t,kt);continue}case"html":{le+=this.renderer.html(nt.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(nt.tokens));continue}case"text":{for(mt=nt.tokens?this.parseInline(nt.tokens):nt.text;he+1<Sr&&re[he+1].type==="text";)nt=re[++he],mt+=`
|
|
`+(nt.tokens?this.parseInline(nt.tokens):nt.text);le+=ne?this.renderer.paragraph(mt):mt;continue}default:{var sr='Token with "'+nt.type+'" type was not found.';if(this.options.silent){console.error(sr);return}else throw new Error(sr)}}}return le},me.parseInline=function(re,ne){ne=ne||this.renderer;var le="",he,ke,Me=re.length;for(he=0;he<Me;he++){ke=re[he];switch(ke.type){case"escape":{le+=ne.text(ke.text);break}case"html":{le+=ne.html(ke.text);break}case"link":{le+=ne.link(ke.href,ke.title,this.parseInline(ke.tokens,ne));break}case"image":{le+=ne.image(ke.href,ke.title,ke.text);break}case"strong":{le+=ne.strong(this.parseInline(ke.tokens,ne));break}case"em":{le+=ne.em(this.parseInline(ke.tokens,ne));break}case"codespan":{le+=ne.codespan(ke.text);break}case"br":{le+=ne.br();break}case"del":{le+=ne.del(this.parseInline(ke.tokens,ne));break}case"text":{le+=ne.text(ke.text);break}default:{var Ye='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(Ye);return}else throw new Error(Ye)}}}return le},xe}(),rt=V.merge,$e=V.checkSanitizeDeprecation,Ze=V.escape,Oe=j.getDefaults,ut=j.changeDefaults,at=j.defaults;function Ie(xe,me,ye){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof me=="function"&&(ye=me,me=null),me=rt({},Ie.defaults,me||{}),$e(me),ye){var re=me.highlight,ne;try{ne=Pe.lex(xe,me)}catch(Me){return ye(Me)}var le=function(Ye){var yt;if(!Ye)try{yt=Je.parse(ne,me)}catch(At){Ye=At}return me.highlight=re,Ye?ye(Ye):ye(null,yt)};if(!re||re.length<3)return le();if(delete me.highlight,!ne.length)return le();var he=0;Ie.walkTokens(ne,function(Me){Me.type==="code"&&(he++,setTimeout(function(){re(Me.text,Me.lang,function(Ye,yt){if(Ye)return le(Ye);yt!=null&&yt!==Me.text&&(Me.text=yt,Me.escaped=!0),he--,he===0&&le()})},0))}),he===0&&le();return}try{var ke=Pe.lex(xe,me);return me.walkTokens&&Ie.walkTokens(ke,me.walkTokens),Je.parse(ke,me)}catch(Me){if(Me.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,me.silent)return"<p>An error occurred:</p><pre>"+Ze(Me.message+"",!0)+"</pre>";throw Me}}Ie.options=Ie.setOptions=function(xe){return rt(Ie.defaults,xe),ut(Ie.defaults),Ie},Ie.getDefaults=Oe,Ie.defaults=at,Ie.use=function(xe){var me=rt({},xe);if(xe.renderer&&function(){var re=Ie.defaults.renderer||new Fe,ne=function(ke){var Me=re[ke];re[ke]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var ze=xe.renderer[ke].apply(re,yt);return ze===!1&&(ze=Me.apply(re,yt)),ze}};for(var le in xe.renderer)ne(le);me.renderer=re}(),xe.tokenizer&&function(){var re=Ie.defaults.tokenizer||new be,ne=function(ke){var Me=re[ke];re[ke]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var ze=xe.tokenizer[ke].apply(re,yt);return ze===!1&&(ze=Me.apply(re,yt)),ze}};for(var le in xe.tokenizer)ne(le);me.tokenizer=re}(),xe.walkTokens){var ye=Ie.defaults.walkTokens;me.walkTokens=function(re){xe.walkTokens(re),ye&&ye(re)}}Ie.setOptions(me)},Ie.walkTokens=function(xe,me){for(var ye=U(xe),re;!(re=ye()).done;){var ne=re.value;me(ne);switch(ne.type){case"table":{for(var le=U(ne.tokens.header),he;!(he=le()).done;){var ke=he.value;Ie.walkTokens(ke,me)}for(var Me=U(ne.tokens.cells),Ye;!(Ye=Me()).done;)for(var yt=Ye.value,At=U(yt),ze;!(ze=At()).done;){var xt=ze.value;Ie.walkTokens(xt,me)}break}case"list":{Ie.walkTokens(ne.items,me);break}default:ne.tokens&&Ie.walkTokens(ne.tokens,me)}}},Ie.Parser=Je,Ie.parser=Je.parse,Ie.Renderer=Fe,Ie.TextRenderer=Ue,Ie.Lexer=Pe,Ie.lexer=Pe.lex,Ie.Tokenizer=be,Ie.Slugger=st,Ie.parse=Ie;var He=Ie;return He})},ELLl:function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){var Q={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=ie.Pos;ie.defineOption("autoCloseBrackets",!1,function(C,E,h){h&&h!=ie.Init&&(C.removeKeyMap(U),C.state.closeBrackets=null),E&&(_(Y(E,"pairs")),C.state.closeBrackets=E,C.addKeyMap(U))});function Y(C,E){return E=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[E]!=null?C[E]:Q[E]}var U={Backspace:P,Enter:A};function _(C){for(var E=0;E<C.length;E++){var h=C.charAt(E),o="'"+h+"'";U[o]||(U[o]=j(h))}}_(Q.pairs+"`");function j(C){return function(E){return b(E,C)}}function B(C){var E=C.state.closeBrackets;if(!E||E.override)return E;var h=C.getModeAt(C.getCursor());return h.closeBrackets||E}function P(C){var E=B(C);if(!E||C.getOption("disableInput"))return ie.Pass;for(var h=Y(E,"pairs"),o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return ie.Pass;var d=M(C,o[l].head);if(!d||h.indexOf(d)%2!=0)return ie.Pass}for(var l=o.length-1;l>=0;l--){var w=o[l].head;C.replaceRange("",R(w.line,w.ch-1),R(w.line,w.ch+1),"+delete")}}function A(C){var E=B(C),h=E&&Y(E,"explode");if(!h||C.getOption("disableInput"))return ie.Pass;for(var o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return ie.Pass;var d=M(C,o[l].head);if(!d||h.indexOf(d)%2!=0)return ie.Pass}C.operation(function(){var w=C.lineSeparator()||`
|
|
`;C.replaceSelection(w+w,null),C.execCommand("goCharLeft"),o=C.listSelections();for(var f=0;f<o.length;f++){var y=o[f].head.line;C.indentLine(y,null,!0),C.indentLine(y+1,null,!0)}})}function p(C){var E=ie.cmpPos(C.anchor,C.head)>0;return{anchor:new R(C.anchor.line,C.anchor.ch+(E?-1:1)),head:new R(C.head.line,C.head.ch+(E?1:-1))}}function b(C,E){var h=B(C);if(!h||C.getOption("disableInput"))return ie.Pass;var o=Y(h,"pairs"),l=o.indexOf(E);if(l==-1)return ie.Pass;for(var d=Y(h,"closeBefore"),w=Y(h,"triples"),f=o.charAt(l+1)==E,y=C.listSelections(),D=l%2==0,T,g=0;g<y.length;g++){var c=y[g],u=c.head,a,S=C.getRange(u,R(u.line,u.ch+1));if(D&&!c.empty())a="surround";else if((f||!D)&&S==E)f&&L(C,u)?a="both":w.indexOf(E)>=0&&C.getRange(u,R(u.line,u.ch+3))==E+E+E?a="skipThree":a="skip";else if(f&&u.ch>1&&w.indexOf(E)>=0&&C.getRange(R(u.line,u.ch-2),u)==E+E){if(u.ch>2&&/\bstring/.test(C.getTokenTypeAt(R(u.line,u.ch-2))))return ie.Pass;a="addFour"}else if(f){var x=u.ch==0?" ":C.getRange(R(u.line,u.ch-1),u);if(!ie.isWordChar(S)&&x!=E&&!ie.isWordChar(x))a="both";else return ie.Pass}else if(D&&(S.length===0||/\s/.test(S)||d.indexOf(S)>-1))a="both";else return ie.Pass;if(!T)T=a;else if(T!=a)return ie.Pass}var v=l%2?o.charAt(l-1):E,O=l%2?E:o.charAt(l+1);C.operation(function(){if(T=="skip")C.execCommand("goCharRight");else if(T=="skipThree")for(var F=0;F<3;F++)C.execCommand("goCharRight");else if(T=="surround"){for(var W=C.getSelections(),F=0;F<W.length;F++)W[F]=v+W[F]+O;C.replaceSelections(W,"around"),W=C.listSelections().slice();for(var F=0;F<W.length;F++)W[F]=p(W[F]);C.setSelections(W)}else T=="both"?(C.replaceSelection(v+O,null),C.triggerElectric(v+O),C.execCommand("goCharLeft")):T=="addFour"&&(C.replaceSelection(v+v+v+v,"before"),C.execCommand("goCharRight"))})}function M(C,E){var h=C.getRange(R(E.line,E.ch-1),R(E.line,E.ch+1));return h.length==2?h:null}function L(C,E){var h=C.getTokenAt(R(E.line,E.ch+1));return/\bstring/.test(h.type)&&h.start==E.ch&&(E.ch==0||!/\bstring/.test(C.getTokenTypeAt(E)))}})},GfqC:function(ht,qe,se){"use strict";var ie=se("q1tI"),Q=se.n(ie),R=se("TSYQ"),Y=se.n(R);function U(V,I){var N="cannot "+V.method+" "+V.action+" "+I.status+"'",X=new Error(N);return X.status=I.status,X.method=V.method,X.url=V.action,X}function _(V){var I=V.responseText||V.response;if(!I)return I;try{return JSON.parse(I)}catch(N){return I}}function j(V){var I=new XMLHttpRequest;V.onProgress&&I.upload&&(I.upload.onprogress=function(ae){ae.total>0&&(ae.percent=ae.loaded/ae.total*100),V.onProgress(ae)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(q){var ae=V.data[q];if(Array.isArray(ae)){ae.forEach(function(de){N.append(q+"[]",de)});return}N.append(q,V.data[q])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),I.onerror=function(ae){V.onError(ae)},I.onload=function(){return I.status<200||I.status>=300?V.onError(U(V,I),_(I)):V.onSuccess(_(I),I)},I.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var X=V.headers||{};return X["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(q){X[q]!==null&&I.setRequestHeader(q,X[q])}),I.send(N),{abort:function(){I.abort()}}}var B=+new Date,P=0;function A(){return"rc-upload-"+B+"-"+ ++P}function p(V,I){return V.indexOf(I,V.length-I.length)!==-1}var b=function(V,I){if(V&&I){var N=Array.isArray(I)?I:I.split(","),X=V.name||"",q=V.type||"",ae=q.replace(/\/.*$/,"");return N.some(function(de){var Ae=de.trim();return Ae.charAt(0)==="."?p(X.toLowerCase(),Ae.toLowerCase()):/\/\*$/.test(Ae)?ae===Ae.replace(/\/.*$/,""):q===Ae})}return!0};function M(V,I){var N=V.createReader(),X=[];function q(){N.readEntries(function(ae){var de=Array.prototype.slice.apply(ae);X=X.concat(de);var Ae=!de.length;Ae?I(X):q()})}q()}var L=function(I,N,X){var q=function ae(de,Ae){Ae=Ae||"",de.isFile?de.file(function(be){X(be)&&(de.fullPath&&!be.webkitRelativePath&&(Object.defineProperties(be,{webkitRelativePath:{writable:!0}}),be.webkitRelativePath=de.fullPath.replace(/^\//,""),Object.defineProperties(be,{webkitRelativePath:{writable:!1}})),N([be]))}):de.isDirectory&&M(de,function(be){be.forEach(function(Ce){ae(Ce,""+Ae+de.name+"/")})})};I.forEach(function(ae){q(ae.webkitGetAsEntry())})},C=L,E=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(V[X]=N[X])}return V},h=function(){function V(I,N){var X=[],q=!0,ae=!1,de=void 0;try{for(var Ae=I[Symbol.iterator](),be;!(q=(be=Ae.next()).done)&&!(X.push(be.value),N&&X.length===N);q=!0);}catch(Ce){ae=!0,de=Ce}finally{try{!q&&Ae.return&&Ae.return()}finally{if(ae)throw de}}return X}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return V(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&V(I.prototype,N),X&&V(I,X),I}}();function l(V,I,N){return I in V?Object.defineProperty(V,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[I]=N,V}function d(V,I){var N={};for(var X in V){if(I.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;N[X]=V[X]}return N}function w(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function f(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function y(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}var D=function(I){return Object.keys(I).reduce(function(N,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(N[X]=I[X]),N},{})},T=function(V){y(I,V);function I(){var N,X,q,ae;w(this,I);for(var de=arguments.length,Ae=Array(de),be=0;be<de;be++)Ae[be]=arguments[be];return ae=(X=(q=f(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.state={uid:A()},q.reqs={},q.onChange=function(Ce){var Te=Ce.target.files;q.uploadFiles(Te),q.reset()},q.onClick=function(Ce){var Te=q.fileInput;if(!Te)return;var Se=q.props,pe=Se.children,ue=Se.onClick;pe&&pe.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),ue&&ue(Ce)},q.onKeyDown=function(Ce){Ce.key==="Enter"&&q.onClick()},q.onFileDrop=function(Ce){var Te=q.props.multiple;if(Ce.preventDefault(),Ce.type==="dragover")return;if(q.props.directory)C(Array.prototype.slice.call(Ce.dataTransfer.items),q.uploadFiles,function(pe){return b(pe,q.props.accept)});else{var Se=Array.prototype.slice.call(Ce.dataTransfer.files).filter(function(pe){return b(pe,q.props.accept)});Te===!1&&(Se=Se.slice(0,1)),q.uploadFiles(Se)}},q.uploadFiles=function(Ce){var Te=Array.prototype.slice.call(Ce);Te.map(function(Se){return Se.uid=A(),Se}).forEach(function(Se){q.upload(Se,Te)})},q.saveFileInput=function(Ce){q.fileInput=Ce},X),f(q,ae)}return o(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,q){var ae=this,de=this.props;if(!de.beforeUpload)return setTimeout(function(){return ae.post(X)},0);var Ae=de.beforeUpload(X,q);Ae&&Ae.then?Ae.then(function(be){var Ce=Object.prototype.toString.call(be);return Ce==="[object File]"||Ce==="[object Blob]"?ae.post(be):ae.post(X)}).catch(function(be){console.log(be)}):Ae!==!1&&setTimeout(function(){return ae.post(X)},0);return}},{key:"post",value:function(X){var q=this;if(!this._isMounted)return;var ae=this.props,de=ae.onStart,Ae=ae.onProgress,be=ae.transformFile,Ce=be===void 0?function(Te){return Te}:be;new Promise(function(Te){var Se=ae.action;return typeof Se=="function"&&(Se=Se(X)),Te(Se)}).then(function(Te){var Se=X.uid,pe=ae.customRequest||j,ue=Promise.resolve(Ce(X)).then(function(te){var fe=ae.data;return typeof fe=="function"&&(fe=fe(te)),Promise.all([te,fe])}).catch(function(te){console.error(te)});ue.then(function(te){var fe=h(te,2),oe=fe[0],Le=fe[1],_e={action:Te,filename:ae.name,data:Le,file:oe,headers:ae.headers,withCredentials:ae.withCredentials,method:ae.method||"post",onProgress:Ae?function(Ee){Ae(Ee,X)}:null,onSuccess:function(Pe,Be){delete q.reqs[Se],ae.onSuccess(Pe,X,Be)},onError:function(Pe,Be){delete q.reqs[Se],ae.onError(Pe,Be,X)}};de(X),q.reqs[Se]=pe(_e)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(X){var q=this.reqs;if(X){var ae=X;X&&X.uid&&(ae=X.uid),q[ae]&&q[ae].abort&&q[ae].abort(),delete q[ae]}else Object.keys(q).forEach(function(de){q[de]&&q[de].abort&&q[de].abort(),delete q[de]})}},{key:"render",value:function(){var X,q=this.props,ae=q.component,de=q.prefixCls,Ae=q.className,be=q.disabled,Ce=q.id,Te=q.style,Se=q.multiple,pe=q.accept,ue=q.children,te=q.directory,fe=q.openFileDialogOnClick,oe=q.onMouseEnter,Le=q.onMouseLeave,_e=d(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Ee=Y()((X={},l(X,de,!0),l(X,de+"-disabled",be),l(X,Ae,Ae),X)),Pe=be?{}:{onClick:fe?this.onClick:function(){},onKeyDown:fe?this.onKeyDown:function(){},onMouseEnter:oe,onMouseLeave:Le,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Q.a.createElement(ae,E({},Pe,{className:Ee,role:"button",style:Te}),Q.a.createElement("input",E({},D(_e),{id:Ce,type:"file",ref:this.saveFileInput,onClick:function(Ve){return Ve.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),ue)}}]),I}(ie.Component),g=T,c=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(V[X]=N[X])}return V},u=function(){function V(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&V(I.prototype,N),X&&V(I,X),I}}();function a(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function S(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function x(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}function v(){}var O=function(V){x(I,V);function I(){var N,X,q,ae;a(this,I);for(var de=arguments.length,Ae=Array(de),be=0;be<de;be++)Ae[be]=arguments[be];return ae=(X=(q=S(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.saveUploader=function(Ce){q.uploader=Ce},X),S(q,ae)}return u(I,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return Q.a.createElement(g,c({},this.props,{ref:this.saveUploader}))}}]),I}(ie.Component);O.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:v,onError:v,onSuccess:v,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=O,W=qe.a=F},H38U:function(ht,qe,se){var ie=se("f4xo"),Q=se("rcnY"),R=se("wU8J"),Y=se("Iq15"),U=se("dWSS");function _(B,P){this.typeNumber=B,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var j=_.prototype;j.addData=function(B){var P=new ie(B);this.dataList.push(P),this.dataCache=null},j.isDark=function(B,P){if(B<0||this.moduleCount<=B||P<0||this.moduleCount<=P)throw new Error(B+","+P);return this.modules[B][P]},j.getModuleCount=function(){return this.moduleCount},j.make=function(){if(this.typeNumber<1){var B=1;for(B=1;B<40;B++){for(var P=Q.getRSBlocks(B,this.errorCorrectLevel),A=new R,p=0,b=0;b<P.length;b++)p+=P[b].dataCount;for(var b=0;b<this.dataList.length;b++){var M=this.dataList[b];A.put(M.mode,4),A.put(M.getLength(),Y.getLengthInBits(M.mode,B)),M.write(A)}if(A.getLengthInBits()<=p*8)break}this.typeNumber=B}this.makeImpl(!1,this.getBestMaskPattern())},j.makeImpl=function(B,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var A=0;A<this.moduleCount;A++){this.modules[A]=new Array(this.moduleCount);for(var p=0;p<this.moduleCount;p++)this.modules[A][p]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(B,P),this.typeNumber>=7&&this.setupTypeNumber(B),this.dataCache==null&&(this.dataCache=_.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},j.setupPositionProbePattern=function(B,P){for(var A=-1;A<=7;A++){if(B+A<=-1||this.moduleCount<=B+A)continue;for(var p=-1;p<=7;p++){if(P+p<=-1||this.moduleCount<=P+p)continue;0<=A&&A<=6&&(p==0||p==6)||0<=p&&p<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=p&&p<=4?this.modules[B+A][P+p]=!0:this.modules[B+A][P+p]=!1}}},j.getBestMaskPattern=function(){for(var B=0,P=0,A=0;A<8;A++){this.makeImpl(!0,A);var p=Y.getLostPoint(this);(A==0||B>p)&&(B=p,P=A)}return P},j.createMovieClip=function(B,P,A){var p=B.createEmptyMovieClip(P,A),b=1;this.make();for(var M=0;M<this.modules.length;M++)for(var L=M*b,C=0;C<this.modules[M].length;C++){var E=C*b,h=this.modules[M][C];h&&(p.beginFill(0,100),p.moveTo(E,L),p.lineTo(E+b,L),p.lineTo(E+b,L+b),p.lineTo(E,L+b),p.endFill())}return p},j.setupTimingPattern=function(){for(var B=8;B<this.moduleCount-8;B++){if(this.modules[B][6]!=null)continue;this.modules[B][6]=B%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},j.setupPositionAdjustPattern=function(){for(var B=Y.getPatternPosition(this.typeNumber),P=0;P<B.length;P++)for(var A=0;A<B.length;A++){var p=B[P],b=B[A];if(this.modules[p][b]!=null)continue;for(var M=-2;M<=2;M++)for(var L=-2;L<=2;L++)M==-2||M==2||L==-2||L==2||M==0&&L==0?this.modules[p+M][b+L]=!0:this.modules[p+M][b+L]=!1}},j.setupTypeNumber=function(B){for(var P=Y.getBCHTypeNumber(this.typeNumber),A=0;A<18;A++){var p=!B&&(P>>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=p}for(var A=0;A<18;A++){var p=!B&&(P>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=p}},j.setupTypeInfo=function(B,P){for(var A=this.errorCorrectLevel<<3|P,p=Y.getBCHTypeInfo(A),b=0;b<15;b++){var M=!B&&(p>>b&1)==1;b<6?this.modules[b][8]=M:b<8?this.modules[b+1][8]=M:this.modules[this.moduleCount-15+b][8]=M}for(var b=0;b<15;b++){var M=!B&&(p>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=M:b<9?this.modules[8][15-b-1+1]=M:this.modules[8][15-b-1]=M}this.modules[this.moduleCount-8][8]=!B},j.mapData=function(B,P){for(var A=-1,p=this.moduleCount-1,b=7,M=0,L=this.moduleCount-1;L>0;L-=2)for(L==6&&L--;;){for(var C=0;C<2;C++)if(this.modules[p][L-C]==null){var E=!1;M<B.length&&(E=(B[M]>>>b&1)==1);var h=Y.getMask(P,p,L-C);h&&(E=!E),this.modules[p][L-C]=E,b--,b==-1&&(M++,b=7)}if(p+=A,p<0||this.moduleCount<=p){p-=A,A=-A;break}}},_.PAD0=236,_.PAD1=17,_.createData=function(B,P,A){for(var p=Q.getRSBlocks(B,P),b=new R,M=0;M<A.length;M++){var L=A[M];b.put(L.mode,4),b.put(L.getLength(),Y.getLengthInBits(L.mode,B)),L.write(b)}for(var C=0,M=0;M<p.length;M++)C+=p[M].dataCount;if(b.getLengthInBits()>C*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+C*8+")");for(b.getLengthInBits()+4<=C*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=C*8);){if(b.put(_.PAD0,8),b.getLengthInBits()>=C*8)break;b.put(_.PAD1,8)}return _.createBytes(b,p)},_.createBytes=function(B,P){for(var A=0,p=0,b=0,M=new Array(P.length),L=new Array(P.length),C=0;C<P.length;C++){var E=P[C].dataCount,h=P[C].totalCount-E;p=Math.max(p,E),b=Math.max(b,h),M[C]=new Array(E);for(var o=0;o<M[C].length;o++)M[C][o]=255&B.buffer[o+A];A+=E;var l=Y.getErrorCorrectPolynomial(h),d=new U(M[C],l.getLength()-1),w=d.mod(l);L[C]=new Array(l.getLength()-1);for(var o=0;o<L[C].length;o++){var f=o+w.getLength()-L[C].length;L[C][o]=f>=0?w.get(f):0}}for(var y=0,o=0;o<P.length;o++)y+=P[o].totalCount;for(var D=new Array(y),T=0,o=0;o<p;o++)for(var C=0;C<P.length;C++)o<M[C].length&&(D[T++]=M[C][o]);for(var o=0;o<b;o++)for(var C=0;C<P.length;C++)o<L[C].length&&(D[T++]=L[C][o]);return D},ht.exports=_},HmJG:function(ht,qe,se){},Iq15:function(ht,qe,se){var ie=se("nVVt"),Q=se("dWSS"),R=se("dQei"),Y={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},U={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(_){for(var j=_<<10;U.getBCHDigit(j)-U.getBCHDigit(U.G15)>=0;)j^=U.G15<<U.getBCHDigit(j)-U.getBCHDigit(U.G15);return(_<<10|j)^U.G15_MASK},getBCHTypeNumber:function(_){for(var j=_<<12;U.getBCHDigit(j)-U.getBCHDigit(U.G18)>=0;)j^=U.G18<<U.getBCHDigit(j)-U.getBCHDigit(U.G18);return _<<12|j},getBCHDigit:function(_){for(var j=0;_!=0;)j++,_>>>=1;return j},getPatternPosition:function(_){return U.PATTERN_POSITION_TABLE[_-1]},getMask:function(_,j,B){switch(_){case Y.PATTERN000:return(j+B)%2==0;case Y.PATTERN001:return j%2==0;case Y.PATTERN010:return B%3==0;case Y.PATTERN011:return(j+B)%3==0;case Y.PATTERN100:return(Math.floor(j/2)+Math.floor(B/3))%2==0;case Y.PATTERN101:return j*B%2+j*B%3==0;case Y.PATTERN110:return(j*B%2+j*B%3)%2==0;case Y.PATTERN111:return(j*B%3+(j+B)%2)%2==0;default:throw new Error("bad maskPattern:"+_)}},getErrorCorrectPolynomial:function(_){for(var j=new Q([1],0),B=0;B<_;B++)j=j.multiply(new Q([1,R.gexp(B)],0));return j},getLengthInBits:function(_,j){if(1<=j&&j<10)switch(_){case ie.MODE_NUMBER:return 10;case ie.MODE_ALPHA_NUM:return 9;case ie.MODE_8BIT_BYTE:return 8;case ie.MODE_KANJI:return 8;default:throw new Error("mode:"+_)}else if(j<27)switch(_){case ie.MODE_NUMBER:return 12;case ie.MODE_ALPHA_NUM:return 11;case ie.MODE_8BIT_BYTE:return 16;case ie.MODE_KANJI:return 10;default:throw new Error("mode:"+_)}else if(j<41)switch(_){case ie.MODE_NUMBER:return 14;case ie.MODE_ALPHA_NUM:return 13;case ie.MODE_8BIT_BYTE:return 16;case ie.MODE_KANJI:return 12;default:throw new Error("mode:"+_)}else throw new Error("type:"+j)},getLostPoint:function(_){for(var j=_.getModuleCount(),B=0,P=0;P<j;P++)for(var A=0;A<j;A++){for(var p=0,b=_.isDark(P,A),M=-1;M<=1;M++){if(P+M<0||j<=P+M)continue;for(var L=-1;L<=1;L++){if(A+L<0||j<=A+L)continue;if(M==0&&L==0)continue;b==_.isDark(P+M,A+L)&&p++}}p>5&&(B+=3+p-5)}for(var P=0;P<j-1;P++)for(var A=0;A<j-1;A++){var C=0;_.isDark(P,A)&&C++,_.isDark(P+1,A)&&C++,_.isDark(P,A+1)&&C++,_.isDark(P+1,A+1)&&C++,(C==0||C==4)&&(B+=3)}for(var P=0;P<j;P++)for(var A=0;A<j-6;A++)_.isDark(P,A)&&!_.isDark(P,A+1)&&_.isDark(P,A+2)&&_.isDark(P,A+3)&&_.isDark(P,A+4)&&!_.isDark(P,A+5)&&_.isDark(P,A+6)&&(B+=40);for(var A=0;A<j;A++)for(var P=0;P<j-6;P++)_.isDark(P,A)&&!_.isDark(P+1,A)&&_.isDark(P+2,A)&&_.isDark(P+3,A)&&_.isDark(P+4,A)&&!_.isDark(P+5,A)&&_.isDark(P+6,A)&&(B+=40);for(var E=0,A=0;A<j;A++)for(var P=0;P<j;P++)_.isDark(P,A)&&E++;var h=Math.abs(100*E/j/j-50)/5;return B+=h*10,B}};ht.exports=U},LdHM:function(ht,qe,se){"use strict";se.d(qe,"b",function(){return d}),se.d(qe,"a",function(){return f});var ie=se("1OyB"),Q=se("vuIU"),R=se("Ji7U"),Y=se("LK+K"),U=se("q1tI"),_=se("rePB"),j=se("Ff2n"),B=se("ODXe"),P=se("4IlW"),A=se("bX4T"),p=se("YrtM"),b=se("TSYQ"),M=se.n(b),L=se("+nKL"),C=se("8OUc"),E=function(X,q){var ae=X.prefixCls,de=X.id,Ae=X.flattenOptions,be=X.childrenAsData,Ce=X.values,Te=X.searchValue,Se=X.multiple,pe=X.defaultActiveFirstOption,ue=X.height,te=X.itemHeight,fe=X.notFoundContent,oe=X.open,Le=X.menuItemSelectedIcon,_e=X.virtual,Ee=X.onSelect,Pe=X.onToggleOpen,Be=X.onActiveValue,Ve=X.onScroll,We=X.onMouseEnter,Fe="".concat(ae,"-item"),Ue=Object(p.a)(function(){return Ae},[oe,Ae],function(He,xe){return xe[0]&&He[1]!==xe[1]}),st=U.useRef(null),ot=function(xe){xe.preventDefault()},it=function(xe){st.current&&st.current.scrollTo({index:xe})},Je=function(xe){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Ue.length,re=0;re<ye;re+=1){var ne=(xe+re*me+ye)%ye,le=Ue[ne],he=le.group,ke=le.data;if(!he&&!ke.disabled)return ne}return-1},rt=U.useState(function(){return Je(0)}),$e=Object(B.a)(rt,2),Ze=$e[0],Oe=$e[1],ut=function(xe){Oe(xe);var me=Ue[xe];if(!me){Be(null,-1);return}Be(me.data.value,xe)};U.useEffect(function(){ut(pe!==!1?Je(0):-1)},[Ue.length,Te]),U.useEffect(function(){var He=setTimeout(function(){if(!Se&&oe&&Ce.size===1){var xe=Array.from(Ce)[0],me=Ue.findIndex(function(ye){var re=ye.data;return re.value===xe});ut(me),it(me)}});return function(){return clearTimeout(He)}},[oe]);var at=function(xe){xe!==void 0&&Ee(xe,{selected:!Ce.has(xe)}),Se||Pe(!1)};if(U.useImperativeHandle(q,function(){return{onKeyDown:function(xe){var me=xe.which;switch(me){case P.a.UP:case P.a.DOWN:{var ye=0;if(me===P.a.UP?ye=-1:me===P.a.DOWN&&(ye=1),ye!==0){var re=Je(Ze+ye,ye);it(re),ut(re)}break}case P.a.ENTER:{var ne=Ue[Ze];ne&&!ne.data.disabled?at(ne.data.value):at(void 0),oe&&xe.preventDefault();break}case P.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(xe){it(xe)}}}),Ue.length===0)return U.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(Fe,"-empty"),onMouseDown:ot},fe);function Ie(He){var xe=Ue[He];if(!xe)return null;var me=xe.data||{},ye=me.value,re=me.label,ne=me.children,le=Object(A.a)(me,!0),he=be?ne:re;return xe?U.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},le,{key:He,role:"option",id:"".concat(de,"_list_").concat(He),"aria-selected":Ce.has(ye)}),ye):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ie(Ze-1),Ie(Ze),Ie(Ze+1)),U.createElement(L.a,{itemKey:"key",ref:st,data:Ue,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:ot,onScroll:Ve,virtual:_e,onMouseEnter:We},function(He,xe){var me,ye=He.group,re=He.groupOption,ne=He.data,le=ne.label,he=ne.key;if(ye)return U.createElement("div",{className:M()(Fe,"".concat(Fe,"-group"))},le!==void 0?le:he);var ke=ne.disabled,Me=ne.value,Ye=ne.title,yt=ne.children,At=ne.style,ze=ne.className,xt=Object(j.a)(ne,["disabled","value","title","children","style","className"]),mt=Ce.has(Me),nt="".concat(Fe,"-option"),_t=M()(Fe,nt,ze,(me={},Object(_.a)(me,"".concat(nt,"-grouped"),re),Object(_.a)(me,"".concat(nt,"-active"),Ze===xe&&!ke),Object(_.a)(me,"".concat(nt,"-disabled"),ke),Object(_.a)(me,"".concat(nt,"-selected"),mt),me)),kt=be?yt:le,Kt=!Le||typeof Le=="function"||mt;return U.createElement("div",Object.assign({},xt,{"aria-selected":mt,className:_t,title:Ye,onMouseMove:function(){if(Ze===xe||ke)return;ut(xe)},onClick:function(){ke||at(Me)},style:At}),U.createElement("div",{className:"".concat(nt,"-content")},kt||Me),U.isValidElement(Le)||mt,Kt&&U.createElement(C.a,{className:"".concat(Fe,"-option-state"),customizeIcon:Le,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},h=U.forwardRef(E);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var d=l,w=function(){return null};w.isSelectOptGroup=!0;var f=w,y=se("VTBJ"),D=se("Zm9Q");function T(N){var X=N.key,q=N.props,ae=q.children,de=q.value,Ae=Object(j.a)(q,["children","value"]);return Object(y.a)({key:X,value:de!==void 0?de:X,children:ae},Ae)}function g(N){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(N).map(function(q,ae){if(!U.isValidElement(q)||!q.type)return null;var de=q.type.isSelectOptGroup,Ae=q.key,be=q.props,Ce=be.children,Te=Object(j.a)(be,["children"]);return X||!de?T(q):Object(y.a)(Object(y.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?ae:Ae,"__"),label:Ae},Te),{},{options:g(Ce)})}).filter(function(q){return q})}var c=se("2Qr1"),u=se("qNPg"),a=se("U8pU"),S=se("Kwbf"),x=se("WKfj");function v(N){var X=N.mode,q=N.options,ae=N.children,de=N.backfill,Ae=N.allowClear,be=N.placeholder,Ce=N.getInputElement,Te=N.showSearch,Se=N.onSearch,pe=N.defaultOpen,ue=N.autoFocus,te=N.labelInValue,fe=N.value,oe=N.inputValue,Le=N.optionLabelProp,_e=X==="multiple"||X==="tags",Ee=Te!==void 0?Te:_e||X==="combobox",Pe=q||g(ae);if(Object(S.a)(X!=="tags"||Pe.every(function(Fe){return!Fe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Be=Pe.some(function(Fe){return Fe.options?Fe.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Fe?Fe.value:Fe.key)=="number"});Object(S.a)(!Be,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(S.a)(X!=="combobox"||!Le,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(S.a)(X==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(S.a)(X==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(S.b)(X!=="combobox"||!Ce||!Ae||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!Ee&&X!=="combobox"&&X!=="tags"&&Object(S.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(S.b)(!pe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),fe!=null){var Ve=Object(x.d)(fe);Object(S.a)(!te||Ve.every(function(Fe){return Object(a.a)(Fe)==="object"&&("key"in Fe||"value"in Fe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(S.a)(!_e||Array.isArray(fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var We=null;Object(D.a)(ae).some(function(Fe){if(!U.isValidElement(Fe)||!Fe.type)return!1;var Ue=Fe.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var st=Object(D.a)(Fe.props.children).every(function(ot){return!U.isValidElement(ot)||!Fe.type||ot.type.isSelectOption?!0:(We=ot.type,!1)});return!st}return We=Ue,!0}),We&&Object(S.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(S.a)(oe===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var O=v,F=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:O,fillOptionsWithMissingValue:c.a}),W=function(N){Object(R.a)(q,N);var X=Object(Y.a)(q);function q(){var ae;return Object(ie.a)(this,q),ae=X.apply(this,arguments),ae.selectRef=U.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(Q.a)(q,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),q}(U.Component);W.Option=d,W.OptGroup=f;var V=W,I=qe.c=V},M8RZ:function(ht,qe,se){"use strict";se.d(qe,"a",function(){return P});var ie=se("fWQN"),Q=se("mtLc"),R=se("yKVA"),Y=se("879j"),U=se("q1tI"),_=se.n(U),j=se("i8i4"),B=se.n(j),P=function(A){Object(R.a)(b,A);var p=Object(Y.a)(b);function b(M){var L;Object(ie.a)(this,b),L=p.call(this,M);var C=window.document;return L.node=C.createElement("div"),C.body.appendChild(L.node),L}return Object(Q.a)(b,[{key:"render",value:function(){var L=this.props.children;return Object(j.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(_.a.Component)},Ot1p:function(ht,qe,se){"use strict";var ie=se("2qtc"),Q=se("kLXV"),R=se("rAM+"),Y=se("miYZ"),U=se("tsqr"),_=se("9og8"),j=se("tJVT"),B=se("jrin"),P=se("WmNS"),A=se.n(P),p=se("q1tI"),b=se.n(p),M=se("VrN/"),L=se.n(M),C=se("bdgK"),E=se("p77/"),h=se("Bd2K"),o=se("ELLl"),l=se("19Vz"),d=se("lZu9"),w=se("+NIl"),f=se("kSUc"),y=se("9Bee"),D=function(ze){var xt=ze.value,mt=xt===void 0?"":xt,nt=ze.className,_t=ze.showTextOnly,kt=ze.showLines,Kt=ze.style,Bt=Kt===void 0?{}:Kt,wt=Object(p.useMemo)(function(){return""},[mt]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:wt}}))},T=se("Q9mQ"),g=se("diRs"),c=se("0Owb"),u=se("dejd"),a=se("C+DQ"),S=se("D1Df"),x=se.n(S),v=se("1vsH"),O=se("m3rI"),F=[{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 W(ze){var xt=ze.onActionCallback,mt=ze.title,nt=ze.icon,_t=ze.actionName,kt=ze.className,Kt=kt===void 0?"":kt,Bt=ze.children;function wt(){xt(_t)}return b.a.createElement("a",{title:mt,className:Kt,onClick:wt},b.a.createElement("i",{className:"md-iconfont ".concat(nt)}),Bt)}var V=function(ze){var xt=ze.watch,mt=ze.showNullButton,nt=ze.onActionCallback,_t=ze.fullScreen,kt=ze.insertTemp,Kt=ze.hidetoolBar,Bt=ze.uuid,wt=ze.setOpenPhones,pr=Object(v.E)("_educoder_session_login"),or=Object(v.E)("_educoder_session"),gt=[].concat(F,[{title:"".concat(xt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(xt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!Kt&>.map(function(Sr,sr){return b.a.createElement("li",{key:sr},Sr.actionName?b.a.createElement(W,Object(c.a)({},Sr,{onActionCallback:nt})):b.a.createElement("span",{className:"v-line"}))}),mt?b.a.createElement("li",null,b.a.createElement(W,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:nt},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,kt&&b.a.createElement("li",null,b.a.createElement(W,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(kt),onActionCallback:nt},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(g.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement("span",{style:{display:"none"}},"test----",location.origin+"/upload.html?_educoder_session_login="+pr+"&_educoder_session="+or+"&key="+Bt+"&api="+encodeURIComponent(O.a.API_SERVER)),b.a.createElement(x.a,{size:150,fgColor:"#000",value:location.origin+"/upload.html?_educoder_session_login="+pr+"&_educoder_session="+or+"&key="+Bt+"&api="+encodeURIComponent(O.a.API_SERVER)}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return wt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(W,{icon:"".concat(_t?"icon-shrink":"icon-enlarge"),title:_t?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:nt})))},I=se("M8RZ"),N=se("+L6B"),X=se("2/Rp"),q=se("y8nQ"),ae=se("Vl3Y"),de=se("5NDa"),Ae=se("5rEg"),be={labelCol:{span:4},wrapperCol:{span:20}},Ce=function(ze){var xt=ze.callback,mt=ze.onCancel;function nt(_t){xt(_t)}return b.a.createElement(ae.a,Object(c.a)({},be,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:nt}),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(Ae.a,null)),b.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(Ae.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},Te=se("7ahc"),Se=se("k1fw"),pe=se("HmJG"),ue=se("BjJ7"),te=ae.a.useForm,fe={width:280,marginRight:10},oe={labelCol:{span:5},wrapperCol:{span:19}},Le=function(ze){var xt=ze.callback,mt=ze.onCancel,nt=te(),_t=Object(j.a)(nt,1),kt=_t[0],Kt=Object(p.useRef)();function Bt(or){xt(Object(Se.a)(Object(Se.a)({},or),{},{name:Kt.current}))}function wt(or,gt){kt.setFieldsValue({src:"/api/attachments/".concat(or.id,"?type=").concat(or.content_type),type:gt.type})}function pr(or){var gt=or.target.files[0];Kt.current=gt.name,Ee(gt,wt)}return b.a.createElement(ae.a,Object(c.a)({form:kt},oe,{className:"upload-image-panel",onFinish:Bt}),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(Ae.a,{style:fe})),b.a.createElement(_e,{onFileChange:pr}))),b.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},b.a.createElement(Ae.a,{style:{width:264}})),b.a.createElement(ae.a.Item,{style:{textAlign:"right"}},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))};function _e(ze){var xt=ze.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:xt}))}function Ee(ze,xt){if(!ze)throw new String("\u6CA1\u6709\u6587\u4EF6");var mt=new FormData;mt.append("editormd-image-file",ze),mt.append("file_param_name","editormd-image-file"),mt.append("byxhr","true");var nt=new window.XMLHttpRequest;nt.withCredentials=!0,nt.addEventListener("load",function(_t){xt(JSON.parse(_t.target.responseText),ze)},!1),nt.addEventListener("error",function(_t){console.error(_t)},!1),nt.open("POST","".concat(ue.a,"/api/attachments.json")),nt.send(mt)}var Pe=se("giR+"),Be=se("fyUT"),Ve=se("7Kak"),We=se("9yH6"),Fe=We.a.Group,Ue={margin:"0 8px"},st=function(ze){var xt=ze.callback,mt=ze.onCancel;function nt(_t){xt(_t)}return b.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:nt},b.a.createElement("div",{className:"flex-container"},b.a.createElement("span",{style:Ue},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:Ue},"\u884C\u6570"),b.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(Be.a,null)),b.a.createElement("span",{style:Ue},"\u5217\u6570"),b.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(Be.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12}},b.a.createElement("span",{style:Ue},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(ae.a.Item,{name:"align"},b.a.createElement(Fe,null,b.a.createElement(We.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(We.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(We.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(We.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},ot=se("ErOA"),it=se("7Cbv"),Je="link",rt="upload-image",$e="code-block",Ze="add-table",Oe="------------",ut={default:Oe,left:":".concat(Oe),center:":".concat(Oe,":"),right:"".concat(Oe,":")},at=se("9VGf"),Ie,He;function xe(){}var me=0,ye=1e4,re="\u2581",ne=`
|
|
**\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 le(ze){return/^\d+$/.test(ze)?"".concat(ze,"px"):ze}var he=navigator.platform.toUpperCase().indexOf("MAC")>=0,ke=he?"Cmd":"Ctrl",Me=["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"],Ye=(Ie={},Object(B.a)(Ie,ke+"-B","bold"),Object(B.a)(Ie,ke+"-I","italic"),Ie),yt=(He={},Object(B.a)(He,Je,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(He,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(He,rt,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(He,Ze,"\u6DFB\u52A0\u8868\u683C"),He),At=qe.a=function(ze){var xt=ze.defaultValue,mt=xt===void 0?"":xt,nt=ze.onChange,_t=ze.width,kt=_t===void 0?"100%":_t,Kt=ze.height,Bt=Kt===void 0?400:Kt,wt=ze.miniToolbar,pr=wt===void 0?!1:wt,or=ze.isFocus,gt=or===void 0?!1:or,Sr=ze.watch,sr=ze.insertTemp,mr=ze.mode,wr=mr===void 0?"markdown":mr,si=ze.id,Kr=si===void 0?"markdown-editor-id":si,It=ze.showResizeBar,ft=It===void 0?!1:It,Ur=ze.noStorage,li=Ur===void 0?!1:Ur,Ar=ze.showNullButton,Ot=Ar===void 0?!1:Ar,Vr=ze.hidetoolBar,ui=Vr===void 0?!1:Vr,gi=ze.fullScreen,Xe=gi===void 0?!1:gi,St=ze.onBlur,ei=ze.onCMBeforeChange,hi=ze.onFullScreen,di=ze.className,Ri=di===void 0?"":di,K=ze.disablePaste,s=K===void 0?!1:K,m=ze.placeholder,G=m===void 0?"":m,Z=ze.values,z=Z===void 0?"":Z,ve=Object(p.useState)(null),je=Object(j.a)(ve,2),Re=je[0],ct=je[1],Ge=Object(p.useState)(mt),Ct=Object(j.a)(Ge,2),Mt=Ct[0],Wt=Ct[1],jr=Object(p.useState)(Sr),Wr=Object(j.a)(jr,2),lr=Wr[0],Xr=Wr[1],Ki=Object(p.useState)(Xe),Lr=Object(j.a)(Ki,2),kr=Lr[0],ti=Lr[1],vi=Object(p.useState)(""),$r=Object(j.a)(vi,2),ri=$r[0],Hr=$r[1],fn=Object(p.useState)(0),Vi=Object(j.a)(fn,2),Mr=Vi[0],Ir=Vi[1],_i=Object(p.useState)(Bt),Oi=Object(j.a)(_i,2),Pi=Oi[0],qt=Oi[1],Ft=Object(p.useState)(!1),gr=Object(j.a)(Ft,2),Ut=gr[0],vr=gr[1],Xt=Object(p.useRef)(Object(it.a)()),yi=Object(p.useRef)(!1),ir=Object(p.useRef)(),nr=Object(p.useRef)(),ii=Object(p.useRef)(),bi=Object(p.useRef)(),xi=Object(p.useRef)(),Un=function(){var pt=Object(_.a)(A.a.mark(function Tt(){var bt,Dt;return A.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(ot.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Xt.current}});case 2:Dt=Ht.sent,Dt!=null&&(bt=Dt.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",Re,nr),Dt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?Re.replaceSelection(".concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?Re.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?Re.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):Re.replaceSelection("[".concat(Pt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return pt.apply(this,arguments)}}();Object(p.useEffect)(function(){Wt(z),Re==null||Re.setValue(z)},[z]),Object(p.useEffect)(function(){hi==null||hi(kr)},[kr]),Object(p.useEffect)(function(){if(nr.current){var pt=L.a.fromTextArea(nr.current,{mode:wr,lineNumbers:!pr,lineWrapping:!0,value:mt,autoCloseTags:!0,autoCloseBrackets:!0});gt&&pt.focus();function Tt(bt,Dt){if(s){Dt.preventDefault();return}var Nt=Dt.clipboardData;if(Nt){var Ht=Nt.types.toString(),Pt=Nt.items;if(Ht==="Files"||Nt.types.indexOf("Files")>-1){if(Dt.preventDefault(),wr=="stex")return;try{var Qt,ur=Pt[1];((Qt=Pt[0])===null||Qt===void 0?void 0:Qt.kind)==="file"&&(ur=Pt[0]);var Rt=ur.getAsFile(),Mi=Rt.name.split(".").pop();Ee(Rt,function(Gt){if(Gt.id){var yr,Vt,Yr;(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("image"))>-1?pt.replaceSelection(".concat(Gt.content_type,")")):(Rt==null||((Vt=Rt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Rt==null||((Yr=Rt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):pt.replaceSelection("[".concat(Rt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return pt.on("paste",Tt),pt.on("dragleave",function(bt,Dt){ii.current.classList.remove("mouse-hover-md")}),pt.on("dragover",function(bt,Dt){ii.current.classList.add("mouse-hover-md")}),pt.on("drop",function(bt,Dt){ii.current.classList.add("mouse-hover-md");var Nt;if(Nt=Dt.dataTransfer.files,Nt.length>0){Dt.preventDefault(),Dt.stopPropagation();for(var Ht=function(ur){var Rt=Nt[ur],Mi=Rt.name.split(".").pop();Ee(Rt,function(Gt){if(Gt.id){var yr,Vt,Yr;(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("image"))>-1?pt.replaceSelection(".concat(Gt.content_type,")")):(Rt==null||((Vt=Rt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,'"></video>')):(Rt==null||((Yr=Rt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):pt.replaceSelection("[".concat(Rt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Nt.length;Pt++)Ht(Pt)}}),ct(pt),function(){pt.off("paste",Tt)}}},[]);var Qr=Object(p.useCallback)(function(){if(ii.current)try{}catch(pt){console.log(pt,"---- to set md editor body height")}},[Pi,ii,kr]);Object(p.useEffect)(function(){function pt(){var bt=new C.default(function(Dt){var Nt=Object(R.a)(Dt),Ht;try{for(Nt.s();!(Ht=Nt.n()).done;){var Pt=Ht.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(Qr(),Re.setSize("100%","100%"),Re.refresh())}}catch(Qt){Nt.e(Qt)}finally{Nt.f()}});return bt.observe(nr.current.parentElement),bt}if(Re){var Tt=pt();return function(){Tt.unobserve(nr.current.parentElement)}}},[Re,Qr]),Object(p.useEffect)(function(){if(Re){for(var pt=[],Tt=function(){var Pt=Dt[bt];Nt=Object(j.a)(Pt,2);var Qt=Nt[0],ur=Nt[1],Rt=Object(B.a)({},Qt,function(){Xi(ur)});pt.push(Rt),Re.addKeyMap(Rt)},bt=0,Dt=Object.entries(Ye);bt<Dt.length;bt++){var Nt;Tt()}return ir.current=setInterval(function(){yi.current&&Un()},4e3),function(){clearInterval(ir.current);var Ht=Object(R.a)(pt),Pt;try{for(Ht.s();!(Pt=Ht.n()).done;){var Qt=Pt.value;Re.removeKeyMap(Qt)}}catch(ur){Ht.e(ur)}finally{Ht.f()}}}},[Re]),Object(p.useEffect)(function(){Xe!==kr&&ti(Xe)},[Xe]),Object(at.a)(function(){if(!li&&Mr>0){var pt=new Date().getTime(),Tt=window.sessionStorage.getItem(Kr);pt>=Mr+ye&&(!Tt||Tt!==Mt)&&(window.sessionStorage.setItem(Kr,Mt),vr(!0))}},ye),Object(p.useEffect)(function(){Xr(Sr)},[Re,Sr]),Object(p.useEffect)(function(){Re&&(gt&&Re.focus())},[Re,gt]),Object(p.useEffect)(function(){if(lr&&Re){var pt=Re.getScrollerElement();function Tt(bt){var Dt=bt.target;if(xi.current){var Nt=Dt.scrollTop/Dt.scrollHeight;xi.current.scrollTop=xi.current.scrollHeight*Nt}}return pt.addEventListener("scroll",Tt),function(){pt.removeEventListener("scroll",Tt)}}},[Re,lr]),Object(p.useEffect)(function(){if(Re&&ei){function pt(Tt,bt){ei(Tt,bt)}return Re.on("beforeChange",pt),function(){Re.off("beforeChange",pt)}}},[Re,ei]),Object(p.useEffect)(function(){if(Re&&St){function pt(){St(Re.getValue())}return Re.on("blur",pt),function(){Re.off("blur",pt)}}},[Re,St]),Object(p.useEffect)(function(){if(Re){function pt(Tt){var bt=Tt.getValue();Wt(bt),Ir(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),nt&&nt(bt)}return Re.on("change",pt),function(){Re.off("change",pt)}}},[Re,nt]),Object(p.useEffect)(function(){Re&&(mt==null?(Re.setValue(""),Wt("")):mt!==Re.getValue()&&(Re.setValue(mt),Wt(mt),Re.setCursor(Re.lineCount(),0)))},[Re,mt]);var Xi=Object(p.useCallback)(function(pt){var Tt=Re.getCursor(),bt=Re.getSelection(),Dt=bt.split(`
|
|
`);switch(pt){case"bold":return Re.replaceSelection("**"+bt+"**"),bt===""&&Re.setCursor(Tt.line,Tt.ch+2),Re.focus();case"italic":return Re.replaceSelection("*"+bt+"*"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"code":return Re.replaceSelection("`"+bt+"`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"inline-latex":return Re.replaceSelection("`$$"+bt+"$$`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+3),Re.focus();case"latex":return Re.replaceSelection("```latex\n"+bt+"\n```"),Re.setCursor(Tt.line+1,bt.length+1),Re.focus();case"line-break":return Re.replaceSelection(`<br/>
|
|
`),Re.focus();case"list-ul":return bt===""?Re.replaceSelection("- "+bt):Re.replaceSelection(Dt.map(function(Nt){return Nt===""?"":"- ".concat(Nt)}).join(`
|
|
`)),Re.focus();case"list-ol":return bt===""?Re.replaceSelection("1. "+bt):Re.replaceSelection(Dt.map(function(Nt,Ht){return Nt===""?"":"".concat(Ht+1,". ").concat(Nt)}).join(`
|
|
`)),Re.focus();case"add-null-ch":return bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.replaceSelection(re),Re.focus();case"inster-template-1":return bt===""&&Re.setCursor(Tt.line,Tt.ch),Re.replaceSelection(ne),Re.focus();case"eraser":return Re.setValue(""),Re.focus();case"trigger-watch":return Xr(!lr),Re.focus();case"trigger-full-screen":return ti(!kr),Re.focus();case Je:Hr(Je);return;case $e:Hr($e);return;case rt:Hr(rt);return;case Ze:Hr(Ze);return;default:throw new Error}},[Re,lr,kr]),Nr=Object(p.useCallback)(function(pt){Hr("");switch(ri){case Je:var Tt=pt.title,bt=pt.link;return Re.replaceSelection("[".concat(Tt,"](").concat(bt,")")),Re.focus();case $e:var Dt=pt.language,Nt=pt.content;return Re.replaceSelection(["```"+Dt,Nt,"```"].join(`
|
|
`)),Re.focus();case rt:var Ht=pt.src,Pt=pt.alt,Qt=pt.name;return Ht.indexOf("type=image")>-1?Re.replaceSelection(".concat(Ht,' "').concat(Pt||"",'" )')):Ht.indexOf("type=application/pdf")>-1?Re.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(Qt,"</a>")):Re.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(Qt,"</a>")),Re.focus();case Ze:for(var ur=pt.row,Rt=pt.col,Mi=pt.align,Gt=`
|
|
`,yr=0;yr<ur;yr++){for(var Vt=[],Yr=[],pn=0;pn<Rt;pn++)yr===1&&Yr.push(ut[Mi]),Vt.push(" ");yr===1&&(Gt+="| ".concat(Yr.join(" | "),` |
|
|
`)),Gt+="| ".concat(Vt.join(Rt===1?"":" | "),` |
|
|
`)}return Re.replaceSelection(Gt+`
|
|
`),Re.focus();default:throw new Error}},[Re,ri]),Yi=Object(p.useMemo)(function(){switch(ri){case Je:return b.a.createElement(Ce,{callback:Nr,onCancel:ci});case $e:return b.a.createElement(Te.b,{callback:Nr,onCancel:ci});case rt:return b.a.createElement(Le,{callback:Nr,onCancel:ci});case Ze:return b.a.createElement(st,{callback:Nr,onCancel:ci});default:return null}},[ri]);function ci(){Hr("")}Object(p.useEffect)(function(){if(bi.current){var pt=bi.current,Tt=!1,bt=0;function Dt(Pt){Tt=!0,bt=Pt.pageY}function Nt(){Tt=!1}function Ht(Pt){if(Tt){var Qt=Pt.pageY-bt;Qt<0&&(Qt=0),Qt>300&&(Qt=300);var ur=Bt+Qt+"px";qt(ur)}}return pt.addEventListener("mousedown",Dt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Nt),function(){pt.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Nt)}}},[Re,bi]),Object(p.useEffect)(function(){qt(Bt)},[Bt]);var Ei=le(kt),ua=le(Pi),ha={width:Ei,height:ua},Qa=Object(p.useMemo)(function(){if(Mr){var pt=new Date(Mr),Tt=pt.getHours(),bt=pt.getMinutes(),Dt=pt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,bt=bt<10?"0"+bt:bt,Dt=Dt<10?"0"+Dt:Dt,"".concat(Tt,":").concat(bt,":").concat(Dt)}return 0},[Mr]);function Ja(){window.sessionStorage.removeItem(Kr),vr(!1),Ir(0)}function da(){vr(!1),Ir(0),Re.setValue(window.sessionStorage.getItem(Kr))}function jn(pt,Tt){var bt=Re.getValue();bt=bt.replace(pt,Tt),Wt(bt),Re==null||Re.setValue(bt)}return b.a.createElement(p.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:ii},b.a.createElement("div",{className:"markdown-editor-container ".concat(Ri," ").concat(lr?"on-preview":""," ").concat(pr?"mini":""," ").concat(kr?"full-screen":""),style:ha},b.a.createElement(V,{insertTemp:sr,watch:lr,fullScreen:kr,showNullButton:Ot,onActionCallback:Xi,hidetoolBar:ui,uuid:Xt.current,setOpenPhones:function(){yi.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:nr,placeholder:G})),lr?b.a.createElement("div",{ref:xi,className:"preview-container"},wr==="stex"&&b.a.createElement(D,{value:Mt}),wr!=="stex"&&b.a.createElement(y.a,{edit:!0,value:Mt,replaces:jn})):null))),ft?b.a.createElement("a",{ref:bi,className:"editor-resize"}):null,b.a.createElement(I.a,null,yt[ri]?b.a.createElement(Q.a,{centered:!0,title:yt[ri],visible:!0,onCancel:ci,footer:null},Yi):null))}},R7cW:function(ht,qe,se){"use strict";se.r(qe);var ie=se("+L6B"),Q=se("2/Rp"),R=se("DZo9"),Y=se("8z0m"),U=se("0Owb"),_=se("5NDa"),j=se("5rEg"),B=se("sPJy"),P=se("bE4q"),A=se("k1fw"),p=se("oBTY"),b=se("9og8"),M=se("miYZ"),L=se("tsqr"),C=se("y8nQ"),E=se("Vl3Y"),h=se("tJVT"),o=se("WmNS"),l=se.n(o),d=se("q1tI"),w=se.n(d),f=se("Ty5D"),y=se("9kvl"),D=se("55Ip"),T=se("Ot1p"),g=se("XYT7"),c=se("m3rI"),u=se("YiJy"),a=se.n(u),S=function(v){var O,F=v.shixunHomeworks,W=v.newCourse,V=v.globalSetting,I=v.loading,N=v.dispatch,X=v.match,q=Object(f.i)(),ae=E.a.useForm(),de=Object(h.a)(ae,1),Ae=de[0],be=Object(d.useState)({}),Ce=Object(h.a)(be,2),Te=Ce[0],Se=Ce[1],pe=Object(d.useState)(!1),ue=Object(h.a)(pe,2),te=ue[0],fe=ue[1],oe=Object(d.useState)([]),Le=Object(h.a)(oe,2),_e=Le[0],Ee=Le[1],Pe=Object(d.useState)([]),Be=Object(h.a)(Pe,2),Ve=Be[0],We=Be[1],Fe=F.commonHomeWorkEditDefaultData,Ue={name:"file",multiple:!0,action:c.a.API_SERVER+"/api/attachments.json",defaultFileList:_e,onChange:function(rt){var $e=rt.file.status;$e!=="uploading",$e==="done"?L.b.success("".concat(rt.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):$e==="error"&&L.b.error("".concat(rt.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(d.useEffect)(function(){ot()},[q.topicId]);var st=function(rt){return rt==null?void 0:rt.map(function($e){return{uid:$e.id,response:{id:$e.id},name:$e.title,status:"done",url:$e.url}})},ot=function(){var Je=Object(b.a)(l.a.mark(function rt(){var $e;return l.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:return Oe.next=2,N({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:q.topicId}});case 2:$e=Oe.sent,$e&&(Ae.setFieldsValue({name:$e.name}),Ae.setFieldsValue({description:$e.description}),Ae.setFieldsValue({reference_answer:$e.reference_answer}),Ee(Object(p.a)(st($e.attachments))),We(Object(p.a)(st($e.reference_attachments))),fe(!0));case 4:case"end":return Oe.stop()}},rt)}));return function(){return Je.apply(this,arguments)}}(),it=function(){var Je=Object(b.a)(l.a.mark(function rt($e){var Ze,Oe,ut,at;return l.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return Ze=Object(A.a)({},Te),Ze.attachment_ids&&(Ze.attachment_ids=Ze==null||((Oe=Ze.attachment_ids.fileList)===null||Oe===void 0)?void 0:Oe.map(function(xe){var me;return(me=xe.response)===null||me===void 0?void 0:me.id})),Ze.reference_attachment_ids&&(Ze.reference_attachment_ids=Ze==null||((ut=Ze.reference_attachment_ids.fileList)===null||ut===void 0)?void 0:ut.map(function(xe){var me;return(me=xe.response)===null||me===void 0?void 0:me.id})),He.next=5,Object(g.n)(Object(A.a)(Object(A.a)({id:q.topicId},Ze),{},{base_on_project:null,type:1}));case 5:at=He.sent,at&&y.d.push("/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail"));case 7:case"end":return He.stop()}},rt)}));return function($e){return Je.apply(this,arguments)}}();return w.a.createElement("section",{className:a.a.bg},w.a.createElement("section",{className:"animated fadeIn"},w.a.createElement("aside",{className:"mt10"},w.a.createElement(P.a,{separator:">"},w.a.createElement(P.a.Item,null,w.a.createElement(D.a,{to:"/users/".concat(q.username,"/").concat(q.topictype==="personal"?"topics":"topicbank","/").concat(q.topictype)},q.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),w.a.createElement(P.a.Item,null,w.a.createElement(D.a,{to:"/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail")},"\u8BE6\u60C5")),w.a.createElement(P.a.Item,null,"\u7F16\u8F91")))),w.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),w.a.createElement(E.a,{form:Ae,className:a.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){Se(Object(A.a)({},Ae.getFieldsValue()))},onFinish:it},w.a.createElement("div",{className:a.a.fieldWrap},w.a.createElement(E.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},w.a.createElement(j.a,{maxLength:60,suffix:"".concat(((O=Te.name)===null||O===void 0?void 0:O.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),w.a.createElement("div",{className:a.a.mdWrap},w.a.createElement(E.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},w.a.createElement(T.a,{id:"topic-normal-description",watch:!0,defaultValue:Fe.description})),w.a.createElement("div",null,w.a.createElement(E.a.Item,{name:"attachment_ids"},te&&w.a.createElement(Y.a,Object(U.a)({defaultFileList:_e},Ue),w.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),w.a.createElement("div",{className:a.a.mdWrap},w.a.createElement(E.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},w.a.createElement(T.a,{id:"topic-normal-reference_answer",defaultValue:Fe.reference_answer,watch:!0})),w.a.createElement("div",null,w.a.createElement(E.a.Item,{name:"reference_attachment_ids"},te&&w.a.createElement(Y.a,Object(U.a)({},Ue,{defaultFileList:Ve}),w.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),w.a.createElement("div",{className:a.a.backgroundFa},w.a.createElement("div",{className:"pt40 mb30"},w.a.createElement(E.a.Item,null,w.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(a.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),w.a.createElement(Q.a,{size:"large",type:"primary",ghost:!0,className:a.a.button,onClick:function(){return y.d.push("/users/".concat(q.username,"/topics/").concat(q.topicId,"/").concat(q.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};qe.default=Object(y.a)(function(x){var v=x.shixunHomeworks,O=x.newCourse,F=x.loading,W=x.globalSetting;return{shixunHomeworks:v,newCourse:O,globalSetting:W,loading:F.effects}})(S)},SJMd:function(ht,qe){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var se,ie,Q,R=!1,Y,U;window.PR_SHOULD_USE_CONTINUATION=!0;var _,j;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],A=[P,"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"],p=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[p,"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=[p,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[p,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],C="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",E=[p,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[P,"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=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[b,L,M,E,h,o,l,d],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,y="str",D="kwd",T="com",g="typ",c="lit",u="pun",a="pln",S="tag",x="dec",v="src",O="atn",F="atv",W="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Ee){for(var Pe=0,Be=!1,Ve=!1,We=0,Fe=Ee.length;We<Fe;++We){var Ue=Ee[We];if(Ue.ignoreCase)Ve=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Be=!0,Ve=!1;break}}var st={b:8,t:9,n:10,v:11,f:12,r:13};function ot(Ze){var Oe=Ze.charCodeAt(0);if(Oe!==92)return Oe;var ut=Ze.charAt(1);return Oe=st[ut],Oe||("0"<=ut&&ut<="7"?parseInt(Ze.substring(1),8):ut==="u"||ut==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function it(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var Oe=String.fromCharCode(Ze);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function Je(Ze){var Oe=Ze.substring(1,Ze.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ut=[],at=Oe[0]==="^",Ie=["["];at&&Ie.push("^");for(var He=at?1:0,xe=Oe.length;He<xe;++He){var me=Oe[He];if(/\\[bdsw]/i.test(me))Ie.push(me);else{var ye=ot(me),re;He+2<xe&&Oe[He+1]==="-"?(re=ot(Oe[He+2]),He+=2):re=ye,ut.push([ye,re]),re<65||ye>122||(re<65||ye>90||ut.push([Math.max(65,ye)|32,Math.min(re,90)|32]),re<97||ye>122||ut.push([Math.max(97,ye)&~32,Math.min(re,122)&~32]))}}ut.sort(function(ke,Me){return ke[0]-Me[0]||Me[1]-ke[1]});for(var ne=[],le=[],He=0;He<ut.length;++He){var he=ut[He];he[0]<=le[1]+1?le[1]=Math.max(le[1],he[1]):ne.push(le=he)}for(var He=0;He<ne.length;++He){var he=ne[He];Ie.push(it(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&Ie.push("-"),Ie.push(it(he[1])))}return Ie.push("]"),Ie.join("")}function rt(Ze){for(var Oe=Ze.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")),ut=Oe.length,at=[],Ie=0,He=0;Ie<ut;++Ie){var xe=Oe[Ie];if(xe==="(")++He;else if(xe.charAt(0)==="\\"){var me=+xe.substring(1);me&&(me<=He?at[me]=-1:Oe[Ie]=it(me))}}for(var Ie=1;Ie<at.length;++Ie)at[Ie]===-1&&(at[Ie]=++Pe);for(var Ie=0,He=0;Ie<ut;++Ie){var xe=Oe[Ie];if(xe==="(")++He,at[He]||(Oe[Ie]="(?:");else if(xe.charAt(0)==="\\"){var me=+xe.substring(1);me&&me<=He&&(Oe[Ie]="\\"+at[me])}}for(var Ie=0;Ie<ut;++Ie)Oe[Ie]==="^"&&Oe[Ie+1]!=="^"&&(Oe[Ie]="");if(Ze.ignoreCase&&Be)for(var Ie=0;Ie<ut;++Ie){var xe=Oe[Ie],ye=xe.charAt(0);xe.length>=2&&ye==="["?Oe[Ie]=Je(xe):ye!=="\\"&&(Oe[Ie]=xe.replace(/[a-zA-Z]/g,function(le){var he=le.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Oe.join("")}for(var $e=[],We=0,Fe=Ee.length;We<Fe;++We){var Ue=Ee[We];if(Ue.global||Ue.multiline)throw new Error(""+Ue);$e.push("(?:"+rt(Ue)+")")}return new RegExp($e.join("|"),Ve?"gi":"g")}function N(Ee,Pe){var Be=/(?:^|\s)nocode(?:\s|$)/,Ve=[],We=0,Fe=[],Ue=0;function st(ot){var it=ot.nodeType;if(it==1){if(Be.test(ot.className))return;for(var Je=ot.firstChild;Je;Je=Je.nextSibling)st(Je);var rt=ot.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Ve[Ue]=`
|
|
`,Fe[Ue<<1]=We++,Fe[Ue++<<1|1]=ot)}else if(it==3||it==4){var $e=ot.nodeValue;$e.length&&(Pe?$e=$e.replace(/\r\n?/g,`
|
|
`):$e=$e.replace(/[ \t\r\n]+/g," "),Ve[Ue]=$e,Fe[Ue<<1]=We,We+=$e.length,Fe[Ue++<<1|1]=ot)}}return st(Ee),{sourceCode:Ve.join("").replace(/\n$/,""),spans:Fe}}function X(Ee,Pe,Be,Ve,We){if(!Be)return;var Fe={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Be,spans:null,basePos:Pe,decorations:null};Ve(Fe),We.push.apply(We,Fe.decorations)}var q=/\S/;function ae(Ee){for(var Pe=void 0,Be=Ee.firstChild;Be;Be=Be.nextSibling){var Ve=Be.nodeType;Pe=Ve===1?Pe?Ee:Be:Ve===3&&q.test(Be.nodeValue)?Ee:Pe}return Pe===Ee?void 0:Pe}function de(Ee,Pe){var Be={},Ve;(function(){for(var Ue=Ee.concat(Pe),st=[],ot={},it=0,Je=Ue.length;it<Je;++it){var rt=Ue[it],$e=rt[3];if($e)for(var Ze=$e.length;--Ze>=0;)Be[$e.charAt(Ze)]=rt;var Oe=rt[1],ut=""+Oe;ot.hasOwnProperty(ut)||(st.push(Oe),ot[ut]=null)}st.push(/[\0-\uffff]/),Ve=I(st)})();var We=Pe.length,Fe=function(Ue){for(var st=Ue.sourceCode,ot=Ue.basePos,it=Ue.sourceNode,Je=[ot,a],rt=0,$e=st.match(Ve)||[],Ze={},Oe=0,ut=$e.length;Oe<ut;++Oe){var at=$e[Oe],Ie=Ze[at],He=void 0,xe;if(typeof Ie=="string")xe=!1;else{var me=Be[at.charAt(0)];if(me)He=at.match(me[1]),Ie=me[0];else{for(var ye=0;ye<We;++ye)if(me=Pe[ye],He=at.match(me[1]),He){Ie=me[0];break}He||(Ie=a)}xe=Ie.length>=5&&Ie.substring(0,5)==="lang-",xe&&!(He&&typeof He[1]=="string")&&(xe=!1,Ie=v),xe||(Ze[at]=Ie)}var re=rt;if(rt+=at.length,!xe)Je.push(ot+re,Ie);else{var ne=He[1],le=at.indexOf(ne),he=le+ne.length;He[2]&&(he=at.length-He[2].length,le=he-ne.length);var ke=Ie.substring(5);X(it,ot+re,at.substring(0,le),Fe,Je),X(it,ot+re+le,ne,ue(ke,ne),Je),X(it,ot+re+he,at.substring(he),Fe,Je)}}Ue.decorations=Je};return Fe}function Ae(Ee){var Pe=[],Be=[];Ee.tripleQuotedStrings?Pe.push([y,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Pe.push([y,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([y,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Be.push([y,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ve=Ee.hashComments;Ve&&(Ee.cStyleComments?(Ve>1?Pe.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Be.push([y,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([T,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Be.push([T,/^\/\/[^\r\n]*/,null]),Be.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=Ee.regexLiterals;if(We){var Fe=We>1?"":`
|
|
\r`,Ue=Fe?".":"[\\S\\s]",st="/(?=[^/*"+Fe+"])(?:[^/\\x5B\\x5C"+Fe+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Fe+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Be.push(["lang-regex",RegExp("^"+V+"("+st+")")])}var ot=Ee.types;ot&&Be.push([g,ot]);var it=(""+Ee.keywords).replace(/^ | $/g,"");it.length&&Be.push([D,new RegExp("^(?:"+it.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Je="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(Je+="(?!s*/)"),Be.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(Je),null]),de(Pe,Be)}var be=Ae({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(Ee,Pe,Be){for(var Ve=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Fe=Ee.ownerDocument,Ue=Fe.createElement("li");Ee.firstChild;)Ue.appendChild(Ee.firstChild);var st=[Ue];function ot(Oe){var ut=Oe.nodeType;if(ut==1&&!Ve.test(Oe.className))if(Oe.nodeName==="br")it(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var at=Oe.firstChild;at;at=at.nextSibling)ot(at);else if((ut==3||ut==4)&&Be){var Ie=Oe.nodeValue,He=Ie.match(We);if(He){var xe=Ie.substring(0,He.index);Oe.nodeValue=xe;var me=Ie.substring(He.index+He[0].length);if(me){var ye=Oe.parentNode;ye.insertBefore(Fe.createTextNode(me),Oe.nextSibling)}it(Oe),xe||Oe.parentNode.removeChild(Oe)}}}function it(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function ut(He,xe){var me=xe?He.cloneNode(!1):He,ye=He.parentNode;if(ye){var re=ut(ye,1),ne=He.nextSibling;re.appendChild(me);for(var le=ne;le;le=ne)ne=le.nextSibling,re.appendChild(le)}return me}for(var at=ut(Oe.nextSibling,0),Ie;(Ie=at.parentNode)&&Ie.nodeType===1;)at=Ie;st.push(at)}for(var Je=0;Je<st.length;++Je)ot(st[Je]);Pe===(Pe|0)&&st[0].setAttribute("value",Pe);var rt=Fe.createElement("ol");rt.className="linenums";for(var $e=Math.max(0,Pe-1|0)||0,Je=0,Ze=st.length;Je<Ze;++Je)Ue=st[Je],Ue.className="L"+(Je+$e)%10,Ue.firstChild||Ue.appendChild(Fe.createTextNode("\xA0")),rt.appendChild(Ue);Ee.appendChild(rt)}function Te(Ee){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var Be=/\n/g,Ve=Ee.sourceCode,We=Ve.length,Fe=0,Ue=Ee.spans,st=Ue.length,ot=0,it=Ee.decorations,Je=it.length,rt=0;it[Je]=We;var $e,Ze;for(Ze=$e=0;Ze<Je;)it[Ze]!==it[Ze+2]?(it[$e++]=it[Ze++],it[$e++]=it[Ze++]):Ze+=2;for(Je=$e,Ze=$e=0;Ze<Je;){for(var Oe=it[Ze],ut=it[Ze+1],at=Ze+2;at+2<=Je&&it[at+1]===ut;)at+=2;it[$e++]=Oe,it[$e++]=ut,Ze=at}Je=it.length=$e;var Ie=Ee.sourceNode,He="";Ie&&(He=Ie.style.display,Ie.style.display="none");try{for(var xe=null;ot<st;){var me=Ue[ot],ye=Ue[ot+2]||We,re=it[rt+2]||We,at=Math.min(ye,re),ne=Ue[ot+1],le;if(ne.nodeType!==1&&(le=Ve.substring(Fe,at))){Pe&&(le=le.replace(Be,"\r")),ne.nodeValue=le;var he=ne.ownerDocument,ke=he.createElement("span");ke.className=it[rt+1];var Me=ne.parentNode;Me.replaceChild(ke,ne),ke.appendChild(ne),Fe<ye&&(Ue[ot+1]=ne=he.createTextNode(Ve.substring(at,ye)),Me.insertBefore(ne,ke.nextSibling))}Fe=at,Fe>=ye&&(ot+=2),Fe>=re&&(rt+=2)}}finally{Ie&&(Ie.style.display=He)}}var Se={};function pe(Ee,Pe){for(var Be=Pe.length;--Be>=0;){var Ve=Pe[Be];Se.hasOwnProperty(Ve)?B.console&&console.warn("cannot override language handler %s",Ve):Se[Ve]=Ee}}function ue(Ee,Pe){return Ee&&Se.hasOwnProperty(Ee)||(Ee=/^\s*</.test(Pe)?"default-markup":"default-code"),Se[Ee]}pe(be,["default-code"]),pe(de([],[[a,/^[^<?]+/],[x,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),pe(de([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[S,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[O,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),pe(de([],[[F,/^[\s\S]+/]]),["uq.val"]),pe(Ae({keywords:b,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),pe(Ae({keywords:"null,true,false"}),["json"]),pe(Ae({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),pe(Ae({keywords:M,cStyleComments:!0}),["java"]),pe(Ae({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(Ae({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(Ae({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(Ae({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(Ae({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(Ae({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(de([],[[y,/^[\s\S]+/]]),["regex"]);function te(Ee){var Pe=Ee.langExtension;try{var Be=N(Ee.sourceNode,Ee.pre),Ve=Be.sourceCode;Ee.sourceCode=Ve,Ee.spans=Be.spans,Ee.basePos=0,ue(Pe,Ve)(Ee),Te(Ee)}catch(We){B.console&&console.log(We&&We.stack||We)}}function fe(Ee,Pe,Be){var Ve=Be||!1,We=Pe||null,Fe=document.createElement("div");Fe.innerHTML="<pre>"+Ee+"</pre>",Fe=Fe.firstChild,Ve&&Ce(Fe,Ve,!0);var Ue={langExtension:We,numberLines:Ve,sourceNode:Fe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ue),Fe.innerHTML}function oe(Ee,Pe){var Be=Pe||document.body,Ve=Be.ownerDocument||document;function We(me){return Be.getElementsByTagName(me)}for(var Fe=[We("pre"),We("code"),We("xmp")],Ue=[],st=0;st<Fe.length;++st)for(var ot=0,it=Fe[st].length;ot<it;++ot)Ue.push(Fe[st][ot]);Fe=null;var Je=Date;Je.now||(Je={now:function(){return+new Date}});var rt=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,ut=/pre|xmp/i,at=/^code$/i,Ie=/^(?:pre|code|xmp)$/i,He={};function xe(){for(var me=B.PR_SHOULD_USE_CONTINUATION?Je.now()+250:Infinity;rt<Ue.length&&Je.now()<me;rt++){for(var ye=Ue[rt],re=He,ne=ye;ne=ne.previousSibling;){var le=ne.nodeType,he=(le===7||le===8)&&ne.nodeValue;if(he?!/^\??prettify\b/.test(he):le!==3||/\S/.test(ne.nodeValue))break;if(he){re={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Bt,wt,pr){re[wt]=pr});break}}var ke=ye.className;if((re!==He||Ze.test(ke))&&!Oe.test(ke)){for(var Me=!1,Ye=ye.parentNode;Ye;Ye=Ye.parentNode){var yt=Ye.tagName;if(Ie.test(yt)&&Ye.className&&Ze.test(Ye.className)){Me=!0;break}}if(!Me){ye.className+=" prettyprinted";var At=re.lang;if(!At){At=ke.match($e);var ze;!At&&(ze=ae(ye))&&at.test(ze.tagName)&&(At=ze.className.match($e)),At&&(At=At[1])}var xt;if(ut.test(ye.tagName))xt=1;else{var mt=ye.currentStyle,nt=Ve.defaultView,_t=mt?mt.whiteSpace:nt&&nt.getComputedStyle?nt.getComputedStyle(ye,null).getPropertyValue("white-space"):0;xt=_t&&_t.substring(0,3)==="pre"}var kt=re.linenums;(kt=kt==="true"||+kt)||(kt=ke.match(/\blinenums\b(?::(\d+))?/),kt=kt?kt[1]&&kt[1].length?+kt[1]:!0:!1),kt&&Ce(ye,kt,xt);var Kt={langExtension:At,sourceNode:ye,numberLines:kt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}rt<Ue.length?B.setTimeout(xe,250):typeof Ee=="function"&&Ee()}xe()}var Le=B.PR={createSimpleLexer:de,registerLangHandler:pe,sourceDecorator:Ae,PR_ATTRIB_NAME:O,PR_ATTRIB_VALUE:F,PR_COMMENT:T,PR_DECLARATION:x,PR_KEYWORD:D,PR_LITERAL:c,PR_NOCODE:W,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:v,PR_STRING:y,PR_TAG:S,PR_TYPE:g,prettyPrintOne:R?B.prettyPrintOne=fe:_=fe,prettyPrint:j=R?B.prettyPrint=oe:j=oe},_e=B.define;typeof _e=="function"&&_e.amd&&_e("google-code-prettify",[],function(){return Le})})()},"VrN/":function(ht,qe,se){(function(ie,Q){ht.exports=Q()})(this,function(){"use strict";var ie=navigator.userAgent,Q=navigator.platform,R=/gecko\/\d/i.test(ie),Y=/MSIE \d/.test(ie),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ie),_=/Edge\/(\d+)/.exec(ie),j=Y||U||_,B=j&&(Y?document.documentMode||6:+(_||U)[1]),P=!_&&/WebKit\//.test(ie),A=P&&/Qt\/\d+\.\d+/.test(ie),p=!_&&/Chrome\//.test(ie),b=/Opera\//.test(ie),M=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ie),C=/PhantomJS/.test(ie),E=!_&&/AppleWebKit/.test(ie)&&/Mobile\/\w+/.test(ie),h=/Android/.test(ie),o=E||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ie),l=E||/Mac/.test(Q),d=/\bCrOS\b/.test(ie),w=/win/i.test(Q),f=b&&ie.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(b=!1,P=!0);var y=l&&(A||b&&(f==null||f<12.11)),D=R||j&&B>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=T(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)n.appendChild(t[k]);return n}function S(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var x;document.createRange?x=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:x=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function O(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var i=e.className;T(t).test(i)||(e.className+=(i?" ":"")+t)}function W(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!T(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};E?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(V=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function X(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=r||0,H=n||0;;){var $=e.indexOf(" ",k);if($<0||$>=t)return H+(t-k);H+=$-k,H+=i-H%i,k=$+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ae(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var de=50,Ae={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Ce={origin:"*mouse"},Te={origin:"+move"};function Se(e,t,i){for(var r=0,n=0;;){var k=e.indexOf(" ",r);k==-1&&(k=e.length);var H=k-r;if(k==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=k-r,n+=i-n%i,r=k+1,n>=t)return r}}var pe=[""];function ue(e){for(;pe.length<=e;)pe.push(te(pe)+" ");return pe[e]}function te(e){return e[e.length-1]}function fe(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function oe(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Le(){}function _e(e,t){var i;return Object.create?i=Object.create(e):(Le.prototype=e,i=new Le),t&&N(t,i),i}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Pe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ee.test(e))}function Be(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function Ve(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 Fe(e){return e.charCodeAt(0)>=768&&We.test(e)}function Ue(e,t,i){for(;(i<0?t>0:t<e.length)&&Fe(e.charAt(t));)t+=i;return t}function st(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,k=r<0?Math.ceil(n):Math.floor(n);if(k==t)return e(k)?t:i;e(k)?i=k:t=k+r}}function ot(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,k=0;k<e.length;++k){var H=e[k];(H.from<i&&H.to>t||t==i&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,i),H.level==1?"rtl":"ltr",k),n=!0)}n||r(t,i,"ltr")}var it=null;function Je(e,t,i){var r;it=null;for(var n=0;n<e.length;++n){var k=e[n];if(k.from<t&&k.to>t)return n;k.to==t&&(k.from!=k.to&&i=="before"?r=n:it=n),k.from==t&&(k.from!=k.to&&i!="before"?r=n:it=n)}return r!=null?r:it}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,k=/[LRr]/,H=/[Lb1n]/,$=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!r.test(ee))return!1;for(var De=ee.length,we=[],Ne=0;Ne<De;++Ne)we.push(i(ee.charCodeAt(Ne)));for(var Ke=0,Qe=ge;Ke<De;++Ke){var et=we[Ke];et=="m"?we[Ke]=Qe:Qe=et}for(var lt=0,tt=ge;lt<De;++lt){var dt=we[lt];dt=="1"&&tt=="r"?we[lt]="n":k.test(dt)&&(tt=dt,dt=="r"&&(we[lt]="R"))}for(var Et=1,vt=we[0];Et<De-1;++Et){var Lt=we[Et];Lt=="+"&&vt=="1"&&we[Et+1]=="1"?we[Et]="1":Lt==","&&vt==we[Et+1]&&(vt=="1"||vt=="n")&&(we[Et]=vt),vt=Lt}for(var Yt=0;Yt<De;++Yt){var cr=we[Yt];if(cr==",")we[Yt]="N";else if(cr=="%"){var Jt=void 0;for(Jt=Yt+1;Jt<De&&we[Jt]=="%";++Jt);for(var Fr=Yt&&we[Yt-1]=="!"||Jt<De&&we[Jt]=="1"?"1":"N",_r=Yt;_r<Jt;++_r)we[_r]=Fr;Yt=Jt-1}}for(var tr=0,Or=ge;tr<De;++tr){var br=we[tr];Or=="L"&&br=="1"?we[tr]="L":k.test(br)&&(Or=br)}for(var ar=0;ar<De;++ar)if(n.test(we[ar])){var rr=void 0;for(rr=ar+1;rr<De&&n.test(we[rr]);++rr);for(var Zt=(ar?we[ar-1]:ge)=="L",Pr=(rr<De?we[rr]:ge)=="L",dn=Zt==Pr?Zt?"L":"R":ge,Di=ar;Di<rr;++Di)we[Di]=dn;ar=rr-1}for(var Er=[],oi,fr=0;fr<De;)if(H.test(we[fr])){var Ya=fr;for(++fr;fr<De&&H.test(we[fr]);++fr);Er.push(new J(0,Ya,fr))}else{var mi=fr,Gi=Er.length,zi=ce=="rtl"?1:0;for(++fr;fr<De&&we[fr]!="L";++fr);for(var Tr=mi;Tr<fr;)if($.test(we[Tr])){mi<Tr&&(Er.splice(Gi,0,new J(1,mi,Tr)),Gi+=zi);var cn=Tr;for(++Tr;Tr<fr&&$.test(we[Tr]);++Tr);Er.splice(Gi,0,new J(2,cn,Tr)),Gi+=zi,mi=Tr}else++Tr;mi<fr&&Er.splice(Gi,0,new J(1,mi,fr))}return ce=="ltr"&&(Er[0].level==1&&(oi=ee.match(/^\s+/))&&(Er[0].from=oi[0].length,Er.unshift(new J(0,0,oi[0].length))),te(Er).level==1&&(oi=ee.match(/\s+$/))&&(te(Er).to-=oi[0].length,Er.push(new J(0,De-oi[0].length,De)))),ce=="rtl"?Er.reverse():Er}}();function $e(e,t){var i=e.order;return i==null&&(i=e.order=rt(e.text,t)),i}var Ze=[],Oe=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ze).concat(i)}};function ut(e,t){return e._handlers&&e._handlers[t]||Ze}function at(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var k=ae(n,i);k>-1&&(r[t]=n.slice(0,k).concat(n.slice(k+1)))}}}function Ie(e,t){var i=ut(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function He(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ie(e,i||t.type,e,t),le(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ae(i,t[r])==-1&&i.push(t[r])}function me(e,t){return ut(e,t).length>0}function ye(e){e.prototype.on=function(t,i){Oe(this,t,i)},e.prototype.off=function(t,i){at(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){re(e),ne(e)}function ke(e){return e.target||e.srcElement}function Me(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 Ye=function(){if(j&&B<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),yt;function At(e){if(yt==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(yt=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&B<8))}var i=yt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ze;function xt(e){if(ze!=null)return ze;var t=u(e,document.createTextNode("A\u062EA")),i=x(t,0,1).getBoundingClientRect(),r=x(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:ze=r.right-i.right<3}var mt=`
|
|
|
|
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 k=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=k.indexOf("\r");H!=-1?(i.push(k.slice(0,H)),t+=H+1):(i.push(k),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},nt=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},_t=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),kt=null;function Kt(e){if(kt!=null)return kt;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=x(t,0,1).getBoundingClientRect();return kt=Math.abs(i.left-r.left)>1}var Bt={},wt={};function pr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Bt[e]=t}function or(e,t){wt[e]=t}function gt(e){if(typeof e=="string"&&wt.hasOwnProperty(e))e=wt[e];else if(e&&typeof e.name=="string"&&wt.hasOwnProperty(e.name)){var t=wt[e.name];typeof t=="string"&&(t={name:t}),e=_e(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return gt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return gt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Sr(e,t){t=gt(t);var i=Bt[t.name];if(!i)return Sr(e,"text/plain");var r=i(e,t);if(sr.hasOwnProperty(t.name)){var n=sr[t.name];for(var k in n){if(!n.hasOwnProperty(k))continue;r.hasOwnProperty(k)&&(r["_"+k]=r[k]),r[k]=n[k]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var sr={};function mr(e,t){var i=sr.hasOwnProperty(e)?sr[e]:sr[e]={};N(t,i)}function wr(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 si(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 Kr(e,t,i){return e.startState?e.startState(t,i):!0}var It=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(H){return i?H.toLowerCase():H},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(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],k=n.chunkSize();if(t<k){i=n;break}t-=k}return i.lines[t]}function Ur(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(k){var H=k.text;n==i.line&&(H=H.slice(0,i.ch)),n==t.line&&(H=H.slice(t.ch)),r.push(H),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Ar(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,i=ae(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Vr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],k=n.height;if(t<k){e=n;continue e}t-=k,i+=n.chunkSize()}return i}while(!e.lines);for(var H=0;H<e.lines.length;++H){var $=e.lines[H],J=$.height;if(t<J)break;t-=J}return i+H}function ui(e,t){return t>=e.first&&t<e.first+e.size}function gi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Xe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Xe))return new Xe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function ei(e,t){return e.sticky==t.sticky&&St(e,t)==0}function hi(e){return Xe(e.line,e.ch)}function di(e,t){return St(e,t)<0?t:e}function Ri(e,t){return St(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Xe(e.first,0);var i=e.first+e.size-1;return t.line>i?Xe(i,ft(e,i).text.length):m(t,ft(e,t.line).text.length)}function m(e,t){var i=e.ch;return i==null||i>t?Xe(e.line,t):i<0?Xe(e.line,0):e}function G(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var Z=function(e,t){this.state=e,this.lookAhead=t},z=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};z.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},z.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}},z.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},z.fromSaved=function(e,t,i){return t instanceof Z?new z(e,wr(e.mode,t.state),i,t.lookAhead):new z(e,wr(e.mode,t),i)},z.prototype.save=function(e){var t=e!==!1?wr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],k={};Wr(e,t.text,e.doc.mode,i,function(ee,ce){return n.push(ee,ce)},k,r);for(var H=i.state,$=function(ee){i.baseTokens=n;var ce=e.state.overlays[ee],ge=1,De=0;i.state=!0,Wr(e,t.text,ce.mode,i,function(we,Ne){for(var Ke=ge;De<we;){var Qe=n[ge];Qe>we&&n.splice(ge,1,we,n[ge+1],Qe),ge+=2,De=Math.min(we,Qe)}if(!Ne)return;if(ce.opaque)n.splice(Ke,ge-Ke,we,"overlay "+Ne),ge=Ke+2;else for(;Ke<ge;Ke+=2){var et=n[Ke+1];n[Ke+1]=(et?et+" ":"")+"overlay "+Ne}},k),i.state=H,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)$(J);return{styles:n,classes:k.bgClass||k.textClass?k:null}}function je(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Re(e,Ot(t)),n=t.text.length>e.options.maxHighlightLength&&wr(e.doc.mode,r.state),k=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=k.styles,k.classes?t.styleClasses=k.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 Re(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new z(r,!0,t);var k=lr(e,t,i),H=k>r.first&&ft(r,k-1).stateAfter,$=H?z.fromSaved(r,H,k):new z(r,Kr(r.mode),k);return r.iter(k,t,function(J){ct(e,J.text,$);var ee=$.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&ee<n.viewTo?$.save():null,$.nextLine()}),i&&(r.modeFrontier=$.line),$}function ct(e,t,i,r){var n=e.doc.mode,k=new It(t,e.options.tabSize,i);for(k.start=k.pos=r||0,t==""&&Ge(n,i.state);!k.eol();)Ct(n,k,i.state),k.start=k.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=si(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Ct(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=si(e,i).mode);var k=e.token(t,i);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Wt(e,t,i,r){var n=e.doc,k=n.mode,H;t=s(n,t);var $=ft(n,t.line),J=Re(e,t.line,i),ee=new It($.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,H=Ct(k,ee,J.state),r&&ce.push(new Mt(ee,H,wr(n.mode,J.state)));return r?ce:new Mt(ee,H,J.state)}function jr(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Wr(e,t,i,r,n,k,H){var $=i.flattenSpans;$==null&&($=e.options.flattenSpans);var J=0,ee=null,ce=new It(t,e.options.tabSize,r),ge,De=e.options.addModeClass&&[null];for(t==""&&jr(Ge(i,r.state),k);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?($=!1,H&&ct(e,t,r,ce.pos),ce.pos=t.length,ge=null):ge=jr(Ct(i,ce,r.state,De),k),De){var we=De[0].name;we&&(ge="m-"+(ge?we+" "+ge:we))}if(!$||ee!=ge){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,ee);ee=ge}ce.start=ce.pos}for(;J<ce.pos;){var Ne=Math.min(ce.pos,J+5e3);n(Ne,ee),J=Ne}}function lr(e,t,i){for(var r,n,k=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),$=t;$>H;--$){if($<=k.first)return k.first;var J=ft(k,$-1),ee=J.stateAfter;if(ee&&(!i||$+(ee instanceof Z?ee.lookAhead:0)<=k.modeFrontier))return $;var ce=X(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=$-1,r=ce)}return n}function Xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=ft(e,r).stateAfter;if(n&&(!(n instanceof Z)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ki=!1,Lr=!1;function kr(){Ki=!0}function ti(){Lr=!0}function vi(e,t,i){this.marker=e,this.from=t,this.to=i}function $r(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ri(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function Hr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function fn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var k=e[n],H=k.marker,$=k.from==null||(H.inclusiveLeft?k.from<=t:k.from<t);if($||k.from==t&&H.type=="bookmark"&&(!i||!k.marker.insertLeft)){var J=k.to==null||(H.inclusiveRight?k.to>=t:k.to>t);(r||(r=[])).push(new vi(H,k.from,J?null:k.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var k=e[n],H=k.marker,$=k.to==null||(H.inclusiveRight?k.to>=t:k.to>t);if($||k.from==t&&H.type=="bookmark"&&(!i||k.marker.insertLeft)){var J=k.from==null||(H.inclusiveLeft?k.from<=t:k.from<t);(r||(r=[])).push(new vi(H,J?null:k.from-t,k.to==null?null:k.to-t))}}return r}function Mr(e,t){if(t.full)return null;var i=ui(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=ui(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,k=t.to.ch,H=St(t.from,t.to)==0,$=fn(i,n,H),J=Vi(r,k,H),ee=t.text.length==1,ce=te(t.text).length+(ee?n:0);if($)for(var ge=0;ge<$.length;++ge){var De=$[ge];if(De.to==null){var we=$r(J,De.marker);we?ee&&(De.to=we.to==null?null:we.to+ce):De.to=n}}if(J)for(var Ne=0;Ne<J.length;++Ne){var Ke=J[Ne];if(Ke.to!=null&&(Ke.to+=ce),Ke.from==null){var Qe=$r($,Ke.marker);Qe||(Ke.from=ce,ee&&($||($=[])).push(Ke))}else Ke.from+=ce,ee&&($||($=[])).push(Ke)}$&&($=Ir($)),J&&J!=$&&(J=Ir(J));var et=[$];if(!ee){var lt=t.text.length-2,tt;if(lt>0&&$)for(var dt=0;dt<$.length;++dt)$[dt].to==null&&(tt||(tt=[])).push(new vi($[dt].marker,null,null));for(var Et=0;Et<lt;++Et)et.push(tt);et.push(J)}return et}function Ir(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function _i(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var Ne=0;Ne<we.markedSpans.length;++Ne){var Ke=we.markedSpans[Ne].marker;Ke.readOnly&&(!r||ae(r,Ke)==-1)&&(r||(r=[])).push(Ke)}}),!r)return null;for(var n=[{from:t,to:i}],k=0;k<r.length;++k)for(var H=r[k],$=H.find(0),J=0;J<n.length;++J){var ee=n[J];if(St(ee.to,$.from)<0||St(ee.from,$.to)>0)continue;var ce=[J,1],ge=St(ee.from,$.from),De=St(ee.to,$.to);(ge<0||!H.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:$.from}),(De>0||!H.inclusiveRight&&!De)&&ce.push({from:$.to,to:ee.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function Oi(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Pi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function qt(e){return e.inclusiveLeft?-1:0}function Ft(e){return e.inclusiveRight?1:0}function gr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),k=St(r.from,n.from)||qt(e)-qt(t);if(k)return-k;var H=St(r.to,n.to)||Ft(e)-Ft(t);return H||t.id-e.id}function Ut(e,t){var i=Lr&&e.markedSpans,r;if(i)for(var n=void 0,k=0;k<i.length;++k)n=i[k],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||gr(r,n.marker)<0)&&(r=n.marker);return r}function vr(e){return Ut(e,!0)}function Xt(e){return Ut(e,!1)}function yi(e,t){var i=Lr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var k=i[n];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!r||gr(r,k.marker)<0)&&(r=k.marker)}return r}function ir(e,t,i,r,n){var k=ft(e,t),H=Lr&&k.markedSpans;if(H)for(var $=0;$<H.length;++$){var J=H[$];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),ce=St(ee.from,i)||qt(J.marker)-qt(n),ge=St(ee.to,r)||Ft(J.marker)-Ft(n);if(ce>=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.to,i)>=0:St(ee.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.from,r)<=0:St(ee.from,r)<0))return!0}}function nr(e){for(var t;t=vr(e);)e=t.find(-1,!0).line;return e}function ii(e){for(var t;t=Xt(e);)e=t.find(1,!0).line;return e}function bi(e){for(var t,i;t=Xt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function xi(e,t){var i=ft(e,t),r=nr(i);return i==r?t:Ot(r)}function Un(e,t){if(t>e.lastLine())return t;var i=ft(e,t),r;if(!Qr(e,i))return t;for(;r=Xt(i);)i=r.find(1,!0).line;return Ot(i)+1}function Qr(e,t){var i=Lr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Xi(e,t,r))return!0}}function Xi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Xi(e,r.line,$r(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,k=0;k<t.markedSpans.length;++k)if(n=t.markedSpans[k],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Xi(e,t,n))return!0}function Nr(e){e=nr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var k=i.parent;k;i=k,k=i.parent)for(var H=0;H<k.children.length;++H){var $=k.children[H];if($==i)break;t+=$.height}return t}function Yi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=vr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Xt(r);){var k=i.find(0,!0);t-=r.text.length-k.from.ch,r=k.to.line,t+=r.text.length-k.to.ch}return t}function ci(e){var t=e.display,i=e.doc;t.maxLine=ft(i,i.first),t.maxLineLength=Yi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Yi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ei=function(e,t,i){this.text=e,Pi(this,t),this.height=i?i(this):1};Ei.prototype.lineNo=function(){return Ot(this)},ye(Ei);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),Oi(e),Pi(e,i);var n=r?r(e):1;n!=e.height&&Ar(e,n)}function ha(e){e.parent=null,Oi(e)}var Qa={},Ja={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ja:Qa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=S("span",null,null,P?"padding-right: .1px":null),r={pre:S("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 k=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=Tt,xt(e.display.measure)&&(H=$e(k,e.doc.direction))&&(r.addToken=Dt(r.addToken,H)),r.map=[];var $=t!=e.display.externalMeasured&&Ot(k);Ht(k,r,je(e,k,$)),k.styleClasses&&(k.styleClasses.bgClass&&(r.bgClass=W(k.styleClasses.bgClass,r.bgClass||"")),k.styleClasses.textClass&&(r.textClass=W(k.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(At(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(P){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ie(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function pt(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 Tt(e,t,i,r,n,k,H){if(!t)return;var $=e.splitSpaces?bt(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ce),j&&B<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var De=J.exec(t),we=De?De.index-ge:t.length-ge;if(we){var Ne=document.createTextNode($.slice(ge,ge+we));j&&B<9?ce.appendChild(a("span",[Ne])):ce.appendChild(Ne),e.map.push(e.pos,e.pos+we,Ne),e.col+=we,e.pos+=we}if(!De)break;ge+=we+1;var Ke=void 0;if(De[0]==" "){var Qe=e.cm.options.tabSize,et=Qe-e.col%Qe;Ke=ce.appendChild(a("span",ue(et),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=et}else De[0]=="\r"||De[0]==`
|
|
`?(Ke=ce.appendChild(a("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",De[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(De[0]),Ke.setAttribute("cm-text",De[0]),j&&B<9?ce.appendChild(a("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,i||r||n||ee||k||H){var lt=i||"";r&&(lt+=r),n&&(lt+=n);var tt=a("span",[ce],lt,k);if(H)for(var dt in H)H.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&tt.setAttribute(dt,H[dt]);return e.content.appendChild(tt)}e.content.appendChild(ce)}function bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var k=e.charAt(n);k==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(k="\xA0"),r+=k,i=k==" "}return r}function Dt(e,t){return function(i,r,n,k,H,$,J){n=n?n+" cm-force-border":"cm-force-border";for(var ee=i.pos,ce=ee+r.length;;){for(var ge=void 0,De=0;De<t.length&&!(ge=t[De],ge.to>ee&&ge.from<=ee);De++);if(ge.to>=ce)return e(i,r,n,k,H,$,J);e(i,r.slice(0,ge.to-ee),n,k,null,$,J),k=null,r=r.slice(ge.to-ee),ee=ge.to}}}function Nt(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 Ht(e,t,i){var r=e.markedSpans,n=e.text,k=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(k,k=i[H]),da(i[H+1],t.cm.options));return}for(var $=n.length,J=0,ee=1,ce="",ge,De,we=0,Ne,Ke,Qe,et,lt;;){if(we==J){Ne=Ke=Qe=De="",lt=null,et=null,we=Infinity;for(var tt=[],dt=void 0,Et=0;Et<r.length;++Et){var vt=r[Et],Lt=vt.marker;if(Lt.type=="bookmark"&&vt.from==J&&Lt.widgetNode)tt.push(Lt);else if(vt.from<=J&&(vt.to==null||vt.to>J||Lt.collapsed&&vt.to==J&&vt.from==J)){if(vt.to!=null&&vt.to!=J&&we>vt.to&&(we=vt.to,Ke=""),Lt.className&&(Ne+=" "+Lt.className),Lt.css&&(De=(De?De+";":"")+Lt.css),Lt.startStyle&&vt.from==J&&(Qe+=" "+Lt.startStyle),Lt.endStyle&&vt.to==we&&(dt||(dt=[])).push(Lt.endStyle,vt.to),Lt.title&&((lt||(lt={})).title=Lt.title),Lt.attributes)for(var Yt in Lt.attributes)(lt||(lt={}))[Yt]=Lt.attributes[Yt];Lt.collapsed&&(!et||gr(et.marker,Lt)<0)&&(et=vt)}else vt.from>J&&we>vt.from&&(we=vt.from)}if(dt)for(var cr=0;cr<dt.length;cr+=2)dt[cr+1]==we&&(Ke+=" "+dt[cr]);if(!et||et.from==J)for(var Jt=0;Jt<tt.length;++Jt)Nt(t,0,tt[Jt]);if(et&&(et.from||0)==J){if(Nt(t,(et.to==null?$+1:et.to)-J,et.marker,et.from==null),et.to==null)return;et.to==J&&(et=!1)}}if(J>=$)break;for(var Fr=Math.min($,we);;){if(ce){var _r=J+ce.length;if(!et){var tr=_r>Fr?ce.slice(0,Fr-J):ce;t.addToken(t,tr,ge?ge+Ne:Ne,Qe,J+tr.length==we?Ke:"",De,lt)}if(_r>=Fr){ce=ce.slice(Fr-J),J=Fr;break}J=_r,Qe=""}ce=n.slice(k,k=i[ee++]),ge=da(i[ee++],t.cm.options)}}}function Pt(e,t,i){this.line=t,this.rest=bi(t),this.size=this.rest?Ot(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Qr(e,t)}function Qt(e,t,i){for(var r=[],n,k=t;k<i;k=n){var H=new Pt(e.doc,ft(e.doc,k),k);n=k+H.size,r.push(H)}return r}var ur=null;function Rt(e){ur?ur.ops.push(e):e.ownsGroup=ur={ops:[e],delayedCallbacks:[]}}function Mi(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Gt(e,t){var i=e.ownsGroup;if(!i)return;try{Mi(i)}finally{ur=null,t(i)}}var yr=null;function Vt(e,t){var i=ut(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;ur?n=ur.delayedCallbacks:yr?n=yr:(n=yr=[],setTimeout(Yr,0));for(var k=function($){n.push(function(){return i[$].apply(null,r)})},H=0;H<i.length;++H)k(H)}function Yr(){var e=yr;yr=null;for(var t=0;t<e.length;++t)e[t]()}function pn(e,t,i,r){for(var n=0;n<t.changes.length;n++){var k=t.changes[n];k=="text"?Ms(e,t):k=="gutter"?qa(e,t,i,r):k=="class"?ca(e,t):k=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function Ms(e,t){var i=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):i&&(t.text.className=i)}function ca(e,t){Ps(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function qa(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=mn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var H=mn(t),$=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable($),H.insertBefore($,t.text),t.line.gutterClass&&($.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=$.appendChild(a("div",gi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,ce=k.hasOwnProperty(ee)&&k[ee];ce&&$.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=T("CodeMirror-linewidget"),n=t.node.firstChild,k=void 0;n;n=k)k=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);eo(e,t,i)}function Ns(e,t,i,r){var n=Za(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ca(e,t),qa(e,t,i,r),eo(e,t,r),t.node}function eo(e,t,i){if(to(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,i,!1)}function to(e,t,i,r,n){if(!t.widgets)return;for(var k=mn(i),H=0,$=t.widgets;H<$.length;++H){var J=$[H],ee=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Bs(J,ee,i,r),e.display.input.setUneditable(ee),n&&J.above?k.insertBefore(ee,i.gutter||i.text):k.appendChild(ee),Vt(J,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=ke(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Wn(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return de-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function pa(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Fs(e,t,i){var r=e.options.lineWrapping,n=r&&Ii(e);if(!t.measure.heights||r&&t.measure.width!=n){var k=t.measure.heights=[];if(r){t.measure.width=n;for(var H=t.text.firstChild.getClientRects(),$=0;$<H.length-1;$++){var J=H[$],ee=H[$+1];Math.abs(J.bottom-ee.bottom)>2&&k.push((J.bottom+ee.top)/2-i.top)}}k.push(i.bottom-i.top)}}function io(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Ot(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=nr(t);var i=Ot(t),r=e.display.externalMeasured=new Pt(e.doc,t,i);r.lineN=i;var n=r.built=jn(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function no(e,t,i,r){return ai(e,$i(e,t),i,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function $i(e,t){var i=Ot(t),r=ma(e,i);r&&!r.text?r=null:r&&r.changes&&(pn(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=io(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ai(e,t,i,r,n){t.before&&(i=-1);var k=i+(r||""),H;return t.cache.hasOwnProperty(k)?H=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,i,r),H.bogus||(t.cache[k]=H)),{left:H.left,right:H.right,top:n?H.rtop:H.top,bottom:n?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,i){for(var r,n,k,H,$,J,ee=0;ee<e.length;ee+=3)if($=e[ee],J=e[ee+1],t<$?(n=0,k=1,H="left"):t<J?(n=t-$,k=n+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(k=J-$,n=k-1,t>=J&&(H="right")),n!=null){if(r=e[ee+2],$==J&&i==(r.insertLeft?"left":"right")&&(H=i),i=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],H="left";if(i=="right"&&n==J-$)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],H="right";break}return{node:r,start:n,end:k,collapse:H,coverStart:$,coverEnd:J}}function js(e,t){var i=ao;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=oo(t.map,i,r),k=n.node,H=n.start,$=n.end,J=n.collapse,ee;if(k.nodeType==3){for(var ce=0;ce<4;ce++){for(;H&&Fe(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+$<n.coverEnd&&Fe(t.line.text.charAt(n.coverStart+$));)++$;if(j&&B<9&&H==0&&$==n.coverEnd-n.coverStart?ee=k.parentNode.getBoundingClientRect():ee=js(x(k,H,$).getClientRects(),r),ee.left||ee.right||H==0)break;$=H,H=H-1,J="right"}j&&B<11&&(ee=Hs(e.display.measure,ee))}else{H>0&&(J=r="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?ee=ge[r=="right"?ge.length-1:0]:ee=k.getBoundingClientRect()}if(j&&B<9&&!H&&(!ee||!ee.left&&!ee.right)){var De=k.parentNode.getClientRects()[0];De?ee={left:De.left,right:De.left+Ji(e.display),top:De.top,bottom:De.bottom}:ee=ao}for(var we=ee.top-t.rect.top,Ne=ee.bottom-t.rect.top,Ke=(we+Ne)/2,Qe=t.view.measure.heights,et=0;et<Qe.length-1&&!(Ke<Qe[et]);et++);var lt=et?Qe[et-1]:0,tt=Qe[et],dt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:lt,bottom:tt};return!ee.left&&!ee.right&&(dt.bogus=!0),e.options.singleCursorHeightPerLine||(dt.rtop=we,dt.rbottom=Ne),dt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function vn(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return p&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return p&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ga(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Hn(e,t,i,r,n){if(!n){var k=ga(t);i.top+=k,i.bottom+=k}if(r=="line")return i;r||(r="local");var H=Nr(t);if(r=="local"?H+=Wn(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var $=e.display.lineSpace.getBoundingClientRect();H+=$.top+(r=="window"?0:ho());var J=$.left+(r=="window"?0:uo());i.left+=J,i.right+=J}return i.top+=H,i.bottom+=H,i}function co(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=uo(),n-=ho();else if(i=="local"||!i){var k=e.display.sizer.getBoundingClientRect();r+=k.left,n+=k.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:n-H.top}}function va(e,t,i,r,n){return r||(r=ft(e.doc,t.line)),Hn(e,r,no(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,k){r=r||ft(e.doc,t.line),n||(n=$i(e,r));function H(Ne,Ke){var Qe=ai(e,n,Ne,Ke?"right":"left",k);return Ke?Qe.left=Qe.right:Qe.right=Qe.left,Hn(e,r,Qe,i)}var $=$e(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!$)return H(ee=="before"?J-1:J,ee=="before");function ce(Ne,Ke,Qe){var et=$[Ke],lt=et.level==1;return H(Qe?Ne-1:Ne,lt!=Qe)}var ge=Je($,J,ee),De=it,we=ce(J,ge,ee=="before");return De!=null&&(we.other=ce(J,De,ee!="before")),we}function fo(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=Ji(e.display)*t.ch);var r=ft(e.doc,t.line),n=Nr(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ya(e,t,i,r,n){var k=Xe(e,t,i);return k.xRel=n,r&&(k.outside=r),k}function ba(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ya(r.first,0,null,-1,-1);var n=Vr(r,i),k=r.first+r.size-1;if(n>k)return ya(r.first+r.size-1,ft(r,k).text.length,null,1,1);t<0&&(t=0);for(var H=ft(r,n);;){var $=Gs(e,H,n,t,i),J=yi(H,$.ch+($.xRel>0||$.outside>0?1:0));if(!J)return $;var ee=J.find(1);if(ee.line==n)return ee;H=ft(r,n=ee.line)}}function po(e,t,i,r){r-=ga(t);var n=t.text.length,k=st(function(H){return ai(e,i,H-1).bottom<=r},n,0);return n=st(function(H){return ai(e,i,H).top>r},k,n),{begin:k,end:n}}function mo(e,t,i,r){i||(i=$i(e,t));var n=Hn(e,t,ai(e,i,r),"line").top;return po(e,t,i,n)}function xa(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-=Nr(t);var k=$i(e,t),H=ga(t),$=0,J=t.text.length,ee=!0,ce=$e(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,k,ce,r,n);ee=ge.level!=1,$=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var De=null,we=null,Ne=st(function(Et){var vt=ai(e,k,Et);return vt.top+=H,vt.bottom+=H,xa(vt,r,n,!1)?(vt.top<=n&&vt.left<=r&&(De=Et,we=vt),!0):!1},$,J),Ke,Qe,et=!1;if(we){var lt=r-we.left<we.right-r,tt=lt==ee;Ne=De+(tt?0:1),Qe=tt?"after":"before",Ke=lt?we.left:we.right}else{!ee&&(Ne==J||Ne==$)&&Ne++,Qe=Ne==0?"after":Ne==t.text.length?"before":ai(e,k,Ne-(ee?1:0)).bottom+H<=n==ee?"after":"before";var dt=Jr(e,Xe(i,Ne,Qe),"line",t,k);Ke=dt.left,et=n<dt.top?-1:n>=dt.bottom?1:0}return Ne=Ue(t.text,Ne,1),ya(i,Ne,Qe,et,r-Ke)}function zs(e,t,i,r,n,k,H){var $=st(function(ge){var De=n[ge],we=De.level!=1;return xa(Jr(e,Xe(i,we?De.to:De.from,we?"before":"after"),"line",t,r),k,H,!0)},0,n.length-1),J=n[$];if($>0){var ee=J.level!=1,ce=Jr(e,Xe(i,ee?J.from:J.to,ee?"after":"before"),"line",t,r);xa(ce,k,H,!0)&&ce.top>H&&(J=n[$-1])}return J}function Ks(e,t,i,r,n,k,H){var $=po(e,t,r,H),J=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,De=0;De<n.length;De++){var we=n[De];if(we.from>=ee||we.to<=J)continue;var Ne=we.level!=1,Ke=ai(e,r,Ne?Math.min(ee,we.to)-1:Math.max(J,we.from)).right,Qe=Ke<k?k-Ke+1e9:Ke-k;(!ce||ge>Qe)&&(ce=we,ge=Qe)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Ni;function Qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ni==null){Ni=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ni.appendChild(document.createTextNode("x")),Ni.appendChild(a("br"));Ni.appendChild(document.createTextNode("x"))}u(e.measure,Ni);var i=Ni.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Ji(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,k=t.gutters.firstChild,H=0;k;k=k.nextSibling,++H){var $=e.display.gutterSpecs[H].className;i[$]=k.offsetLeft+k.clientLeft+n,r[$]=k.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Qi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ji(e.display)-3);return function(n){if(Qr(e.doc,n))return 0;var k=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(k+=n.widgets[H].height);return i?k+(Math.ceil(n.text.length/r)||1)*t:k+t}}function Ca(e){var t=e.doc,i=go(e);t.iter(function(r){var n=i(r);n!=r.height&&Ar(r,n)})}function Bi(e,t,i,r){var n=e.display;if(!i&&ke(t).getAttribute("cm-not-content")=="true")return null;var k,H,$=n.lineSpace.getBoundingClientRect();try{k=t.clientX-$.left,H=t.clientY-$.top}catch(ge){return null}var J=ba(e,k,H),ee;if(r&&J.xRel>0&&(ee=ft(e.doc,J.line).text).length==J.ch){var ce=X(ee,ee.length,e.options.tabSize)-ee.length;J=Xe(J.line,Math.max(0,Math.round((k-ro(e.display).left)/Ji(e.display))-ce))}return J}function Fi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Dr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Lr&&xi(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)Lr&&Un(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var k=Gn(e,i,i+r,1);k?(n.view=n.view.slice(k.index),n.viewFrom=k.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var H=Gn(e,t,t,-1);H?(n.view=n.view.slice(0,H.index),n.viewTo=H.lineN):Ci(e)}else{var $=Gn(e,t,t,-1),J=Gn(e,i,i+r,1);$&&J?(n.view=n.view.slice(0,$.index).concat(Qt(e,$.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Ci(e)}var ee=n.externalMeasured;ee&&(i<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.size&&(n.externalMeasured=null))}function Si(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var k=r.view[Fi(e,t)];if(k.node==null)return;var H=k.changes||(k.changes=[]);ae(H,i)==-1&&H.push(i)}function Ci(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,i,r){var n=Fi(e,t),k,H=e.display.view;if(!Lr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var $=e.display.viewFrom,J=0;J<n;J++)$+=H[J].size;if($!=t){if(r>0){if(n==H.length-1)return null;k=$+H[n].size-t,n++}else k=$-t;t+=k,i+=k}for(;xi(e.doc,i)!=i;){if(n==(r<0?0:H.length-1))return null;i+=r*H[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=Qt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Qt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Fi(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Qt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Fi(e,i)))),r.viewTo=i}function vo(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),k=r.selection=document.createDocumentFragment(),H=0;H<i.sel.ranges.length;H++){if(!t&&H==i.sel.primIndex)continue;var $=i.sel.ranges[H];if($.from().line>=e.display.viewTo||$.to().line<e.display.viewFrom)continue;var J=$.empty();(J||e.options.showCursorWhenSelecting)&&bo(e,$.head,n),J||Xs(e,$,k)}return r}function bo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var k=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=r.other.left+"px",k.style.top=r.other.top+"px",k.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,k=document.createDocumentFragment(),H=ro(e.display),$=H.left,J=Math.max(r.sizerWidth,Ii(e)-r.sizer.offsetLeft)-H.right,ee=n.direction=="ltr";function ce(tt,dt,Et,vt){dt<0&&(dt=0),dt=Math.round(dt),vt=Math.round(vt),k.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+tt+`px;
|
|
top: `+dt+"px; width: "+(Et==null?J-tt:Et)+`px;
|
|
height: `+(vt-dt)+"px"))}function ge(tt,dt,Et){var vt=ft(n,tt),Lt=vt.text.length,Yt,cr;function Jt(tr,Or){return va(e,Xe(tt,tr),"div",vt,Or)}function Fr(tr,Or,br){var ar=mo(e,vt,null,tr),rr=Or=="ltr"==(br=="after")?"left":"right",Zt=br=="after"?ar.begin:ar.end-(/\s/.test(vt.text.charAt(ar.end-1))?2:1);return Jt(Zt,rr)[rr]}var _r=$e(vt,n.direction);return ot(_r,dt||0,Et==null?Lt:Et,function(tr,Or,br,ar){var rr=br=="ltr",Zt=Jt(tr,rr?"left":"right"),Pr=Jt(Or-1,rr?"right":"left"),dn=dt==null&&tr==0,Di=Et==null&&Or==Lt,Er=ar==0,oi=!_r||ar==_r.length-1;if(Pr.top-Zt.top<=3){var fr=(ee?dn:Di)&&Er,Ya=(ee?Di:dn)&&oi,mi=fr?$:(rr?Zt:Pr).left,Gi=Ya?J:(rr?Pr:Zt).right;ce(mi,Zt.top,Gi-mi,Zt.bottom)}else{var zi,Tr,cn,$a;rr?(zi=ee&&dn&&Er?$:Zt.left,Tr=ee?J:Fr(tr,br,"before"),cn=ee?$:Fr(Or,br,"after"),$a=ee&&Di&&oi?J:Pr.right):(zi=ee?Fr(tr,br,"before"):$,Tr=!ee&&dn&&Er?J:Zt.right,cn=!ee&&Di&&oi?$:Pr.left,$a=ee?Fr(Or,br,"after"):J),ce(zi,Zt.top,Tr-zi,Zt.bottom),Zt.bottom<Pr.top&&ce($,Zt.bottom,null,Pr.top),ce(cn,Pr.top,$a-cn,Pr.bottom)}(!Yt||zn(Zt,Yt)<0)&&(Yt=Zt),zn(Pr,Yt)<0&&(Yt=Pr),(!cr||zn(Zt,cr)<0)&&(cr=Zt),zn(Pr,cr)<0&&(cr=Pr)}),{start:Yt,end:cr}}var De=t.from(),we=t.to();if(De.line==we.line)ge(De.line,De.ch,we.ch);else{var Ne=ft(n,De.line),Ke=ft(n,we.line),Qe=nr(Ne)==nr(Ke),et=ge(De.line,De.ch,Qe?Ne.text.length+1:null).end,lt=ge(we.line,Qe?0:null,we.ch).start;Qe&&(et.top<lt.top-2?(ce(et.right,et.top,null,et.bottom),ce($,lt.top,lt.left,lt.bottom)):ce(et.right,et.top,lt.left-et.right,et.bottom)),et.bottom<lt.top&&ce($,et.bottom,null,lt.top)}i.appendChild(k)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ie(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ie(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],k=e.options.lineWrapping,H=void 0,$=0;if(n.hidden)continue;if(j&&B<8){var J=n.node.offsetTop+n.node.offsetHeight;H=J-i,i=J}else{var ee=n.node.getBoundingClientRect();H=ee.bottom-ee.top,!k&&n.text.firstChild&&($=n.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=n.line.height-H;if((ce>.005||ce<-.005)&&(Ar(n.line,H),So(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)So(n.rest[ge]);if($>e.display.sizerWidth){var De=Math.ceil($/Ji(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function So(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,k=Vr(t,r),H=Vr(t,n);if(i&&i.ensure){var $=i.ensure.from.line,J=i.ensure.to.line;$<k?(k=$,H=Vr(t,Nr(ft(t,$))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=H&&(k=Vr(t,Nr(ft(t,J))-e.wrapper.clientHeight),H=J)}return{from:k,to:Math.max(H,k+1)}}function Ys(e,t){if(He(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!C){var k=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(n),e.display.lineSpace.removeChild(k)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Xe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Xe(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var H=!1,$=Jr(e,t),J=!i||i==t?$:Jr(e,i);n={left:Math.min($.left,J.left),top:Math.min($.top,J.top)-r,right:Math.max($.left,J.left),bottom:Math.max($.bottom,J.bottom)+r};var ee=Aa(e,n),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xn(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(H=!0)),ee.scrollLeft!=null&&(Ui(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(H=!0)),!H)break}return n}function Qs(e,t){var i=Aa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ui(e,i.scrollLeft)}function Aa(e,t){var i=e.display,r=Qi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,k=pa(e),H={};t.bottom-t.top>k&&(t.bottom=t.top+k);var $=e.doc.height+fa(i),J=t.top<r,ee=t.bottom>$-r;if(t.top<n)H.scrollTop=J?0:t.top;else if(t.bottom>n+k){var ce=Math.min(t.top,(ee?$:t.bottom)-k);ce!=n&&(H.scrollTop=ce)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,we=Ii(e)-i.gutters.offsetWidth,Ne=t.right-t.left>we;return Ne&&(t.right=t.left+we),t.left<10?H.scrollLeft=0:t.left<De?H.scrollLeft=Math.max(0,t.left+ge-(Ne?0:10)):t.right>we+De-3&&(H.scrollLeft=t.right+(Ne?0:10)-we),H}function La(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qi(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=fo(e,t.from),r=fo(e,t.to);Co(e,i,r,t.margin)}}function Co(e,t,i,r){var n=Aa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||Da(e,{top:t}),To(e,t,!0),R&&Da(e),Cn(e,100)}function To(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ui(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,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(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+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ji=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),Oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.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 k=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},ji.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.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 q,this.disableVert=new q},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),k=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ji.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function en(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),wo(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function wo(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 Ao={native:ji,null:Sn};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ui(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Wi(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:++Zs},Rt(e.curOp)}function Hi(e){var t=e.curOp;t&&Gt(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var k=0;k<t.length;k++)il(t[k]);for(var H=0;H<t.length;H++)nl(t[H])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&ci(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&ka(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(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+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ui(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&en(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&ko(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&To(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ui(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var k=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(k)for(var $=0;$<k.length;++$)k[$].lines.length||Ie(k[$],"hide");if(H)for(var J=0;J<H.length;++J)H[J].lines.length&&Ie(H[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ie(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Br(e,t){if(e.curOp)return t();Wi(e);try{return t()}finally{Hi(e)}}function hr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Cr(e){return function(){if(this.curOp)return e.apply(this,arguments);Wi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function dr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Re(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(r.line>=e.display.viewFrom){var H=k.styles,$=k.text.length>e.options.maxHighlightLength?wr(t.mode,r.state):null,J=ve(e,k,r,!0);$&&(r.state=$),k.styles=J.styles;var ee=k.styleClasses,ce=J.classes;ce?k.styleClasses=ce:ee&&(k.styleClasses=null);for(var ge=!H||H.length!=k.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),De=0;!ge&&De<H.length;++De)ge=H[De]!=k.styles[De];ge&&n.push(r.line),k.stateAfter=r.save(),r.nextLine()}else k.text.length<=e.options.maxHighlightLength&&ct(e,k.text,r),k.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Br(e,function(){for(var k=0;k<n.length;k++)Si(e,n[k],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=Ea(e),this.events=[]};Yn.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ie.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=O();if(!t||!v(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==O())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function ka(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ci(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&vo(e)==0)return!1;Ro(e)&&(Ci(e),t.dims=Ea(e));var n=r.first+r.size,k=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<k&&k-i.viewFrom<20&&(k=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),Lr&&(k=xi(e.doc,k),H=Un(e.doc,H));var $=k!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,k,H),i.viewOffset=Nr(ft(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=vo(e);if(!$&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var ee=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(ee),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,$&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function ko(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+fa(e.display)-pa(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!ka(e,t))break;Kn(e);var n=En(e);yn(e),en(e,n),_a(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 Da(e,t){var i=new Yn(e,t);if(ka(e,i)){Kn(e),ko(e,i);var r=En(e);yn(e),en(e,r),_a(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,k=r.lineDiv,H=k.firstChild;function $(Ne){var Ke=Ne.nextSibling;return P&&l&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),Ke}for(var J=r.view,ee=r.viewFrom,ce=0;ce<J.length;ce++){var ge=J[ce];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=k){var De=Ns(e,ge,ee,i);k.insertBefore(De,H)}else{for(;H!=ge.node;)H=$(H);var we=n&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(ae(ge.changes,"gutter")>-1&&(we=!1),pn(e,ge,ee,i)),we&&(c(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(gi(e.options,ee)))),H=ge.node.nextSibling}ee+=ge.size}for(;H;)H=$(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(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+ni(e)+"px"}function Do(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,k=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=k),i[H].gutterBackground&&(i[H].gutterBackground.style.left=k));var $=i[H].alignable;if($)for(var J=0;J<$.length;J++)$[J].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=gi(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=n.firstChild.offsetWidth,H=n.offsetWidth-k;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(k,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function Oa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var k=e[n],H=null;if(typeof k!="string"&&(H=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:k,style:H})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function _o(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],k=n.className,H=n.style,$=t.appendChild(a("div",null,"CodeMirror-gutter "+k));H&&($.style.cssText=H),k=="CodeMirror-linenumbers"&&(e.lineGutter=$,$.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Ra(e)}function Tn(e){_o(e.display),Dr(e),Do(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=S("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=S("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var k=S("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[k],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+de+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),j&&B<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!P&&!(R&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Oa(r.gutters,r.lineNumbers),_o(n),i.init(n)}var $n=0,Gr=null;j?Gr=-.53:R?Gr=15:p?Gr=-.7:M&&(Gr=-1/3);function Oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Oo(e);return t.x*=Gr,t.y*=Gr,t}function Po(e,t){var i=Oo(t),r=i.x,n=i.y,k=e.display,H=k.scroller,$=H.scrollWidth>H.clientWidth,J=H.scrollHeight>H.clientHeight;if(!(r&&$||n&&J))return;if(n&&l&&P){e:for(var ee=t.target,ce=k.view;ee!=H;ee=ee.parentNode)for(var ge=0;ge<ce.length;ge++)if(ce[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!R&&!b&&Gr!=null){n&&J&&xn(e,Math.max(0,H.scrollTop+n*Gr)),Ui(e,Math.max(0,H.scrollLeft+r*Gr)),(!n||n&&J)&&re(t),k.wheelStartX=null;return}if(n&&Gr!=null){var De=n*Gr,we=e.doc.scrollTop,Ne=we+k.wrapper.clientHeight;De<0?we=Math.max(0,we+De-50):Ne=Math.min(e.doc.height,Ne+De+50),Da(e,{top:we,bottom:Ne})}$n<20&&(k.wheelStartX==null?(k.wheelStartX=H.scrollLeft,k.wheelStartY=H.scrollTop,k.wheelDX=r,k.wheelDY=n,setTimeout(function(){if(k.wheelStartX==null)return;var Ke=H.scrollLeft-k.wheelStartX,Qe=H.scrollTop-k.wheelStartY,et=Qe&&k.wheelDY&&Qe/k.wheelDY||Ke&&k.wheelDX&&Ke/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!et)return;Gr=(Gr*$n+et)/($n+1),++$n},200)):(k.wheelDX+=r,k.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!ei(i.anchor,r.anchor)||!ei(i.head,r.head))return!1}return!0},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(hi(this.ranges[t].anchor),hi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Ri(this.anchor,this.head)},jt.prototype.to=function(){return di(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,we){return St(De.from(),we.from())}),i=ae(t,n);for(var k=1;k<t.length;k++){var H=t[k],$=t[k-1],J=St($.to(),H.from());if(r&&!H.empty()?J>0:J>=0){var ee=Ri($.from(),H.from()),ce=di($.to(),H.to()),ge=$.empty()?H.from()==H.head:$.from()==$.head;k<=i&&--i,t.splice(--k,2,new jt(ge?ce:ee,ge?ee:ce))}}return new zr(t,i)}function Ti(e,t){return new zr([new jt(e,t||e)],0)}function wi(e){return e.text?Xe(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return wi(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+=wi(t).ch-t.to.ch),Xe(i,r)}function Pa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Mo(n.anchor,t),Mo(n.head,t)))}return Zr(e.cm,i,e.sel.primIndex)}function Io(e,t,i){return e.line==t.line?Xe(i.line,e.ch-t.ch+i.ch):Xe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Xe(e.first,0),k=n,H=0;H<t.length;H++){var $=t[H],J=Io($.from,n,k),ee=Io(wi($),n,k);if(n=$.to,k=ee,i=="around"){var ce=e.sel.ranges[H],ge=St(ce.head,ce.anchor)<0;r[H]=new jt(ge?ee:J,ge?J:ee)}else r[H]=new jt(J,J)}return new zr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Sr(e.options,e.doc.modeOption),wn(e)}function wn(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Cn(e,100),e.state.modeGen++,e.curOp&&Dr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,i,r){function n(lt){return i?i[lt]:null}function k(lt,tt,dt){ua(lt,tt,dt,r),Vt(lt,"change",lt,t)}function H(lt,tt){for(var dt=[],Et=lt;Et<tt;++Et)dt.push(new Ei(ee[Et],n(Et),r));return dt}var $=t.from,J=t.to,ee=t.text,ce=ft(e,$.line),ge=ft(e,J.line),De=te(ee),we=n(ee.length-1),Ne=J.line-$.line;if(t.full)e.insert(0,H(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(No(e,t)){var Ke=H(0,ee.length-1);k(ge,ge.text,we),Ne&&e.remove($.line,Ne),Ke.length&&e.insert($.line,Ke)}else if(ce==ge)if(ee.length==1)k(ce,ce.text.slice(0,$.ch)+De+ce.text.slice(J.ch),we);else{var Qe=H(1,ee.length-1);Qe.push(new Ei(De+ce.text.slice(J.ch),we,r)),k(ce,ce.text.slice(0,$.ch)+ee[0],n(0)),e.insert($.line+1,Qe)}else if(ee.length==1)k(ce,ce.text.slice(0,$.ch)+ee[0]+ge.text.slice(J.ch),n(0)),e.remove($.line+1,Ne);else{k(ce,ce.text.slice(0,$.ch)+ee[0],n(0)),k(ge,De+ge.text.slice(J.ch),we);var et=H(1,ee.length-1);Ne>1&&e.remove($.line+1,Ne-1),e.insert($.line+1,et)}Vt(e,"change",e,t)}function Ai(e,t,i){function r(n,k,H){if(n.linked)for(var $=0;$<n.linked.length;++$){var J=n.linked[$];if(J.doc==k)continue;var ee=H&&J.sharedHist;if(i&&!ee)continue;t(J.doc,ee),r(J.doc,n,ee)}}r(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Ma(e),Fo(e),e.options.lineWrapping||ci(e),e.options.mode=t.modeOption,Dr(e)}function Fo(e){(e.doc.direction=="rtl"?F:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Br(e,function(){Fo(e),Dr(e)})}function Qn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Na(e,t){var i={from:hi(t.from),to:wi(t),text:Ur(e,t.from,t.to)};return Wo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Wo(r,i,t.from.line,t.to.line+1)},!0),i}function Uo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function jo(e,t,i,r){var n=e.history;n.undone.length=0;var k=+new Date,H,$;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(n,n.lastOp==r)))$=te(H.changes),St(t.from,t.to)==0&&St(t.from,$.to)==0?$.to=wi(t):H.changes.push(Na(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Jn(e.sel,n.done),H={changes:[Na(e,t)],generation:n.generation},n.done.push(H);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=k,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,$||Ie(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,k=r&&r.origin;i==n.lastSelOp||k&&n.lastSelOrigin==k&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==k||ml(e,k,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=k,n.lastSelOp=i,r&&r.clearRedo!==!1&&Uo(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Wo(e,t,i,r){var n=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((n||(n=t["spans_"+e.id]={}))[k]=H.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Ho(e,t){var i=yl(e,t),r=Mr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var k=i[n],H=r[n];if(k&&H){e:for(var $=0;$<H.length;++$){for(var J=H[$],ee=0;ee<k.length;++ee)if(k[ee].marker==J.marker)continue e;k.push(J)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var k=e[n];if(k.ranges){r.push(i?zr.prototype.deepCopy.call(k):k);continue}var H=k.changes,$=[];r.push({changes:$});for(var J=0;J<H.length;++J){var ee=H[J],ce=void 0;if($.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(ce=ge.match(/^spans_(\d+)$/))&&(ae(t,Number(ce[1]))>-1&&(te($)[ge]=ee[ge],delete ee[ge]))}}return r}function Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var k=St(t,n)<0;k!=St(i,n)<0?(n=t,t=i):k!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Zn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),xr(e,new zr([Ba(e.sel.primary(),t,i,n)],0),r)}function Go(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)r[k]=Ba(e.sel.ranges[k],t[k],null,n);var H=Zr(e.cm,r,e.sel.primIndex);xr(e,H,i)}function Fa(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,xr(e,Zr(e.cm,n,e.sel.primIndex),r)}function zo(e,t,i,r){xr(e,Ti(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var k=0;k<n.length;k++)this.ranges[k]=new jt(s(e,n[k].anchor),s(e,n[k].head))},origin:i&&i.origin};return Ie(e,"beforeSelectionChange",e,r),e.cm&&Ie(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Zr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):xr(e,t,i)}function xr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&qi(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),Vt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,k=0;k<t.ranges.length;k++){var H=t.ranges[k],$=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],J=ea(e,H.anchor,$&&$.anchor,i,r),ee=ea(e,H.head,$&&$.head,i,r);(n||J!=H.anchor||ee!=H.head)&&(n||(n=t.ranges.slice(0,k)),n[k]=new jt(J,ee))}return n?Zr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var k=ft(e,t.line);if(k.markedSpans)for(var H=0;H<k.markedSpans.length;++H){var $=k.markedSpans[H],J=$.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if(($.from==null||(ee?$.from<=t.ch:$.from<t.ch))&&($.to==null||(ce?$.to>=t.ch:$.to>t.ch))){if(n&&(Ie(J,"beforeCursorEnter"),J.explicitlyCleared))if(k.markedSpans){--H;continue}else break;if(!J.atomic)continue;if(i){var ge=J.find(r<0?1:-1),De=void 0;if((r<0?ce:ee)&&(ge=$o(e,ge,-r,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(De=St(ge,i))&&(r<0?De<0:De>0))return rn(e,ge,t,r,n)}var we=J.find(r<0?-1:1);return(r<0?ee:ce)&&(we=$o(e,we,r,we.line==t.line?k:null)),we?rn(e,we,t,r,n):null}}return t}function ea(e,t,i,r,n){var k=r||1,H=rn(e,t,i,k,n)||!n&&rn(e,t,i,k,!0)||rn(e,t,i,-k,n)||!n&&rn(e,t,i,-k,!0);return H||(e.cantEdit=!0,Xe(e.first,0))}function $o(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Xe(t.line-1)):null:i>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?Xe(t.line+1,0):null:new Xe(t.line,t.ch+i)}function Qo(e){e.setSelection(Xe(e.firstLine(),0),Xe(e.lastLine()),be)}function Jo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,k,H,$){n&&(r.from=s(e,n)),k&&(r.to=s(e,k)),H&&(r.text=H),$!==void 0&&(r.origin=$)}),Ie(e,"beforeChange",e,r),e.cm&&Ie(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function nn(e,t,i){if(e.cm){if(!e.cm.curOp)return hr(e.cm,nn)(e,t,i);if(e.cm.state.suppressEdits)return}if((me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ki&&!i&&_i(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Zo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var i=Pa(e,t);jo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Mr(e,t));var r=[];Ai(e,function(n,k){!k&&ae(r,n.history)==-1&&(rs(n.history,t),r.push(n.history)),An(n,t,null,Mr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,k,H=e.sel,$=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<$.length&&!(k=$[ee],i?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==$.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(k=$.pop(),k.ranges){if(Jn(k,J),i&&!k.equals(e.sel)){xr(e,k,{clearRedo:!1});return}H=k}else if(r){$.push(k);return}else break;var ce=[];Jn(H,J),J.push({changes:ce,generation:n.generation}),n.generation=k.generation||++n.maxGeneration;for(var ge=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),De=function(Ke){var Qe=k.changes[Ke];if(Qe.origin=t,ge&&!Jo(e,Qe,!1))return $.length=0,{};ce.push(Na(e,Qe));var et=Ke?Pa(e,Qe):te($);An(e,Qe,et,Ho(e,Qe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Qe.from,to:wi(Qe)});var lt=[];Ai(e,function(tt,dt){!dt&&ae(lt,tt.history)==-1&&(rs(tt.history,Qe),lt.push(tt.history)),An(tt,Qe,null,Ho(tt,Qe))})},we=k.changes.length-1;we>=0;--we){var Ne=De(we);if(Ne)return Ne.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(fe(e.sel.ranges,function(n){return new jt(Xe(n.anchor.line+t,n.anchor.ch),Xe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Dr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Si(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return hr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);qo(e,n),t={from:Xe(e.first,0),to:Xe(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Xe(k,ft(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ur(e,t.from,t.to),i||(i=Pa(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),qn(e,i,be),e.cantEdit&&ea(e,Xe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,k=t.from,H=t.to,$=!1,J=k.line;e.options.lineWrapping||(J=Ot(nr(ft(r,k.line))),r.iter(J,H.line+1,function(we){if(we==n.maxLine)return $=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),Ia(r,t,i,go(e)),e.options.lineWrapping||(r.iter(J,k.line+t.text.length,function(we){var Ne=Yi(we);Ne>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=Ne,n.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Xr(r,k.line),Cn(e,400);var ee=t.text.length-(H.line-k.line)-1;t.full?Dr(e):k.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,k.line,"text"):Dr(e,k.line,H.line+1,ee);var ce=me(e,"changes"),ge=me(e,"change");if(ge||ce){var De={from:k,to:H,text:t.text,removed:t.removed,origin:t.origin};ge&&Vt(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var k;r||(r=i),St(r,i)<0&&(k=[r,i],i=k[0],r=k[1]),typeof t=="string"&&(t=e.splitLines(t)),nn(e,{from:i,to:r,text:t,origin:n})}function es(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,i,r){for(var n=0;n<e.length;++n){var k=e[n],H=!0;if(k.ranges){k.copied||(k=e[n]=k.deepCopy(),k.copied=!0);for(var $=0;$<k.ranges.length;$++)es(k.ranges[$].anchor,t,i,r),es(k.ranges[$].head,t,i,r);continue}for(var J=0;J<k.changes.length;++J){var ee=k.changes[J];if(i<ee.from.line)ee.from=Xe(ee.from.line+r,ee.from.ch),ee.to=Xe(ee.to.line+r,ee.to.ch);else if(t<=ee.to.line){H=!1;break}}H||(e.splice(0,n+1),n=0)}}function rs(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;ts(e.done,i,r,n),ts(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,k=t;return typeof t=="number"?k=ft(e,K(e,t)):n=Ot(t),n==null?null:(r(k,n)&&e.cm&&Si(e.cm,n,i),k)}function kn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}kn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,ha(n),Vt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Dn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Dn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var k=Math.min(t,n-e),H=r.height;if(r.removeInner(e,k),this.height-=H-r.height,n==k&&(this.children.splice(i--,1),r.parent=null),(t-=k)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof kn))){var $=[];this.collapse($),this.children=[new kn($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],k=n.chunkSize();if(e<=k){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var H=n.lines.length%25+25,$=H;$<n.lines.length;){var J=new kn(n.lines.slice($,$+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,H),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Dn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ae(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Dn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],k=n.chunkSize();if(e<k){var H=Math.min(t,k-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=k}}};var Rn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Rn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Ot(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var k=gn(this);Ar(i,Math.max(0,i.height-k)),e&&(Br(e,function(){is(e,i,-k),Si(e,r,"widget")}),Vt(e,"lineWidgetCleared",e,this,r))},Rn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;Qr(this.doc,r)||Ar(r,r.height+n),i&&Br(i,function(){i.curOp.forceUpdate=!0,is(i,r,n),Vt(i,"lineWidgetChanged",i,e,Ot(r))})},ye(Rn);function is(e,t,i){Nr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,i)}function El(e,t,i,r){var n=new Rn(e,i,r),k=e.cm;return k&&n.noHScroll&&(k.display.alignWidgets=!0),Ln(e,t,"widget",function(H){var $=H.widgets||(H.widgets=[]);if(n.insertAt==null?$.push(n):$.splice(Math.min($.length-1,Math.max(0,n.insertAt)),0,n),n.line=H,k&&!Qr(e,H)){var J=Nr(H)<e.scrollTop;Ar(H,H.height+gn(n)),J&&La(k,n.height),k.curOp.forceUpdate=!0}return!0}),k&&Vt(k,"lineWidgetAdded",k,n,typeof t=="number"?t:Ot(t)),n}var ns=0,Li=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),me(this,"clear")){var i=this.find();i&&Vt(this,"clear",i.from,i.to)}for(var r=null,n=null,k=0;k<this.lines.length;++k){var H=this.lines[k],$=$r(H.markedSpans,this);e&&!this.collapsed?Si(e,Ot(H),"text"):e&&($.to!=null&&(n=Ot(H)),$.from!=null&&(r=Ot(H))),H.markedSpans=ri(H.markedSpans,$),$.from==null&&this.collapsed&&!Qr(this.doc,H)&&e&&Ar(H,Qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=nr(this.lines[J]),ce=Yi(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Dr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Vt(e,"markerCleared",e,this,r,n),t&&Hi(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var k=this.lines[n],H=$r(k.markedSpans,this);if(H.from!=null&&(i=Xe(t?k:Ot(k),H.from),e==-1))return i;if(H.to!=null&&(r=Xe(t?k:Ot(k),H.to),e==1))return r}return i&&{from:i,to:r}},Li.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Br(r,function(){var n=t.line,k=Ot(t.line),H=ma(r,k);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Qr(i.doc,n)&&i.height!=null){var $=i.height;i.height=null;var J=gn(i)-$;J&&Ar(n,n.height+J)}Vt(r,"markerChanged",r,e)})},Li.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Li.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(Li);function on(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return hr(e.cm,on)(e,t,i,r,n);var k=new Li(e,n),H=St(t,i);if(r&&N(r,k,!1),H>0||H==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=S("span",[k.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ir(e,t.line,t,i,k)||t.line!=i.line&&ir(e,i.line,t,i,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");ti()}k.addToHistory&&jo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var $=t.line,J=e.cm,ee;if(e.iter($,i.line+1,function(ge){J&&k.collapsed&&!J.options.lineWrapping&&nr(ge)==J.display.maxLine&&(ee=!0),k.collapsed&&$!=t.line&&Ar(ge,0),Hr(ge,new vi(k,$==t.line?t.ch:null,$==i.line?i.ch:null)),++$}),k.collapsed&&e.iter(t.line,i.line+1,function(ge){Qr(e,ge)&&Ar(ge,0)}),k.clearOnEnter&&Oe(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++ns,k.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),k.collapsed)Dr(J,t.line,i.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ce=t.line;ce<=i.line;ce++)Si(J,ce,"text");k.atomic&&Xo(J.doc),Vt(J,"markerAdded",J,k)}return k}var _n=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};_n.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Vt(this,"clear")},_n.prototype.find=function(e,t){return this.primary.find(e,t)},ye(_n);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var k=[on(e,t,i,r,n)],H=k[0],$=r.widgetNode;return Ai(e,function(J){$&&(r.widgetNode=$.cloneNode(!0)),k.push(on(J,s(J,t),s(J,i),r,n));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;H=te(k)}),new _n(k,H)}function as(e){return e.findMarks(Xe(e.first,0),e.clipPos(Xe(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),k=e.clipPos(n.from),H=e.clipPos(n.to);if(St(k,H)){var $=on(e,k,H,r.primary,r.primary.type);r.markers.push($),$.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],k=[n.primary.doc];Ai(n.primary.doc,function(J){return k.push(J)});for(var H=0;H<n.markers.length;H++){var $=n.markers[H];ae(k,$.doc)==-1&&($.parent=null,n.markers.splice(H--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Rr=function(e,t,i,r,n){if(!(this instanceof Rr))return new Rr(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new kn([new Ei("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var k=Xe(i,0);this.sel=Ti(k),this.history=new Qn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ia(this,{from:k,to:k,text:e}),xr(this,Ti(k),be)};Rr.prototype=_e(Dn.prototype,{constructor:Rr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:dr(function(e){var t=Xe(this.first,0),i=this.first+this.size-1;nn(this,{from:t,to:Xe(i,ft(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),xr(this,Ti(t),be)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=Ur(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ui(this,e))return ft(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),nr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:dr(function(e,t,i){zo(this,s(this,typeof e=="number"?Xe(e,t||0):e),null,i)}),setSelection:dr(function(e,t,i){zo(this,s(this,e),s(this,t||e),i)}),extendSelection:dr(function(e,t,i){Zn(this,s(this,e),t&&s(this,t),i)}),extendSelections:dr(function(e,t){Go(this,G(this,e),t)}),extendSelectionsBy:dr(function(e,t){var i=fe(this.sel.ranges,e);Go(this,G(this,i),t)}),setSelections:dr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),xr(this,Zr(this.cm,r,t),i)}),addSelection:dr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),xr(this,Zr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Ur(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Ur(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:dr(function(e,t,i){for(var r=[],n=this.sel,k=0;k<n.ranges.length;k++){var H=n.ranges[k];r[k]={from:H.from(),to:H.to(),text:this.splitLines(e[k]),origin:i}}for(var $=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)nn(this,r[J]);$?Ko(this,$):this.cm&&qi(this.cm)}),undo:dr(function(){ta(this,"undo")}),redo:dr(function(){ta(this,"redo")}),undoSelection:dr(function(){ta(this,"undo",!0)}),redoSelection:dr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ai(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:tn(this.history.done),undone:tn(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=tn(e.done.slice(0),null,!0),t.undone=tn(e.undone.slice(0),null,!0)},setGutterMarker:dr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ve(n)&&(r.gutterMarkers=null),!0})}),clearGutter:dr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ve(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ui(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=Ot(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:dr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(T(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:dr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=r[n];if(k)if(i==null)r[n]=null;else{var H=k.match(T(i));if(!H)return!1;var $=H.index+H[0].length;r[n]=k.slice(0,H.index)+(!H.index||$==k.length?"":" ")+k.slice($)||null}else return!1;return!0})}),addLineWidget:dr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return on(this,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=ft(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(k){var H=k.markedSpans;if(H)for(var $=0;$<H.length;$++){var J=H[$];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var k=n.text.length+r;if(k>e)return t=e,!0;e-=k,++i}),s(this,Xe(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Rr(li(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Rr(li(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof $t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(as(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=tn(this.history.done,r),e.history.undone=tn(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:dr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Rr.prototype.eachLine=Rr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),He(t,e)||fi(t.display,e))return;re(e),j&&(os=+new Date);var i=Bi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,k=Array(n),H=0,$=function(){++H==n&&hr(t,function(){i=s(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(k.filter(function(Ne){return Ne!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,we),Ko(t.doc,Ti(s(t.doc,i),s(t.doc,wi(we))))})()},J=function(we,Ne){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,we.type)==-1){$();return}var Ke=new FileReader;Ke.onerror=function(){return $()},Ke.onload=function(){var Qe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Qe)){$();return}k[Ne]=Qe,$()},Ke.readAsText(we)},ee=0;ee<r.length;ee++)J(r[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Ti(i,i)),ge)for(var De=0;De<ge.length;++De)an(t.doc,"",ge[De].anchor,ge[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(we){}}}function Ll(e,t){if(j&&(!e.state.draggingText||+new Date-os<100)){he(t);return}if(He(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),b&&i.parentNode.removeChild(i)}}function kl(e,t){var i=Bi(e,t);if(!i)return;var r=document.createDocumentFragment();bo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var k=0;k<i.length;k++)e(i[k])})}var us=!1;function Dl(){if(us)return;Rl(),us=!0}function Rl(){var e;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(_l)},100))}),Oe(window,"blur",function(){return ls(Zi)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ki={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},On=0;On<10;On++)ki[On+48]=ki[On+96]=String(On);for(var ra=65;ra<=90;ra++)ki[ra]=String.fromCharCode(ra);for(var Pn=1;Pn<=12;Pn++)ki[Pn+111]=ki[Pn+63235]="F"+Pn;var pi={};pi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},pi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},pi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},pi.default=l?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,k,H=0;H<t.length-1;H++){var $=t[H];if(/^(cmd|meta|m)$/i.test($))k=!0;else if(/^a(lt)?$/i.test($))i=!0;else if(/^(c|ctrl|control)$/i.test($))r=!0;else if(/^s(hift)?$/i.test($))n=!0;else throw new Error("Unrecognized modifier name: "+$)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=fe(i.split(" "),Ol),k=0;k<n.length;k++){var H=void 0,$=void 0;k==n.length-1?($=n.join(" "),H=r):($=n.slice(0,k+1).join(" "),H="...");var J=t[$];if(!J)t[$]=H;else if(J!=H)throw new Error("Inconsistent bindings for "+$)}delete e[i]}for(var ee in t)e[ee]=t[ee];return e}function sn(e,t,i,r){t=ia(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return sn(e,t.fallthrough,i,r);for(var k=0;k<t.fallthrough.length;k++){var H=sn(e,t.fallthrough[k],i,r);if(H)return H}}}function hs(e){var t=typeof e=="string"?e:ki[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var i=ki[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function ia(e){return typeof e=="string"?pi[e]:e}function ln(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var k=t(i[n]);r.length&&St(k.from,te(r).to)<=0;){var H=r.pop();if(St(H.from,k.from)<0){k.from=H.from;break}}r.push(k)}Br(e,function(){for(var $=r.length-1;$>=0;$--)an(e.doc,"",r[$].from,r[$].to,"+delete");qi(e)})}function Ua(e,t,i){var r=Ue(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ja(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Xe(t.line,r,i<0?"after":"before")}function Wa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var k=$e(i,t.doc.direction);if(k){var H=n<0?te(k):k[0],$=n<0==(H.level==1),J=$?"after":"before",ee;if(H.level>0||t.doc.direction=="rtl"){var ce=$i(t,i);ee=n<0?i.text.length-1:0;var ge=ai(t,ce,ee).top;ee=st(function(De){return ai(t,ce,De).top==ge},n<0==(H.level==1)?H.from:H.to-1,ee),J=="before"&&(ee=Ua(i,ee,1))}else ee=n<0?H.to:H.from;return new Xe(r,ee,J)}}return new Xe(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=$e(t,e.doc.direction);if(!n)return ja(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 k=Je(n,i.ch,i.sticky),H=n[k];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>i.ch:H.from<i.ch))return ja(t,i,r);var $=function(et,lt){return Ua(t,et instanceof Xe?et.ch:et,lt)},J,ee=function(et){return e.options.lineWrapping?(J=J||$i(e,t),mo(e,t,J,et)):{begin:0,end:t.text.length}},ce=ee(i.sticky=="before"?$(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var ge=H.level==1==r<0,De=$(i,ge?1:-1);if(De!=null&&(ge?De<=H.to&&De<=ce.end:De>=H.from&&De>=ce.begin)){var we=ge?"before":"after";return new Xe(i.line,De,we)}}var Ne=function(et,lt,tt){for(var dt=function(Yt,cr){return cr?new Xe(i.line,$(Yt,1),"before"):new Xe(i.line,Yt,"after")};et>=0&&et<n.length;et+=lt){var Et=n[et],vt=lt>0==(Et.level!=1),Lt=vt?tt.begin:$(tt.end,-1);if(Et.from<=Lt&&Lt<Et.to)return dt(Lt,vt);if(Lt=vt?Et.from:$(Et.to,-1),tt.begin<=Lt&&Lt<tt.end)return dt(Lt,vt)}},Ke=Ne(k+r,r,ce);if(Ke)return Ke;var Qe=r>0?ce.end:$(ce.begin,-1);return Qe!=null&&!(r>0&&Qe==t.text.length)&&(Ke=Ne(r>0?0:n.length-1,r,ee(Qe)),Ke)?Ke:null}var Mn={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return ln(e,function(t){if(t.empty()){var i=ft(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Xe(t.head.line+1,0)}:{from:t.head,to:Xe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:s(e.doc,Xe(t.to().line+1,0))}})},delLineLeft:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Xe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Xe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Te)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Te)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ps(e,t.head):r},Te)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var k=i[n].from(),H=X(e.getLine(k.line),k.ch,r);t.push(ue(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Br(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,k=ft(e.doc,n.line).text;if(k){if(n.ch==k.length&&(n=new Xe(n.line,n.ch-1)),n.ch>0)n=new Xe(n.line,n.ch+1),e.replaceRange(k.charAt(n.ch-1)+k.charAt(n.ch-2),Xe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var H=ft(e.doc,n.line-1).text;H&&(n=new Xe(n.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Xe(n.line-1,H.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Br(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);qi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var i=ft(e.doc,t),r=nr(i);return r!=i&&(t=Ot(r)),Wa(!0,e,r,t,1)}function Il(e,t){var i=ft(e.doc,t),r=ii(i);return r!=i&&(t=Ot(r)),Wa(!0,e,i,t,-1)}function ps(e,t){var i=fs(e,t.line),r=ft(e.doc,i.line),n=$e(r,e.doc.direction);if(!n||n[0].level==0){var k=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=k&&t.ch;return Xe(i.line,H?0:k,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Ae}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=sn(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&sn(t,e.options.extraKeys,i,e)||sn(t,e.options.keyMap,i,e)}var Bl=new q;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,n+" "+t,i,r))return!0}return ms(e,t,i,r)}function ms(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Vt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function gs(e,t){var i=cs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):In(e,i,t,function(r){return na(e,r)}):!1}function Fl(e,t,i){return In(e,"'"+i+"'",t,function(r){return na(e,r,!0)})}var Ha=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=O(),He(t,e))return;j&&B<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=gs(t,e);b&&(Ha=r?i:null,!r&&i==88&&!_t&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),at(document,"keyup",i),at(document,"mouseover",i))}Oe(document,"keyup",i),Oe(document,"mouseover",i)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||He(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(b&&i==Ha){Ha=null,re(e);return}if(b&&(!e.which||e.which<10)&&gs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Fl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Ga=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ga.prototype.compare=function(e,t,i){return this.time+jl>e&&St(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new Ga(i,e,t),Nn=null,"double"):(Nn=new Ga(i,e,t),Bn=null,"single")}function xs(e){var t=this,i=t.display;if(He(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){P||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(za(t,e))return;var r=Bi(t,e),n=Me(e),k=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,k,e))return;n==1?r?zl(t,r,k,e):ke(e)==i.scroller&&re(e):n==2?(r&&Zn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(D?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,i,r,n){var k="Click";return r=="double"?k="Double"+k:r=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,In(e,ds(k,n),n,function(H){if(typeof H=="string"&&(H=Mn[H]),!H)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=H(e,i)!=Ae}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var k=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=k?"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){j?setTimeout(I(xo,e),0):e.curOp.focus=O();var n=Gl(e,i,r),k=e.doc.sel,H;e.options.dragDrop&&Ye&&!e.isReadOnly()&&i=="single"&&(H=k.contains(t))>-1&&(St((H=k.ranges[H]).from(),t)<0||t.xRel>0)&&(St(H.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,k=!1,H=hr(e,function(ee){P&&(n.scroller.draggable=!1),e.state.draggingText=!1,at(n.wrapper.ownerDocument,"mouseup",H),at(n.wrapper.ownerDocument,"mousemove",$),at(n.scroller,"dragstart",J),at(n.scroller,"drop",H),k||(re(ee),r.addNew||Zn(e.doc,i,null,null,r.extend),P&&!M||j&&B==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),$=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return k=!0};P&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Oe(n.wrapper.ownerDocument,"mouseup",H),Oe(n.wrapper.ownerDocument,"mousemove",$),Oe(n.scroller,"dragstart",J),Oe(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Xe(t.line,0),s(e.doc,Xe(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,k=e.doc;re(t);var H,$,J=k.sel,ee=J.ranges;if(r.addNew&&!r.extend?($=k.sel.contains(i),$>-1?H=ee[$]:H=new jt(i,i)):(H=k.sel.primary(),$=k.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new jt(i,i)),i=Bi(e,t,!0,!0),$=-1;else{var ce=Es(e,i,r.unit);r.extend?H=Ba(H,ce.anchor,ce.head,r.extend):H=ce}r.addNew?$==-1?($=ee.length,xr(k,Zr(e,ee.concat([H]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&r.unit=="char"&&!r.extend?(xr(k,Zr(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),J=k.sel):Fa(k,$,H,Ce):($=0,xr(k,new zr([H],0),Ce),J=k.sel);var ge=i;function De(tt){if(St(ge,tt)==0)return;if(ge=tt,r.unit=="rectangle"){for(var dt=[],Et=e.options.tabSize,vt=X(ft(k,i.line).text,i.ch,Et),Lt=X(ft(k,tt.line).text,tt.ch,Et),Yt=Math.min(vt,Lt),cr=Math.max(vt,Lt),Jt=Math.min(i.line,tt.line),Fr=Math.min(e.lastLine(),Math.max(i.line,tt.line));Jt<=Fr;Jt++){var _r=ft(k,Jt).text,tr=Se(_r,Yt,Et);Yt==cr?dt.push(new jt(Xe(Jt,tr),Xe(Jt,tr))):_r.length>tr&&dt.push(new jt(Xe(Jt,tr),Xe(Jt,Se(_r,cr,Et))))}dt.length||dt.push(new jt(i,i)),xr(k,Zr(e,J.ranges.slice(0,$).concat(dt),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(tt)}else{var Or=H,br=Es(e,tt,r.unit),ar=Or.anchor,rr;St(br.anchor,ar)>0?(rr=br.head,ar=Ri(Or.from(),br.anchor)):(rr=br.anchor,ar=di(Or.to(),br.head));var Zt=J.ranges.slice(0);Zt[$]=Xl(e,new jt(s(k,ar),rr)),xr(k,Zr(e,Zt,$),Ce)}}var we=n.wrapper.getBoundingClientRect(),Ne=0;function Ke(tt){var dt=++Ne,Et=Bi(e,tt,!0,r.unit=="rectangle");if(!Et)return;if(St(Et,ge)!=0){e.curOp.focus=O(),De(Et);var vt=Vn(n,k);(Et.line>=vt.to||Et.line<vt.from)&&setTimeout(hr(e,function(){Ne==dt&&Ke(tt)}),150)}else{var Lt=tt.clientY<we.top?-20:tt.clientY>we.bottom?20:0;Lt&&setTimeout(hr(e,function(){if(Ne!=dt)return;n.scroller.scrollTop+=Lt,Ke(tt)}),50)}}function Qe(tt){e.state.selectingText=!1,Ne=Infinity,tt&&(re(tt),n.input.focus()),at(n.wrapper.ownerDocument,"mousemove",et),at(n.wrapper.ownerDocument,"mouseup",lt),k.history.lastSelOrigin=null}var et=hr(e,function(tt){tt.buttons===0||!Me(tt)?Qe(tt):Ke(tt)}),lt=hr(e,Qe);e.state.selectingText=lt,Oe(n.wrapper.ownerDocument,"mousemove",et),Oe(n.wrapper.ownerDocument,"mouseup",lt)}function Xl(e,t){var i=t.anchor,r=t.head,n=ft(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var k=$e(n);if(!k)return t;var H=Je(k,i.ch,i.sticky),$=k[H];if($.from!=i.ch&&$.to!=i.ch)return t;var J=H+($.from==i.ch==($.level!=1)?0:1);if(J==0||J==k.length)return t;var ee;if(r.line!=i.line)ee=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Je(k,r.ch,r.sticky),ge=ce-H||(r.ch-i.ch)*($.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var De=k[J+(ee?-1:0)],we=ee==(De.level==1),Ne=we?De.from:De.to,Ke=we?"after":"before";return i.ch==Ne&&i.sticky==Ke?t:new jt(new Xe(i.line,Ne,Ke),r)}function Ss(e,t,i,r){var n,k;if(t.touches)n=t.touches[0].clientX,k=t.touches[0].clientY;else try{n=t.clientX,k=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var H=e.display,$=H.lineDiv.getBoundingClientRect();if(k>$.bottom||!me(e,i))return le(t);k-=$.top-H.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=H.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=n){var ce=Vr(e.doc,k),ge=e.display.gutterSpecs[J];return Ie(e,i,e,ce,ge.className,t),le(t)}}}function za(e,t){return Ss(e,t,"gutterClick",!0)}function Cs(e,t){if(fi(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return me(e,"gutterContextMenu")?Ss(e,t,"gutterContextMenu",!1):!1}function Ts(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var un={toString:function(){return"CodeMirror.Init"}},ws={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,k,H){e.defaults[r]=n,k&&(t[r]=H?function($,J,ee){ee!=un&&k($,J,ee)}:k)}e.defineOption=i,e.Init=un,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ma(r)},!0),i("indentUnit",2,Ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Dr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var k=[],H=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(n,ee);if(ce==-1)break;ee=ce+n.length,k.push(Xe(H,ce))}H++});for(var $=k.length-1;$>=0;$--)an(r.doc,n,k[$],Xe(k[$].line,k[$].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,k){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),k!=un&&r.refresh()}),i("specialCharPlaceholder",pt,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",!w),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,k){var H=ia(n),$=k!=un&&ia(k);$&&$.detach&&$.detach(r,H),H.attach&&H.attach(r,$||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Oa(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Sa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return en(r)},!0),i("scrollbarStyle","native",function(r){Lo(r),en(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=Oa(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Ql),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Ql(e,t,i){var r=i&&i!=un;if(!t!=!r){var n=e.display.dragFunctions,k=t?Oe:at;k(e.display.scroller,"dragstart",n.start),k(e.display.scroller,"dragenter",n.enter),k(e.display.scroller,"dragover",n.over),k(e.display.scroller,"dragleave",n.leave),k(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Dr(e),vn(e),setTimeout(function(){return en(e)},100)}function $t(e,t){var i=this;if(!(this instanceof $t))return new $t(e,t);this.options=t=t?N(t):{},N(ws,t,!1);var r=t.value;typeof r=="string"?r=new Rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new $t.inputStyles[t.inputStyle](this),k=this.display=new hl(e,r,n,t);k.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new q,keySeq:null,specialChars:null},t.autofocus&&!o&&k.input.focus(),j&&B<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),Dl(),Wi(this),this.curOp.forceUpdate=!0,Bo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&wa(i)},20):Zi(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],un);Ro(this),t.finishInit&&t.finishInit(this);for(var $=0;$<Ka.length;++$)Ka[$](this);Hi(this),P&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}$t.defaults=ws,$t.optionHandlers=aa;function Zl(e){var t=e.display;Oe(t.scroller,"mousedown",hr(e,xs)),j&&B<11?Oe(t.scroller,"dblclick",hr(e,function(J){if(He(e,J))return;var ee=Bi(e,J);if(!ee||za(e,J)||fi(e.display,J))return;re(J);var ce=e.findWordAt(ee);Zn(e.doc,ce.anchor,ce.head)})):Oe(t.scroller,"dblclick",function(J){return He(e,J)||re(J)}),Oe(t.scroller,"contextmenu",function(J){return Cs(e,J)}),Oe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Cs(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function k(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function H(J,ee){if(ee.left==null)return!0;var ce=ee.left-J.left,ge=ee.top-J.top;return ce*ce+ge*ge>20*20}Oe(t.scroller,"touchstart",function(J){if(!He(e,J)&&!k(J)&&!za(e,J)){t.input.ensurePolled(),clearTimeout(i);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!fi(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||H(ee,ee.prev)?ge=new jt(ce,ce):!ee.prev.prev||H(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new jt(Xe(ce.line,0),s(e.doc,Xe(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(J)}n()}),Oe(t.scroller,"touchcancel",n),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ui(e,t.scroller.scrollLeft,!0),Ie(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(J){return Po(e,J)}),Oe(t.scroller,"DOMMouseScroll",function(J){return Po(e,J)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||he(J)},over:function(J){He(e,J)||(kl(e,J),he(J))},start:function(J){return Ll(e,J)},drop:hr(e,Al),leave:function(J){He(e,J)||ss(e)}};var $=t.input.getField();Oe($,"keyup",function(J){return ys.call(e,J)}),Oe($,"keydown",hr(e,vs)),Oe($,"keypress",hr(e,bs)),Oe($,"focus",function(J){return wa(e,J)}),Oe($,"blur",function(J){return Zi(e,J)})}var Ka=[];$t.defineInitHook=function(e){return Ka.push(e)};function Fn(e,t,i,r){var n=e.doc,k;i==null&&(i="add"),i=="smart"&&(n.mode.indent?k=Re(e,t).state:i="prev");var H=e.options.tabSize,$=ft(n,t),J=X($.text,null,H);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test($.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(k,$.text.slice(ee.length),$.text),ce==Ae||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=X(ft(n,t-1).text,null,H):ce=0:i=="add"?ce=J+e.options.indentUnit:i=="subtract"?ce=J-e.options.indentUnit:typeof i=="number"&&(ce=J+i),ce=Math.max(0,ce);var ge="",De=0;if(e.options.indentWithTabs)for(var we=Math.floor(ce/H);we;--we)De+=H,ge+=" ";if(De<ce&&(ge+=ue(ce-De)),ge!=ee)return an(n,ge,Xe(t,0),Xe(t,ee.length),"+input"),$.stateAfter=null,!0;for(var Ne=0;Ne<n.sel.ranges.length;Ne++){var Ke=n.sel.ranges[Ne];if(Ke.head.line==t&&Ke.head.ch<ee.length){var Qe=Xe(t,ee.length);Fa(n,Ne,new jt(Qe,Qe));break}}}var qr=null;function oa(e){qr=e}function Va(e,t,i,r,n){var k=e.doc;e.display.shift=!1,r||(r=k.sel);var H=+new Date-200,$=n=="paste"||e.state.pasteIncoming>H,J=mt(t),ee=null;if($&&r.ranges.length>1)if(qr&&qr.text.join(`
|
|
`)==t){if(r.ranges.length%qr.text.length==0){ee=[];for(var ce=0;ce<qr.text.length;ce++)ee.push(k.splitLines(qr.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=fe(J,function(et){return[et]}));for(var ge=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var we=r.ranges[De],Ne=we.from(),Ke=we.to();we.empty()&&(i&&i>0?Ne=Xe(Ne.line,Ne.ch-i):e.state.overwrite&&!$?Ke=Xe(Ke.line,Math.min(ft(k,Ke.line).text.length,Ke.ch+te(J).length)):$&&qr&&qr.lineWise&&qr.text.join(`
|
|
`)==J.join(`
|
|
`)&&(Ne=Ke=Xe(Ne.line,0)));var Qe={from:Ne,to:Ke,text:ee?ee[De%ee.length]:J,origin:n||($?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Qe),Vt(e,"inputRead",e,Qe)}t&&!$&&Ls(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Br(t,function(){return Va(t,i,0,null,"paste")}),!0}function Ls(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 k=e.getModeAt(n.head),H=!1;if(k.electricChars){for(var $=0;$<k.electricChars.length;$++)if(t.indexOf(k.electricChars.charAt($))>-1){H=Fn(e,n.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(ft(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Fn(e,n.head.line,"smart")));H&&Vt(e,"electricInput",e,n.head.line)}}function ks(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,k={anchor:Xe(n,0),head:Xe(n+1,0)};i.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:i}}function Ds(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var k=this.options,H=k[r];if(k[r]==n&&r!="mode")return;k[r]=n,t.hasOwnProperty(r)&&hr(this,t[r])(this,n,H),Ie(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,k=0;k<n.length;++k)if(n[k]==r||n[k].name==r)return n.splice(k,1),!0},addOverlay:Cr(function(r,n){var k=r.token?r:e.getMode(this.options,r);if(k.startState)throw new Error("Overlays may not be stateful.");oe(this.state.overlays,{mode:k,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(H){return H.priority}),this.state.modeGen++,Dr(this)}),removeOverlay:Cr(function(r){for(var n=this.state.overlays,k=0;k<n.length;++k){var H=n[k].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(k,1),this.state.modeGen++,Dr(this);return}}}),indentLine:Cr(function(r,n,k){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),ui(this.doc,r)&&Fn(this,r,n,k)}),indentSelection:Cr(function(r){for(var n=this.doc.sel.ranges,k=-1,H=0;H<n.length;H++){var $=n[H];if($.empty())$.head.line>k&&(Fn(this,$.head.line,r,!0),k=$.head.line,H==this.doc.sel.primIndex&&qi(this));else{var J=$.from(),ee=$.to(),ce=Math.max(k,J.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge<k;++ge)Fn(this,ge,r);var De=this.doc.sel.ranges;J.ch==0&&n.length==De.length&&De[H].from().ch>0&&Fa(this.doc,H,new jt(J,De[H].to()),be)}}}),getTokenAt:function(r,n){return Wt(this,r,n)},getLineTokens:function(r,n){return Wt(this,Xe(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=je(this,ft(this.doc,r.line)),k=0,H=(n.length-1)/2,$=r.ch,J;if($==0)J=n[2];else for(;;){var ee=k+H>>1;if((ee?n[ee*2-1]:0)>=$)H=ee;else if(n[ee*2+1]<$)k=ee+1;else{J=n[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var k=[];if(!i.hasOwnProperty(n))return k;var H=i[n],$=this.getModeAt(r);if(typeof $[n]=="string")H[$[n]]&&k.push(H[$[n]]);else if($[n])for(var J=0;J<$[n].length;J++){var ee=H[$[n][J]];ee&&k.push(ee)}else $.helperType&&H[$.helperType]?k.push(H[$.helperType]):H[$.name]&&k.push(H[$.name]);for(var ce=0;ce<H._global.length;ce++){var ge=H._global[ce];ge.pred($,this)&&ae(k,ge.val)==-1&&k.push(ge.val)}return k},getStateAfter:function(r,n){var k=this.doc;return r=K(k,r==null?k.first+k.size-1:r),Re(this,r+1,n).state},cursorCoords:function(r,n){var k,H=this.doc.sel.primary();return r==null?k=H.head:typeof r=="object"?k=s(this.doc,r):k=r?H.from():H.to(),Jr(this,k,n||"page")},charCoords:function(r,n){return va(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=co(this,r,n||"page"),ba(this,r.left,r.top)},lineAtHeight:function(r,n){return r=co(this,{top:r,left:0},n||"page").top,Vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,k){var H=!1,$;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,H=!0),$=ft(this.doc,r)}else $=r;return Hn(this,$,{top:0,left:0},n||"page",k||H).top+(H?this.doc.height-Nr($):0)},defaultTextHeight:function(){return Qi(this.display)},defaultCharWidth:function(){return Ji(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,k,H,$){var J=this.display;r=Jr(this,s(this.doc,r));var ee=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),H=="over")ee=r.top;else if(H=="above"||H=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(H=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?ee=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(ee=r.bottom),ce+n.offsetWidth>De&&(ce=De-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",$=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):($=="left"?ce=0:$=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),k&&Qs(this,{left:ce,top:ee,right:ce+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Cr(vs),triggerOnKeyPress:Cr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Cr(xs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Cr(function(r){Ls(this,r)}),findPosH:function(r,n,k,H){var $=1;n<0&&($=-1,n=-n);for(var J=s(this.doc,r),ee=0;ee<n&&!(J=Xa(this.doc,J,$,k,H),J.hitSide);++ee);return J},moveH:Cr(function(r,n){var k=this;this.extendSelectionsBy(function(H){return k.display.shift||k.doc.extend||H.empty()?Xa(k.doc,H.head,r,n,k.options.rtlMoveVisually):r<0?H.from():H.to()},Te)}),deleteH:Cr(function(r,n){var k=this.doc.sel,H=this.doc;k.somethingSelected()?H.replaceSelection("",null,"+delete"):ln(this,function($){var J=Xa(H,$.head,r,n,!1);return r<0?{from:J,to:$.head}:{from:$.head,to:J}})}),findPosV:function(r,n,k,H){var $=1,J=H;n<0&&($=-1,n=-n);for(var ee=s(this.doc,r),ce=0;ce<n;++ce){var ge=Jr(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=_s(this,ge,$,k),ee.hitSide)break}return ee},moveV:Cr(function(r,n){var k=this,H=this.doc,$=[],J=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var ge=Jr(k,ce.head,"div");ce.goalColumn!=null&&(ge.left=ce.goalColumn),$.push(ge.left);var De=_s(k,ge,r,n);return n=="page"&&ce==H.sel.primary()&&La(k,va(k,De,"div").top-ge.top),De},Te),$.length)for(var ee=0;ee<H.sel.ranges.length;ee++)H.sel.ranges[ee].goalColumn=$[ee]}),findWordAt:function(r){var n=this.doc,k=ft(n,r.line).text,H=r.ch,$=r.ch;if(k){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||$==k.length)&&H?--H:++$;for(var ee=k.charAt(H),ce=Be(ee,J)?function(ge){return Be(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Be(ge)};H>0&&ce(k.charAt(H-1));)--H;for(;$<k.length&&ce(k.charAt($));)++$}return new jt(Xe(r.line,H),Xe(r.line,$))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Ie(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Cr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:pa(this),clientWidth:Ii(this)}},scrollIntoView:Cr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Xe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Cr(function(r,n){var k=this,H=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=H(r)),n!=null&&(this.display.wrapper.style.height=H(n)),this.options.lineWrapping&&lo(this);var $=this.display.viewFrom;this.doc.iter($,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Si(k,$,"widget");break}}++$}),this.curOp.forceUpdate=!0,Ie(this,"refresh",this)}),operation:function(r){return Br(this,r)},startOperation:function(){return Wi(this)},endOperation:function(){return Hi(this)},refresh:Cr(function(){var r=this.display.cachedTextHeight;Dr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-Qi(this.display))>.5||this.options.lineWrapping)&&Ca(this),Ie(this,"refresh",this)}),swapDoc:Cr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Vt(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}},ye(e),e.registerHelper=function(r,n,k){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=k},e.registerGlobalHelper=function(r,n,k,H){e.registerHelper(r,n,H),i[r]._global.push({pred:k,val:H})}}function Xa(e,t,i,r,n){var k=t,H=i,$=ft(e,t.line),J=n&&e.direction=="rtl"?-i:i;function ee(){var lt=t.line+J;return lt<e.first||lt>=e.first+e.size?!1:(t=new Xe(lt,t.ch,t.sticky),$=ft(e,lt))}function ce(lt){var tt;if(r=="codepoint"){var dt=$.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(dt)?tt=null:tt=new Xe(t.line,Math.max(0,Math.min($.text.length,t.ch+i*(dt>=55296&&dt<56320?2:1))),-i)}else n?tt=Ml(e.cm,$,t,i):tt=ja($,t,i);if(tt==null)if(!lt&&ee())t=Wa(n,e.cm,$,t.line,J);else return!1;else t=tt;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var ge=null,De=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(i<0&&!ce(!Ne));Ne=!1){var Ke=$.text.charAt(t.ch)||`
|
|
`,Qe=Be(Ke,we)?"w":De&&Ke==`
|
|
`?"n":!De||/\s/.test(Ke)?null:"p";if(De&&!Ne&&!Qe&&(Qe="s"),ge&&ge!=Qe){i<0&&(i=1,ce(),t.sticky="after");break}if(Qe&&(ge=Qe),i>0&&!ce(!Ne))break}var et=ea(e,t,k,H,!0);return ei(k,et)&&(et.hitSide=!0),et}function _s(e,t,i,r){var n=e.doc,k=t.left,H;if(r=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max($-.5*Qi(e.display),3);H=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(H=i>0?t.bottom+3:t.top-3);for(var ee;!(ee=ba(e,k,H),!ee.outside);){if(i<0?H<=0:H>=n.height){ee.hitSide=!0;break}H+=i*5}return ee}var zt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};zt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function k($){for(var J=$.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Oe(n,"paste",function($){if(!k($)||He(r,$)||As($,r))return;B<=11&&setTimeout(hr(r,function(){return t.updateFromDOM()}),20)}),Oe(n,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Oe(n,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Oe(n,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(n,"touchstart",function(){return i.forceCompositionEnd()}),Oe(n,"input",function(){t.composing||t.readFromDOMSoon()});function H($){if(!k($)||He(r,$))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),$.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=ks(r);oa({lineWise:!0,text:J.text}),$.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,be),r.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=qr.text.join(`
|
|
`);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var ce=Rs(),ge=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),ge.value=qr.text.join(`
|
|
`);var De=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(ce),De.focus(),De==n&&i.showPrimarySelection()},50)}Oe(n,"copy",H),Oe(n,"cut",H)},zt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},zt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},zt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},zt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},zt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var k=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&H&&!H.bad&&St(Ri(k,H),r)==0&&St(di(k,H),n)==0)return;var $=t.display.view,J=r.line>=t.display.viewFrom&&Os(t,r)||{node:$[0].measure.map[2],offset:0},ee=n.line<t.display.viewTo&&Os(t,n);if(!ee){var ce=$[$.length-1].measure,ge=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!ee){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),we;try{we=x(J.node,J.offset,ee.offset,ee.node)}catch(Ne){}we&&(!R&&t.state.focused?(e.collapse(J.node,J.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),De&&e.anchorNode==null?e.addRange(De):R&&this.startGracePeriod()),this.rememberSelection()},zt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},zt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},zt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},zt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},zt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},zt.prototype.blur=function(){this.div.blur()},zt.prototype.getField=function(){return this.div},zt.prototype.supportsTouch=function(){return!0},zt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Br(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},zt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},zt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&p&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Br(t,function(){xr(t.doc,Ti(i,r),be),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},zt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Xe(r.line-1,ft(e.doc,r.line-1).length)),n.ch==ft(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Xe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var k,H,$;r.line==t.viewFrom||(k=Fi(e,r.line))==0?(H=Ot(t.view[0].line),$=t.view[0].node):(H=Ot(t.view[k].line),$=t.view[k-1].node.nextSibling);var J=Fi(e,n.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=Ot(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,ce,H,ee)),De=Ur(e.doc,Xe(H,0),Xe(ee,ft(e.doc,ee).text.length));ge.length>1&&De.length>1;)if(te(ge)==te(De))ge.pop(),De.pop(),ee--;else if(ge[0]==De[0])ge.shift(),De.shift(),H++;else break;for(var we=0,Ne=0,Ke=ge[0],Qe=De[0],et=Math.min(Ke.length,Qe.length);we<et&&Ke.charCodeAt(we)==Qe.charCodeAt(we);)++we;for(var lt=te(ge),tt=te(De),dt=Math.min(lt.length-(ge.length==1?we:0),tt.length-(De.length==1?we:0));Ne<dt&<.charCodeAt(lt.length-Ne-1)==tt.charCodeAt(tt.length-Ne-1);)++Ne;if(ge.length==1&&De.length==1&&H==r.line)for(;we&&we>r.ch&<.charCodeAt(lt.length-Ne-1)==tt.charCodeAt(tt.length-Ne-1);)we--,Ne++;ge[ge.length-1]=lt.slice(0,lt.length-Ne).replace(/^\u200b+/,""),ge[0]=ge[0].slice(we).replace(/\u200b+$/,"");var Et=Xe(H,we),vt=Xe(ee,De.length?te(De).length-Ne:0);if(ge.length>1||ge[0]||St(Et,vt))return an(e.doc,ge,Et,vt,"+input"),!0},zt.prototype.ensurePolled=function(){this.forceCompositionEnd()},zt.prototype.reset=function(){this.forceCompositionEnd()},zt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},zt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},zt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Br(this.cm,function(){return Dr(e.cm)})},zt.prototype.setUneditable=function(e){e.contentEditable="false"},zt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hr(this.cm,Va)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},zt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},zt.prototype.onContextMenu=function(){},zt.prototype.resetPosition=function(){},zt.prototype.needsContentAttribute=!0;function Os(e,t){var i=ma(e,t.line);if(!i||i.hidden)return null;var r=ft(e.doc,t.line),n=io(i,r,t.line),k=$e(r,e.doc.direction),H="left";if(k){var $=Je(k,t.ch);H=$%2?"right":"left"}var J=oo(n.map,t.ch,H);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var k="",H=!1,$=e.doc.lineSeparator(),J=!1;function ee(we){return function(Ne){return Ne.id==we}}function ce(){H&&(k+=$,J&&(k+=$),H=J=!1)}function ge(we){we&&(ce(),k+=we)}function De(we){if(we.nodeType==1){var Ne=we.getAttribute("cm-text");if(Ne){ge(Ne);return}var Ke=we.getAttribute("cm-marker"),Qe;if(Ke){var et=e.findMarks(Xe(r,0),Xe(n+1,0),ee(+Ke));et.length&&(Qe=et[0].find(0))&&ge(Ur(e.doc,Qe.from,Qe.to).join($));return}if(we.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;lt&&ce();for(var tt=0;tt<we.childNodes.length;tt++)De(we.childNodes[tt]);/^(pre|p)$/i.test(we.nodeName)&&(J=!0),lt&&(H=!0)}else we.nodeType==3&&ge(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,J=!1;return k}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Xe(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var k=e.display.view[n];if(k.node==r)return ru(k,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!v(r,t))return hn(Xe(Ot(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var k=e.rest?te(e.rest):e.line;return hn(Xe(Ot(k),k.text.length),n)}var H=t.nodeType==3?t:null,$=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,i&&(i=H.nodeValue.length));$.parentNode!=r;)$=$.parentNode;var J=e.measure,ee=J.maps;function ce(Qe,et,lt){for(var tt=-1;tt<(ee?ee.length:0);tt++)for(var dt=tt<0?J.map:ee[tt],Et=0;Et<dt.length;Et+=3){var vt=dt[Et+2];if(vt==Qe||vt==et){var Lt=Ot(tt<0?e.line:e.rest[tt]),Yt=dt[Et]+lt;return(lt<0||vt!=Qe)&&(Yt=dt[Et+(lt?1:0)]),Xe(Lt,Yt)}}}var ge=ce(H,$,i);if(ge)return hn(ge,n);for(var De=$.nextSibling,we=H?H.nodeValue.length-i:0;De;De=De.nextSibling){if(ge=ce(De,De.firstChild,0),ge)return hn(Xe(ge.line,ge.ch-we),n);we+=De.textContent.length}for(var Ne=$.previousSibling,Ke=i;Ne;Ne=Ne.previousSibling){if(ge=ce(Ne,Ne.firstChild,-1),ge)return hn(Xe(ge.line,ge.ch+Ke),n);Ke+=Ne.textContent.length}}var er=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};er.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),E&&(n.style.width="0px"),Oe(n,"input",function(){j&&B>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Oe(n,"paste",function(H){if(He(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function k(H){if(He(r,H))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var $=ks(r);oa({lineWise:!0,text:$.text}),H.type=="cut"?r.setSelections($.ranges,null,be):(i.prevInput="",n.value=$.text.join(`
|
|
`),V(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Oe(n,"cut",k),Oe(n,"copy",k),Oe(e.scroller,"paste",function(H){if(fi(e,H)||He(r,H))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var $=new Event("paste");$.clipboardData=H.clipboardData,n.dispatchEvent($)}),Oe(e.lineSpace,"selectstart",function(H){fi(e,H)||re(H)}),Oe(n,"compositionstart",function(){var H=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},er.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},er.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-k.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-k.left))}return r},er.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},er.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),j&&B>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",j&&B>=9&&(this.hasSelection=null))},er.prototype.getField=function(){return this.textarea},er.prototype.supportsTouch=function(){return!1},er.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},er.prototype.blur=function(){this.textarea.blur()},er.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},er.prototype.receivedFocus=function(){this.slowPoll()},er.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()})},er.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)},er.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||nt(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(j&&B>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=n.charCodeAt(0);if(k==8203&&!r&&(r="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,$=Math.min(r.length,n.length);H<$&&r.charCodeAt(H)==n.charCodeAt(H);)++H;return Br(t,function(){Va(t,n.slice(H),r.length-H,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
|
|
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},er.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},er.prototype.onKeyPress=function(){j&&B>=9&&(this.hasSelection=null),this.fastPoll()},er.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Bi(i,e),H=r.scroller.scrollTop;if(!k||b)return;var $=i.options.resetSelectionOnContextMenu;$&&i.doc.sel.contains(k)==-1&&hr(i,xr)(i.doc,Ti(k),be);var J=n.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
|
|
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;P&&(ge=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var Ke=i.somethingSelected(),Qe="\u200B"+(Ke?n.value:"");n.value="\u21DA",n.value=Qe,t.prevInput=Ke?"":"\u200B",n.selectionStart=1,n.selectionEnd=Qe.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,j&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!j||j&&B<9)&&De();var Ke=0,Qe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?hr(i,Qo)(i):Ke++<10?r.detectingSelectAll=setTimeout(Qe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Qe,200)}}if(j&&B>=9&&De(),D){he(e);var Ne=function(){at(window,"mouseup",Ne),setTimeout(we,20)};Oe(window,"mouseup",Ne)}else setTimeout(we,50)},er.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},er.prototype.setUneditable=function(){},er.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?N(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=O();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=$.getValue()}var n;if(e.form&&(Oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var k=e.form;n=k.submit;try{var H=k.submit=function(){r(),k.submit=n,k.submit(),k.submit=H}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var $=$t(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return $}function nu(e){e.off=at,e.on=Oe,e.wheelEventPixels=dl,e.Doc=Rr,e.splitLines=mt,e.countColumn=X,e.findColumn=Se,e.isWordChar=Pe,e.Pass=Ae,e.signal=Ie,e.Line=Ei,e.changeEnd=wi,e.scrollbarModel=Ao,e.Pos=Xe,e.cmpPos=St,e.modes=Bt,e.mimeModes=wt,e.resolveMode=gt,e.getMode=Sr,e.modeExtensions=sr,e.extendMode=mr,e.copyState=wr,e.startState=Kr,e.innerMode=si,e.commands=Mn,e.keyMap=pi,e.keyName=cs,e.isModifierKey=hs,e.lookupKey=sn,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=_n,e.TextMarker=Li,e.LineWidget=Rn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=he,e.addClass=F,e.contains=v,e.rmClass=g,e.keyNames=ki}$l($t),ql($t);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Rr.prototype)Rr.prototype.hasOwnProperty(la)&&ae(au,la)<0&&($t.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Rr.prototype[la]));return ye(Rr),$t.inputStyles={textarea:er,contenteditable:zt},$t.defineMode=function(e){!$t.defaults.mode&&e!="null"&&($t.defaults.mode=e),pr.apply(this,arguments)},$t.defineMIME=or,$t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$t.defineMIME("text/plain","null"),$t.defineExtension=function(e,t){$t.prototype[e]=t},$t.defineDocExtension=function(e,t){Rr.prototype[e]=t},$t.fromTextArea=iu,nu($t),$t.version="5.58.2",$t})},Y1PL:function(ht,qe,se){"use strict";se.r(qe),se.d(qe,"ResizableTextArea",function(){return ae});var ie=se("wx14"),Q=se("1OyB"),R=se("vuIU"),Y=se("Ji7U"),U=se("LK+K"),_=se("q1tI"),j=se("VTBJ"),B=se("rePB"),P=se("Zm9Q"),A=se("Kwbf"),p=se("c+Xe"),b=se("m+aA"),M=se("bdgK"),L=new Map;function C(be){be.forEach(function(Ce){var Te,Se=Ce.target;(Te=L.get(Se))===null||Te===void 0||Te.forEach(function(pe){return pe(Se)})})}var E=new M.default(C),h=null,o=null;function l(be,Ce){L.has(be)||(L.set(be,new Set),E.observe(be)),L.get(be).add(Ce)}function d(be,Ce){L.has(be)&&(L.get(be).delete(Ce),L.get(be).size||(E.unobserve(be),L.delete(be)))}var w=function(be){Object(Y.a)(Te,be);var Ce=Object(U.a)(Te);function Te(){return Object(Q.a)(this,Te),Ce.apply(this,arguments)}return Object(R.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(_.Component),f=_.createContext(null);function y(be){var Ce=be.children,Te=be.onBatchResize,Se=_.useRef(0),pe=_.useRef([]),ue=_.useContext(f),te=_.useCallback(function(fe,oe,Le){Se.current+=1;var _e=Se.current;pe.current.push({size:fe,element:oe,data:Le}),Promise.resolve().then(function(){_e===Se.current&&(Te==null||Te(pe.current),pe.current=[])}),ue==null||ue(fe,oe,Le)},[Te,ue]);return _.createElement(f.Provider,{value:te},Ce)}function D(be){var Ce=be.children,Te=be.disabled,Se=_.useRef(null),pe=_.useRef(null),ue=_.useContext(f),te=_.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),fe=_.isValidElement(Ce)&&Object(p.c)(Ce),oe=fe?Ce.ref:null,Le=_.useMemo(function(){return Object(p.a)(oe,Se)},[oe,Se]),_e=_.useRef(be);_e.current=be;var Ee=_.useCallback(function(Pe){var Be=_e.current,Ve=Be.onResize,We=Be.data,Fe=Pe.getBoundingClientRect(),Ue=Fe.width,st=Fe.height,ot=Pe.offsetWidth,it=Pe.offsetHeight,Je=Math.floor(Ue),rt=Math.floor(st);if(te.current.width!==Je||te.current.height!==rt||te.current.offsetWidth!==ot||te.current.offsetHeight!==it){var $e={width:Je,height:rt,offsetWidth:ot,offsetHeight:it};te.current=$e;var Ze=ot===Math.round(Ue)?Ue:ot,Oe=it===Math.round(st)?st:it,ut=Object(j.a)(Object(j.a)({},$e),{},{offsetWidth:Ze,offsetHeight:Oe});ue==null||ue(ut,Pe,We),Ve&&Promise.resolve().then(function(){Ve(ut,Pe)})}},[]);return _.useEffect(function(){var Pe=Object(b.a)(Se.current)||Object(b.a)(pe.current);return Pe&&!Te&&l(Pe,Ee),function(){return d(Pe,Ee)}},[Se.current,Te]),_.createElement(w,{ref:pe},fe?_.cloneElement(Ce,{ref:Le}):Ce)}var T="rc-observer-key";function g(be){var Ce=be.children,Te=Object(P.a)(Ce);return Te.map(function(Se,pe){var ue=(Se==null?void 0:Se.key)||"".concat(T,"-").concat(pe);return _.createElement(D,Object(ie.a)({},be,{key:ue}),Se)})}g.Collection=y;var c=g,u=se("bT9E"),a=se("TSYQ"),S=se.n(a),x=`
|
|
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
|
|
`,v=["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"],O={},F;function W(be){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Ce&&O[Te])return O[Te];var Se=window.getComputedStyle(be),pe=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),te=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),fe=v.map(function(Le){return"".concat(Le,":").concat(Se.getPropertyValue(Le))}).join(";"),oe={sizingStyle:fe,paddingSize:ue,borderSize:te,boxSizing:pe};return Ce&&Te&&(O[Te]=oe),oe}function V(be){var Ce=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;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),be.getAttribute("wrap")?F.setAttribute("wrap",be.getAttribute("wrap")):F.removeAttribute("wrap");var pe=W(be,Ce),ue=pe.paddingSize,te=pe.borderSize,fe=pe.boxSizing,oe=pe.sizingStyle;F.setAttribute("style","".concat(oe,";").concat(x)),F.value=be.value||be.placeholder||"";var Le=Number.MIN_SAFE_INTEGER,_e=Number.MAX_SAFE_INTEGER,Ee=F.scrollHeight,Pe;if(fe==="border-box"?Ee+=te:fe==="content-box"&&(Ee-=ue),Te!==null||Se!==null){F.value=" ";var Be=F.scrollHeight-ue;Te!==null&&(Le=Be*Te,fe==="border-box"&&(Le=Le+ue+te),Ee=Math.max(Le,Ee)),Se!==null&&(_e=Be*Se,fe==="border-box"&&(_e=_e+ue+te),Pe=Ee>_e?"":"hidden",Ee=Math.min(_e,Ee))}return{height:Ee,minHeight:Le,maxHeight:_e,overflowY:Pe,resize:"none"}}var I=se("Gytx"),N=se.n(I),X;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(be){Object(Y.a)(Te,be);var Ce=Object(U.a)(Te);function Te(Se){var pe;return Object(Q.a)(this,Te),pe=Ce.call(this,Se),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(ue){pe.textArea=ue},pe.handleResize=function(ue){var te=pe.state.resizeStatus,fe=pe.props,oe=fe.autoSize,Le=fe.onResize;if(te!==X.NONE)return;typeof Le=="function"&&Le(ue),oe&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var ue=pe.props.autoSize;if(!ue||!pe.textArea)return;var te=ue.minRows,fe=ue.maxRows,oe=V(pe.textArea,!1,te,fe);pe.setState({textareaStyles:oe,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var ue=pe.props,te=ue.prefixCls,fe=te===void 0?"rc-textarea":te,oe=ue.autoSize,Le=ue.onResize,_e=ue.className,Ee=ue.disabled,Pe=pe.state,Be=Pe.textareaStyles,Ve=Pe.resizeStatus,We=Object(u.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Fe=S()(fe,_e,Object(B.a)({},"".concat(fe,"-disabled"),Ee));"value"in We&&(We.value=We.value||"");var Ue=Object(j.a)(Object(j.a)(Object(j.a)({},pe.props.style),Be),Ve===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return _.createElement(c,{onResize:pe.handleResize,disabled:!(oe||Le)},_.createElement("textarea",Object(ie.a)({},We,{className:Fe,style:Ue,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:X.NONE},pe}return Object(R.a)(Te,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!N()(pe.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 pe=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(_.Component),ae=q,de=function(be){Object(Y.a)(Te,be);var Ce=Object(U.a)(Te);function Te(Se){var pe;Object(Q.a)(this,Te),pe=Ce.call(this,Se),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var fe=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),fe&&fe(te)},pe.handleKeyDown=function(te){var fe=pe.props,oe=fe.onPressEnter,Le=fe.onKeyDown;te.keyCode===13&&oe&&oe(te),Le&&Le(te)};var ue=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return pe.state={value:ue},pe}return Object(R.a)(Te,[{key:"setValue",value:function(pe,ue){"value"in this.props||this.setState({value:pe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return _.createElement(ae,Object(ie.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Te}(_.Component),Ae=qe.default=de},YiJy:function(ht,qe,se){ht.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(ht,qe,se){"use strict";se.d(qe,"a",function(){return w});var ie=se("k1fw"),Q=se("miYZ"),R=se("tsqr"),Y=se("rAM+"),U=se("tJVT"),_=se("PpiC"),j=se("q1tI"),B=se.n(j),P=se("bdgK");function A(f,y,D,T,g){var c=y.getWordUntilPosition(D),u={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=T.map(function(S){return{label:S,kind:f.languages.CompletionItemKind.Keyword,insertText:S,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return g.map(function(S){a.push(Object(ie.a)(Object(ie.a)({},S),{},{range:u}))}),a}var p=function(f){var y={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,a){var S=A(f,u,a,D,[y]);return{suggestions:S}}});var T=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,a){var S=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],x=A(f,u,a,T,S);return{suggestions:x}}});var g=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,a){var S=[y,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],x=A(f,u,a,g,S);return{suggestions:x}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=se("LvDl");function L(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function C(){}var E=!1,h={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=f;if(Array.isArray(f)){for(var D=0;D<f.length;D++){var T=h[f[D]];if(T)return T}return y[0]}return h[y]||y}var l=null,d=qe.b=function(f){var y=f.width,D=y===void 0?"100%":y,T=f.height,g=T===void 0?"100%":T,c=f.value,u=f.language,a=u===void 0?"javascript":u,S=f.style,x=S===void 0?{}:S,v=f.options,O=v===void 0?{}:v,F=f.overrideServices,W=F===void 0?{}:F,V=f.theme,I=V===void 0?"vs-dark":V,N=f.onEditBlur,X=f.onSave,q=f.autoHeight,ae=q===void 0?!1:q,de=f.forbidCopy,Ae=de===void 0?!1:de,be=f.onChange,Ce=be===void 0?C:be,Te=f.editorDidMount,Se=Te===void 0?C:Te,pe=f.onFocus,ue=pe===void 0?C:pe,te=f.filename,fe=te===void 0?"educoder.txt":te,oe=Object(_.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Le=Object(j.useRef)(),_e=Object(j.useRef)({}),Ee=Object(j.useRef)(),Pe=Object(j.useRef)(!1),Be=Object(j.useRef)(),Ve=Object(j.useState)(!1),We=Object(U.a)(Ve,2),Fe=We[0],Ue=We[1];function st(){var le;return Le.current&&(le=new P.default(function(he){var ke=Object(Y.a)(he),Me;try{for(ke.s();!(Me=ke.n()).done;){var Ye=Me.value;(Ye.target.offsetHeight>0||Ye.target.offsetWidth>0)&&_e.current.instance.layout()}}catch(yt){ke.e(yt)}finally{ke.f()}}),le.observe(Le.current)),le}function ot(){R.b.warn(decodeURIComponent(b))}var it=function(){var he=_e.current.instance;if(c!=null&&he&&Fe){var ke=he.getModel();ke&&c!==ke.getValue()&&(E=!0,ke.setValue(c),he.layout(),E=!1)}};Object(j.useEffect)(function(){Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){it()},500)},[c,Fe,_e.current]);function Je(){var le=_e.current.instance;if(le){var he=le.getSelection(),ke=_e.current.pastePos||{},Me=new l.Range(ke.startLineNumber||he.endLineNumber,ke.startColumn||he.endColumn,ke.endLineNumber||he.endLineNumber,ke.endColumn||he.endColumn);setTimeout(function(){le.executeEdits("",[{range:Me,text:""}])},300)}}function rt(le){(window.navigator.platform.match("Mac")?le.metaKey:le.ctrlKey)&&le.keyCode==83&&(le.preventDefault(),X())}var $e=function(){if(ae&&_e.current.instance){var he=_e.current.instance.getContentHeight();re(he<g?g:he)}else re(g)};function Ze(le){var he=document.createEvent("MouseEvents");he.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(he)}function Oe(le,he){var ke=window.URL||window.webkitURL||window,Me=new Blob([he]),Ye=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ye.href=ke.createObjectURL(Me),Ye.download=le,Ze(Ye)}Object(j.useEffect)(function(){$e()},[$e]),Object(j.useEffect)(function(){Le.current&&!Fe&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(le){try{l=le,_e.current.instance=l.editor.create(Le.current,{value:c,language:o(a),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var he=_e.current.instance;if(Se(he,l),setTimeout(function(){$e(),_e.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Oe(fe||"educoder.txt",he.getValue())}})},500),_e.current.subscription=he.onDidChangeModelContent(function(Me){Pe.current?clearTimeout(Be.current):($e(),Ce(he.getValue(),Me)),Be.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||p(l),Ae&&(he.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return ot(),null}),he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return ot(),null})),window.Monaco=l,N&&he.onDidBlurEditorWidget(function(){N(he.getValue())}),ue&&he.onDidFocusEditorText(function(){ue(he.getValue())}),Ae){he.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return ot(),null}),he.onDidPaste(function(Me){_e.current.pastePos=Me});try{window.addEventListener("paste",Je)}catch(Me){}}var ke=st();return Ue(!0),function(){var Me=_e.current.instance;Me.dispose();var Ye=Me.getModel();Ye&&Ye.dispose(),_e.current.subscription&&_e.current.subscription.dispose(),Ae&&window.removeEventListener("paste",Je),ke.unobserve(Le.current)}}catch(Me){}})},[]),Object(j.useEffect)(function(){var le=_e.current.instance;if(le&&Fe)return document.addEventListener("keydown",rt,!1),function(){document.removeEventListener("keydown",rt)}},[X,Fe]),Object(j.useEffect)(function(){var le=_e.current.instance;if(le&&Fe){var he=o(a);l.editor.setModelLanguage(le.getModel(),he),console.log("language:",a,le.getModel(),he)}},[a,Fe]),Object(j.useEffect)(function(){var le=_e.current.instance;le&&Fe&&l.editor.setTheme(I)},[I,Fe]),Object(j.useEffect)(function(){var le=_e.current.instance;le&&Fe&&(le.updateOptions(Object(ie.a)({},O)),setTimeout(function(){le.getModel().updateOptions(Object(ie.a)({},O))},200))},[JSON.stringify(O),Fe]),Object(j.useEffect)(function(){var le=_e.current.instance;le&&Fe&&le.layout()},[D,g,Fe]);var ut=Object(j.useState)(L(D)),at=Object(U.a)(ut,2),Ie=at[0],He=at[1],xe=Object(j.useState)(L(g)),me=Object(U.a)(xe,2),ye=me[0],re=me[1],ne=Object(ie.a)(Object(ie.a)({},x),{},{width:Ie,height:ye});return B.a.createElement("div",{className:"my-monaco-editor",ref:Le,style:ne})};function w(f){var y=f.width,D=y===void 0?"100%":y,T=f.height,g=T===void 0?"100%":T,c=f.original,u=f.modified,a=f.language,S=f.options,x=S===void 0?{}:S,v=Object(j.useRef)(),O=Object(j.useState)(null),F=Object(U.a)(O,2),W=F[0],V=F[1];function I(ae){var de;return v.current&&(de=new P.default(function(Ae){var be=Object(Y.a)(Ae),Ce;try{for(be.s();!(Ce=be.n()).done;){var Te=Ce.value;(Te.target.offsetHeight>0||Te.target.offsetWidth>0)&&ae.layout()}}catch(Se){be.e(Se)}finally{be.f()}}),de.observe(v.current)),de}Object(j.useEffect)(function(){v.current&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(ae){l=ae;var de=l.editor.createDiffEditor(v.current,Object(ie.a)(Object(ie.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},x),{},{wordWrap:!0}));V(de);var Ae=I(de);return function(){de.dispose();var be=de.getModel();be&&be.dispose(),Ae.unobserve(v.current)}})},[]),Object(j.useEffect)(function(){W&&W.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(u,a)})},[c,u,a,W]);var N=L(D),X=L(g),q={width:N,height:X};return B.a.createElement("div",{className:"my-diff-editor",ref:v,style:q})}},ZpRC:function(ht,qe,se){"use strict";function ie(p){return typeof p=="object"&&p!=null&&p.nodeType===1}function Q(p,b){return(!b||p!=="hidden")&&p!=="visible"&&p!=="clip"}function R(p,b){if(p.clientHeight<p.scrollHeight||p.clientWidth<p.scrollWidth){var M=getComputedStyle(p,null);return Q(M.overflowY,b)||Q(M.overflowX,b)||function(L){var C=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(h){return null}}(L);return!!C&&(C.clientHeight<L.scrollHeight||C.clientWidth<L.scrollWidth)}(p)}return!1}function Y(p,b,M,L,C,E,h,o){return E<p&&h>b||E>p&&h<b?0:E<=p&&o<=M||h>=b&&o>=M?E-p-L:h>b&&o<M||E<p&&o>M?h-b+C:0}var U=function(p,b){var M=window,L=b.scrollMode,C=b.block,E=b.inline,h=b.boundary,o=b.skipOverflowHiddenElements,l=typeof h=="function"?h:function(Be){return Be!==h};if(!ie(p))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,w=[],f=p;ie(f)&&l(f);){if((f=f.parentElement)===d){w.push(f);break}f!=null&&f===document.body&&R(f)&&!R(document.documentElement)||f!=null&&R(f,o)&&w.push(f)}for(var y=M.visualViewport?M.visualViewport.width:innerWidth,D=M.visualViewport?M.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,c=p.getBoundingClientRect(),u=c.height,a=c.width,S=c.top,x=c.right,v=c.bottom,O=c.left,F=C==="start"||C==="nearest"?S:C==="end"?v:S+u/2,W=E==="center"?O+a/2:E==="end"?x:O,V=[],I=0;I<w.length;I++){var N=w[I],X=N.getBoundingClientRect(),q=X.height,ae=X.width,de=X.top,Ae=X.right,be=X.bottom,Ce=X.left;if(L==="if-needed"&&S>=0&&O>=0&&v<=D&&x<=y&&S>=de&&v<=be&&O>=Ce&&x<=Ae)return V;var Te=getComputedStyle(N),Se=parseInt(Te.borderLeftWidth,10),pe=parseInt(Te.borderTopWidth,10),ue=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),fe=0,oe=0,Le="offsetWidth"in N?N.offsetWidth-N.clientWidth-Se-ue:0,_e="offsetHeight"in N?N.offsetHeight-N.clientHeight-pe-te:0;if(d===N)fe=C==="start"?F:C==="end"?F-D:C==="nearest"?Y(g,g+D,D,pe,te,g+F,g+F+u,u):F-D/2,oe=E==="start"?W:E==="center"?W-y/2:E==="end"?W-y:Y(T,T+y,y,Se,ue,T+W,T+W+a,a),fe=Math.max(0,fe+g),oe=Math.max(0,oe+T);else{fe=C==="start"?F-de-pe:C==="end"?F-be+te+_e:C==="nearest"?Y(de,be,q,pe,te+_e,F,F+u,u):F-(de+q/2)+_e/2,oe=E==="start"?W-Ce-Se:E==="center"?W-(Ce+ae/2)+Le/2:E==="end"?W-Ae+ue+Le:Y(Ce,Ae,ae,Se,ue+Le,W,W+a,a);var Ee=N.scrollLeft,Pe=N.scrollTop;F+=Pe-(fe=Math.max(0,Math.min(Pe+fe,N.scrollHeight-q+_e))),W+=Ee-(oe=Math.max(0,Math.min(Ee+oe,N.scrollWidth-ae+Le)))}V.push({el:N,top:fe,left:oe})}return V};function _(p){return p===Object(p)&&Object.keys(p).length!==0}function j(p,b){b===void 0&&(b="auto");var M="scrollBehavior"in document.body.style;p.forEach(function(L){var C=L.el,E=L.top,h=L.left;C.scroll&&M?C.scroll({top:E,left:h,behavior:b}):(C.scrollTop=E,C.scrollLeft=h)})}function B(p){return p===!1?{block:"end",inline:"nearest"}:_(p)?p:{block:"start",inline:"nearest"}}function P(p,b){var M=!p.ownerDocument.documentElement.contains(p);if(_(b)&&typeof b.behavior=="function")return b.behavior(M?[]:U(p,b));if(M)return;var L=B(b);return j(U(p,L),L.behavior)}var A=qe.a=P},Zss7:function(ht,qe,se){var ie;(function(Q){var R=/^\s+/,Y=/\s+$/,U=0,_=Q.round,j=Q.min,B=Q.max,P=Q.random;function A(te,fe){if(te=te||"",fe=fe||{},te instanceof A)return te;if(!(this instanceof A))return new A(te,fe);var oe=p(te);this._originalInput=te,this._r=oe.r,this._g=oe.g,this._b=oe.b,this._a=oe.a,this._roundA=_(100*this._a)/100,this._format=fe.format||oe.format,this._gradientType=fe.gradientType,this._r<1&&(this._r=_(this._r)),this._g<1&&(this._g=_(this._g)),this._b<1&&(this._b=_(this._b)),this._ok=oe.ok,this._tc_id=U++}A.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),fe,oe,Le,_e,Ee,Pe;return fe=te.r/255,oe=te.g/255,Le=te.b/255,fe<=.03928?_e=fe/12.92:_e=Q.pow((fe+.055)/1.055,2.4),oe<=.03928?Ee=oe/12.92:Ee=Q.pow((oe+.055)/1.055,2.4),Le<=.03928?Pe=Le/12.92:Pe=Q.pow((Le+.055)/1.055,2.4),.2126*_e+.7152*Ee+.0722*Pe},setAlpha:function(te){return this._a=V(te),this._roundA=_(100*this._a)/100,this},toHsv:function(){var te=C(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=C(this._r,this._g,this._b),fe=_(te.h*360),oe=_(te.s*100),Le=_(te.v*100);return this._a==1?"hsv("+fe+", "+oe+"%, "+Le+"%)":"hsva("+fe+", "+oe+"%, "+Le+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),fe=_(te.h*360),oe=_(te.s*100),Le=_(te.l*100);return this._a==1?"hsl("+fe+", "+oe+"%, "+Le+"%)":"hsla("+fe+", "+oe+"%, "+Le+"%, "+this._roundA+")"},toHex:function(te){return h(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:_(this._r),g:_(this._g),b:_(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+_(this._r)+", "+_(this._g)+", "+_(this._b)+")":"rgba("+_(this._r)+", "+_(this._g)+", "+_(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:_(I(this._r,255)*100)+"%",g:_(I(this._g,255)*100)+"%",b:_(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+_(I(this._r,255)*100)+"%, "+_(I(this._g,255)*100)+"%, "+_(I(this._b,255)*100)+"%)":"rgba("+_(I(this._r,255)*100)+"%, "+_(I(this._g,255)*100)+"%, "+_(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var fe="#"+l(this._r,this._g,this._b,this._a),oe=fe,Le=this._gradientType?"GradientType = 1, ":"";if(te){var _e=A(te);oe="#"+l(_e._r,_e._g,_e._b,_e._a)}return"progid:DXImageTransform.Microsoft.gradient("+Le+"startColorstr="+fe+",endColorstr="+oe+")"},toString:function(te){var fe=!!te;te=te||this._format;var oe=!1,Le=this._a<1&&this._a>=0,_e=!fe&&Le&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return _e?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(oe=this.toRgbString()),te==="prgb"&&(oe=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(oe=this.toHexString()),te==="hex3"&&(oe=this.toHexString(!0)),te==="hex4"&&(oe=this.toHex8String(!0)),te==="hex8"&&(oe=this.toHex8String()),te==="name"&&(oe=this.toName()),te==="hsl"&&(oe=this.toHslString()),te==="hsv"&&(oe=this.toHsvString()),oe||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(te,fe){var oe=te.apply(null,[this].concat([].slice.call(fe)));return this._r=oe._r,this._g=oe._g,this._b=oe._b,this.setAlpha(oe._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(te,fe){return te.apply(null,[this].concat([].slice.call(fe)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},A.fromRatio=function(te,fe){if(typeof te=="object"){var oe={};for(var Le in te)te.hasOwnProperty(Le)&&(Le==="a"?oe[Le]=te[Le]:oe[Le]=Ae(te[Le]));te=oe}return A(te,fe)};function p(te){var fe={r:0,g:0,b:0},oe=1,Le=null,_e=null,Ee=null,Pe=!1,Be=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(Se(te.r)&&Se(te.g)&&Se(te.b)?(fe=b(te.r,te.g,te.b),Pe=!0,Be=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Se(te.h)&&Se(te.s)&&Se(te.v)?(Le=Ae(te.s),_e=Ae(te.v),fe=E(te.h,Le,_e),Pe=!0,Be="hsv"):Se(te.h)&&Se(te.s)&&Se(te.l)&&(Le=Ae(te.s),Ee=Ae(te.l),fe=L(te.h,Le,Ee),Pe=!0,Be="hsl"),te.hasOwnProperty("a")&&(oe=te.a)),oe=V(oe),{ok:Pe,format:te.format||Be,r:j(255,B(fe.r,0)),g:j(255,B(fe.g,0)),b:j(255,B(fe.b,0)),a:oe}}function b(te,fe,oe){return{r:I(te,255)*255,g:I(fe,255)*255,b:I(oe,255)*255}}function M(te,fe,oe){te=I(te,255),fe=I(fe,255),oe=I(oe,255);var Le=B(te,fe,oe),_e=j(te,fe,oe),Ee,Pe,Be=(Le+_e)/2;if(Le==_e)Ee=Pe=0;else{var Ve=Le-_e;Pe=Be>.5?Ve/(2-Le-_e):Ve/(Le+_e);switch(Le){case te:Ee=(fe-oe)/Ve+(fe<oe?6:0);break;case fe:Ee=(oe-te)/Ve+2;break;case oe:Ee=(te-fe)/Ve+4;break}Ee/=6}return{h:Ee,s:Pe,l:Be}}function L(te,fe,oe){var Le,_e,Ee;te=I(te,360),fe=I(fe,100),oe=I(oe,100);function Pe(We,Fe,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?We+(Fe-We)*6*Ue:Ue<1/2?Fe:Ue<2/3?We+(Fe-We)*(2/3-Ue)*6:We}if(fe===0)Le=_e=Ee=oe;else{var Be=oe<.5?oe*(1+fe):oe+fe-oe*fe,Ve=2*oe-Be;Le=Pe(Ve,Be,te+1/3),_e=Pe(Ve,Be,te),Ee=Pe(Ve,Be,te-1/3)}return{r:Le*255,g:_e*255,b:Ee*255}}function C(te,fe,oe){te=I(te,255),fe=I(fe,255),oe=I(oe,255);var Le=B(te,fe,oe),_e=j(te,fe,oe),Ee,Pe,Be=Le,Ve=Le-_e;if(Pe=Le===0?0:Ve/Le,Le==_e)Ee=0;else{switch(Le){case te:Ee=(fe-oe)/Ve+(fe<oe?6:0);break;case fe:Ee=(oe-te)/Ve+2;break;case oe:Ee=(te-fe)/Ve+4;break}Ee/=6}return{h:Ee,s:Pe,v:Be}}function E(te,fe,oe){te=I(te,360)*6,fe=I(fe,100),oe=I(oe,100);var Le=Q.floor(te),_e=te-Le,Ee=oe*(1-fe),Pe=oe*(1-_e*fe),Be=oe*(1-(1-_e)*fe),Ve=Le%6,We=[oe,Pe,Ee,Ee,Be,oe][Ve],Fe=[Be,oe,oe,Pe,Ee,Ee][Ve],Ue=[Ee,Ee,Be,oe,oe,Pe][Ve];return{r:We*255,g:Fe*255,b:Ue*255}}function h(te,fe,oe,Le){var _e=[de(_(te).toString(16)),de(_(fe).toString(16)),de(_(oe).toString(16))];return Le&&_e[0].charAt(0)==_e[0].charAt(1)&&_e[1].charAt(0)==_e[1].charAt(1)&&_e[2].charAt(0)==_e[2].charAt(1)?_e[0].charAt(0)+_e[1].charAt(0)+_e[2].charAt(0):_e.join("")}function o(te,fe,oe,Le,_e){var Ee=[de(_(te).toString(16)),de(_(fe).toString(16)),de(_(oe).toString(16)),de(be(Le))];return _e&&Ee[0].charAt(0)==Ee[0].charAt(1)&&Ee[1].charAt(0)==Ee[1].charAt(1)&&Ee[2].charAt(0)==Ee[2].charAt(1)&&Ee[3].charAt(0)==Ee[3].charAt(1)?Ee[0].charAt(0)+Ee[1].charAt(0)+Ee[2].charAt(0)+Ee[3].charAt(0):Ee.join("")}function l(te,fe,oe,Le){var _e=[de(be(Le)),de(_(te).toString(16)),de(_(fe).toString(16)),de(_(oe).toString(16))];return _e.join("")}A.equals=function(te,fe){return!te||!fe?!1:A(te).toRgbString()==A(fe).toRgbString()},A.random=function(){return A.fromRatio({r:P(),g:P(),b:P()})};function d(te,fe){fe=fe===0?0:fe||10;var oe=A(te).toHsl();return oe.s-=fe/100,oe.s=N(oe.s),A(oe)}function w(te,fe){fe=fe===0?0:fe||10;var oe=A(te).toHsl();return oe.s+=fe/100,oe.s=N(oe.s),A(oe)}function f(te){return A(te).desaturate(100)}function y(te,fe){fe=fe===0?0:fe||10;var oe=A(te).toHsl();return oe.l+=fe/100,oe.l=N(oe.l),A(oe)}function D(te,fe){fe=fe===0?0:fe||10;var oe=A(te).toRgb();return oe.r=B(0,j(255,oe.r-_(255*-(fe/100)))),oe.g=B(0,j(255,oe.g-_(255*-(fe/100)))),oe.b=B(0,j(255,oe.b-_(255*-(fe/100)))),A(oe)}function T(te,fe){fe=fe===0?0:fe||10;var oe=A(te).toHsl();return oe.l-=fe/100,oe.l=N(oe.l),A(oe)}function g(te,fe){var oe=A(te).toHsl(),Le=(oe.h+fe)%360;return oe.h=Le<0?360+Le:Le,A(oe)}function c(te){var fe=A(te).toHsl();return fe.h=(fe.h+180)%360,A(fe)}function u(te){var fe=A(te).toHsl(),oe=fe.h;return[A(te),A({h:(oe+120)%360,s:fe.s,l:fe.l}),A({h:(oe+240)%360,s:fe.s,l:fe.l})]}function a(te){var fe=A(te).toHsl(),oe=fe.h;return[A(te),A({h:(oe+90)%360,s:fe.s,l:fe.l}),A({h:(oe+180)%360,s:fe.s,l:fe.l}),A({h:(oe+270)%360,s:fe.s,l:fe.l})]}function S(te){var fe=A(te).toHsl(),oe=fe.h;return[A(te),A({h:(oe+72)%360,s:fe.s,l:fe.l}),A({h:(oe+216)%360,s:fe.s,l:fe.l})]}function x(te,fe,oe){fe=fe||6,oe=oe||30;var Le=A(te).toHsl(),_e=360/oe,Ee=[A(te)];for(Le.h=(Le.h-(_e*fe>>1)+720)%360;--fe;)Le.h=(Le.h+_e)%360,Ee.push(A(Le));return Ee}function v(te,fe){fe=fe||6;for(var oe=A(te).toHsv(),Le=oe.h,_e=oe.s,Ee=oe.v,Pe=[],Be=1/fe;fe--;)Pe.push(A({h:Le,s:_e,v:Ee})),Ee=(Ee+Be)%1;return Pe}A.mix=function(te,fe,oe){oe=oe===0?0:oe||50;var Le=A(te).toRgb(),_e=A(fe).toRgb(),Ee=oe/100,Pe={r:(_e.r-Le.r)*Ee+Le.r,g:(_e.g-Le.g)*Ee+Le.g,b:(_e.b-Le.b)*Ee+Le.b,a:(_e.a-Le.a)*Ee+Le.a};return A(Pe)},A.readability=function(te,fe){var oe=A(te),Le=A(fe);return(Q.max(oe.getLuminance(),Le.getLuminance())+.05)/(Q.min(oe.getLuminance(),Le.getLuminance())+.05)},A.isReadable=function(te,fe,oe){var Le=A.readability(te,fe),_e,Ee;Ee=!1,_e=ue(oe);switch(_e.level+_e.size){case"AAsmall":case"AAAlarge":Ee=Le>=4.5;break;case"AAlarge":Ee=Le>=3;break;case"AAAsmall":Ee=Le>=7;break}return Ee},A.mostReadable=function(te,fe,oe){var Le=null,_e=0,Ee,Pe,Be,Ve;oe=oe||{},Pe=oe.includeFallbackColors,Be=oe.level,Ve=oe.size;for(var We=0;We<fe.length;We++)Ee=A.readability(te,fe[We]),Ee>_e&&(_e=Ee,Le=A(fe[We]));return A.isReadable(te,Le,{level:Be,size:Ve})||!Pe?Le:(oe.includeFallbackColors=!1,A.mostReadable(te,["#fff","#000"],oe))};var O=A.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"},F=A.hexNames=W(O);function W(te){var fe={};for(var oe in te)te.hasOwnProperty(oe)&&(fe[te[oe]]=oe);return fe}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,fe){q(te)&&(te="100%");var oe=ae(te);return te=j(fe,B(0,parseFloat(te))),oe&&(te=parseInt(te*fe,10)/100),Q.abs(te-fe)<1e-6?1:te%fe/parseFloat(fe)}function N(te){return j(1,B(0,te))}function X(te){return parseInt(te,16)}function q(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ae(te){return typeof te=="string"&&te.indexOf("%")!=-1}function de(te){return te.length==1?"0"+te:""+te}function Ae(te){return te<=1&&(te=te*100+"%"),te}function be(te){return Q.round(parseFloat(te)*255).toString(16)}function Ce(te){return X(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",fe="[-\\+]?\\d*\\.\\d+%?",oe="(?:"+fe+")|(?:"+te+")",Le="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?",_e="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?";return{CSS_UNIT:new RegExp(oe),rgb:new RegExp("rgb"+Le),rgba:new RegExp("rgba"+_e),hsl:new RegExp("hsl"+Le),hsla:new RegExp("hsla"+_e),hsv:new RegExp("hsv"+Le),hsva:new RegExp("hsva"+_e),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(te){return!!Te.CSS_UNIT.exec(te)}function pe(te){te=te.replace(R,"").replace(Y,"").toLowerCase();var fe=!1;if(O[te])te=O[te],fe=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var oe;return(oe=Te.rgb.exec(te))?{r:oe[1],g:oe[2],b:oe[3]}:(oe=Te.rgba.exec(te))?{r:oe[1],g:oe[2],b:oe[3],a:oe[4]}:(oe=Te.hsl.exec(te))?{h:oe[1],s:oe[2],l:oe[3]}:(oe=Te.hsla.exec(te))?{h:oe[1],s:oe[2],l:oe[3],a:oe[4]}:(oe=Te.hsv.exec(te))?{h:oe[1],s:oe[2],v:oe[3]}:(oe=Te.hsva.exec(te))?{h:oe[1],s:oe[2],v:oe[3],a:oe[4]}:(oe=Te.hex8.exec(te))?{r:X(oe[1]),g:X(oe[2]),b:X(oe[3]),a:Ce(oe[4]),format:fe?"name":"hex8"}:(oe=Te.hex6.exec(te))?{r:X(oe[1]),g:X(oe[2]),b:X(oe[3]),format:fe?"name":"hex"}:(oe=Te.hex4.exec(te))?{r:X(oe[1]+""+oe[1]),g:X(oe[2]+""+oe[2]),b:X(oe[3]+""+oe[3]),a:Ce(oe[4]+""+oe[4]),format:fe?"name":"hex8"}:(oe=Te.hex3.exec(te))?{r:X(oe[1]+""+oe[1]),g:X(oe[2]+""+oe[2]),b:X(oe[3]+""+oe[3]),format:fe?"name":"hex"}:!1}function ue(te){var fe,oe;return te=te||{level:"AA",size:"small"},fe=(te.level||"AA").toUpperCase(),oe=(te.size||"small").toLowerCase(),fe!=="AA"&&fe!=="AAA"&&(fe="AA"),oe!=="small"&&oe!=="large"&&(oe="small"),{level:fe,size:oe}}ht.exports?ht.exports=A:!(ie=function(){return A}.call(qe,se,qe,ht),ie!==void 0&&(ht.exports=ie))})(Math)},aRTE:function(ht,qe){ht.exports={L:1,M:0,Q:3,H:2}},bT9E:function(ht,qe,se){"use strict";se.d(qe,"a",function(){return Q});var ie=se("VTBJ");function Q(R,Y){var U=Object(ie.a)({},R);return Array.isArray(Y)&&Y.forEach(function(_){delete U[_]}),U}},c5Ni:function(ht,qe,se){},dQei:function(ht,qe){for(var se={glog:function(Q){if(Q<1)throw new Error("glog("+Q+")");return se.LOG_TABLE[Q]},gexp:function(Q){for(;Q<0;)Q+=255;for(;Q>=256;)Q-=255;return se.EXP_TABLE[Q]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},ie=0;ie<8;ie++)se.EXP_TABLE[ie]=1<<ie;for(var ie=8;ie<256;ie++)se.EXP_TABLE[ie]=se.EXP_TABLE[ie-4]^se.EXP_TABLE[ie-5]^se.EXP_TABLE[ie-6]^se.EXP_TABLE[ie-8];for(var ie=0;ie<255;ie++)se.LOG_TABLE[se.EXP_TABLE[ie]]=ie;ht.exports=se},dWSS:function(ht,qe,se){var ie=se("dQei");function Q(R,Y){if(R.length==null)throw new Error(R.length+"/"+Y);for(var U=0;U<R.length&&R[U]==0;)U++;this.num=new Array(R.length-U+Y);for(var _=0;_<R.length-U;_++)this.num[_]=R[_+U]}Q.prototype={get:function(R){return this.num[R]},getLength:function(){return this.num.length},multiply:function(R){for(var Y=new Array(this.getLength()+R.getLength()-1),U=0;U<this.getLength();U++)for(var _=0;_<R.getLength();_++)Y[U+_]^=ie.gexp(ie.glog(this.get(U))+ie.glog(R.get(_)));return new Q(Y,0)},mod:function(R){if(this.getLength()-R.getLength()<0)return this;for(var Y=ie.glog(this.get(0))-ie.glog(R.get(0)),U=new Array(this.getLength()),_=0;_<this.getLength();_++)U[_]=this.get(_);for(var _=0;_<R.getLength();_++)U[_]^=ie.gexp(ie.glog(R.get(_))+Y);return new Q(U,0).mod(R)}},ht.exports=Q},dejd:function(ht,qe,se){},dmUQ:function(ht,qe,se){"use strict";var ie=se("Ff2n"),Q=se("rePB"),R=se("1OyB"),Y=se("vuIU"),U=se("Ji7U"),_=se("md7G"),j=se("foSv"),B=se("q1tI"),P=se.n(B),A=se("TSYQ"),p=se.n(A),b=se("4IlW");function M(u,a){var S=Object.keys(u);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);a&&(x=x.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),S.push.apply(S,x)}return S}function L(u){for(var a=1;a<arguments.length;a++){var S=arguments[a]!=null?arguments[a]:{};a%2?M(Object(S),!0).forEach(function(x){Object(Q.a)(u,x,S[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(S)):M(Object(S)).forEach(function(x){Object.defineProperty(u,x,Object.getOwnPropertyDescriptor(S,x))})}return u}function C(u){var a=E();return function(){var x=Object(j.a)(u),v;if(a){var O=Object(j.a)(this).constructor;v=Reflect.construct(x,arguments,O)}else v=x.apply(this,arguments);return Object(_.a)(this,v)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(u){return!1}}function h(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,w=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,y=function(a){return a!=null},D=function(a,S){return S===a||typeof S=="number"&&typeof a=="number"&&isNaN(S)&&isNaN(a)},T=function(u){Object(U.a)(S,u);var a=C(S);function S(x){var v;Object(R.a)(this,S),v=a.call(this,x),v.onKeyDown=function(W){var V=v.props,I=V.onKeyDown,N=V.onPressEnter;if(W.keyCode===b.a.UP){var X=v.getRatio(W);v.up(W,X,null),v.stop()}else if(W.keyCode===b.a.DOWN){var q=v.getRatio(W);v.down(W,q,null),v.stop()}else W.keyCode===b.a.ENTER&&N&&N(W);if(v.recordCursorPosition(),v.lastKeyCode=W.keyCode,I){for(var ae=arguments.length,de=new Array(ae>1?ae-1:0),Ae=1;Ae<ae;Ae++)de[Ae-1]=arguments[Ae];I.apply(void 0,[W].concat(de))}},v.onKeyUp=function(W){var V=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),V){for(var I=arguments.length,N=new Array(I>1?I-1:0),X=1;X<I;X++)N[X-1]=arguments[X];V.apply(void 0,[W].concat(N))}},v.onChange=function(W){var V=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(W)),v.setState({inputValue:v.rawInput}),V(v.toNumber(v.rawInput))},v.onMouseUp=function(){var W=v.props.onMouseUp;v.recordCursorPosition(),W&&W.apply(void 0,arguments)},v.onFocus=function(){var W;v.setState({focused:!0}),(W=v.props).onFocus.apply(W,arguments)},v.onBlur=function(){var W=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var V=v.getCurrentValidValue(v.state.inputValue),I=v.setValue(V,h);if(W){var N=v.input.value,X=v.getInputDisplayValue({focus:!1,value:I});v.input.value=X&&Number(X),W.apply(void 0,arguments),v.input.value=N}},v.getRatio=function(W){var V=1;return W.metaKey||W.ctrlKey?V=.1:W.shiftKey&&(V=10),V},v.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},v.getPrecision=function(W){if(y(v.props.precision))return v.props.precision;var V=String(W);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var I=0;return V.indexOf(".")>=0&&(I=V.length-V.indexOf(".")-1),I},v.getInputDisplayValue=function(W){var V=W||v.state,I=V.focused,N=V.inputValue,X=V.value,q;I?q=N:q=v.toPrecisionAsStep(X),q==null&&(q="");var ae=v.formatWrapper(q);return y(v.props.decimalSeparator)&&(ae=ae.toString().replace(".",v.props.decimalSeparator)),ae},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(W){}},v.restoreByAfter=function(W){if(W===void 0)return!1;var V=v.input.value,I=V.lastIndexOf(W);if(I===-1)return!1;var N=v.cursorBefore.length;return v.lastKeyCode===b.a.DELETE&&v.cursorBefore.charAt(N-1)===W[0]?(v.fixCaret(N,N),!0):I+W.length===V.length?(v.fixCaret(I,I),!0):!1},v.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(V,I){var N=W.substring(I);return v.restoreByAfter(N)})},v.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(W,V,I){v.pressingUpOrDown=!0,v.step("down",W,V,I)},v.up=function(W,V,I){v.pressingUpOrDown=!0,v.step("up",W,V,I)},v.saveInput=function(W){v.input=W};var O=x.value;O===void 0&&(O=x.defaultValue),v.state={focused:x.autoFocus};var F=v.getValidValue(v.toNumber(O));return v.state=L(L({},v.state),{},{inputValue:v.toPrecisionAsStep(F),value:F}),v}return Object(Y.a)(S,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var O=this.props,F=O.value,W=O.onChange,V=O.max,I=O.min,N=this.state.focused;if(v){if(!D(v.value,F)||!D(v.max,V)||!D(v.min,I)){var X=N?F:this.getValidValue(F),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var ae="value"in this.props?F:this.state.value;"max"in this.props&&v.max!==V&&typeof ae=="number"&&ae>V&&W&&W(V),"min"in this.props&&v.min!==I&&typeof ae=="number"&&ae<I&&W&&W(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ae){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var O=v;return O===""?O="":this.isNotCompleteNumber(parseFloat(O))?O=this.state.value:O=this.getValidValue(O),this.toNumber(O)}},{key:"getValueFromEvent",value:function(v){var O=v.target.value.trim().replace(/。/g,".");return y(this.props.decimalSeparator)&&(O=O.replace(this.props.decimalSeparator,".")),O}},{key:"getValidValue",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(v);return isNaN(W)?v:(W<O&&(W=O),W>F&&(W=F),W)}},{key:"setValue",value:function(v,O){var F=this.props.precision,W=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),V=this.state.value,I=V===void 0?null:V,N=this.state.inputValue,X=N===void 0?null:N,q=typeof W=="number"?W.toFixed(F):"".concat(W),ae=W!==I||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},O)):this.setState({value:W,inputValue:this.toPrecisionAsStep(v)},O),ae&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,W=F.precision,V=F.step;if(y(W))return W;var I=this.getPrecision(O),N=this.getPrecision(V),X=this.getPrecision(v);return v?Math.max(X,I+N):I+N}},{key:"getPrecisionFactor",value:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(v,O);return Math.pow(10,F)}},{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(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var O=Math.abs(this.getMaxPrecision(v));return isNaN(O)?v.toString():Number(v).toFixed(O)}},{key:"toNumber",value:function(v){var O=this.props.precision,F=this.state.focused,W=v&&v.length>16&&F;return this.isNotCompleteNumber(v)||W?v:y(O)?Math.round(v*Math.pow(10,O))/Math.pow(10,O):Number(v)}},{key:"upStep",value:function(v,O){var F=this.props.step,W=this.getPrecisionFactor(v,O),V=Math.abs(this.getMaxPrecision(v,O)),I=((W*v+W*F*O)/W).toFixed(V);return this.toNumber(I)}},{key:"downStep",value:function(v,O){var F=this.props.step,W=this.getPrecisionFactor(v,O),V=Math.abs(this.getMaxPrecision(v,O)),I=((W*v-W*F*O)/W).toFixed(V);return this.toNumber(I)}},{key:"step",value:function(v,O){var F=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),O&&(O.persist(),O.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var X=this["".concat(v,"Step")](N,W),q=X>I.max||X<I.min;if(X>I.max?X=I.max:X<I.min&&(X=I.min),this.setValue(X,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){F[v](O,W,!0)},V?d:w)}},{key:"fixCaret",value:function(v,O){if(v===void 0||O===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,W=this.input.selectionEnd;(v!==F||O!==W)&&this.input.setSelectionRange(v,O)}catch(V){}}},{key:"render",value:function(){var v,O=this.props,F=O.prefixCls,W=O.disabled,V=O.readOnly,I=O.useTouch,N=O.autoComplete,X=O.upHandler,q=O.downHandler,ae=O.className,de=O.max,Ae=O.min,be=O.style,Ce=O.title,Te=O.onMouseEnter,Se=O.onMouseLeave,pe=O.onMouseOver,ue=O.onMouseOut,te=O.required,fe=O.onClick,oe=O.tabIndex,Le=O.type,_e=O.placeholder,Ee=O.id,Pe=O.inputMode,Be=O.pattern,Ve=O.step,We=O.maxLength,Fe=O.autoFocus,Ue=O.name,st=O.onPaste,ot=O.onInput,it=Object(ie.a)(O,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Je=this.state,rt=Je.value,$e=Je.focused,Ze=p()(F,(v={},Object(Q.a)(v,ae,!!ae),Object(Q.a)(v,"".concat(F,"-disabled"),W),Object(Q.a)(v,"".concat(F,"-focused"),$e),v)),Oe={};Object.keys(it).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(Oe[he]=it[he])});var ut=!V&&!W,at=this.getInputDisplayValue(null),Ie=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=de),He=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Ae),xe=Ie||W||V,me=He||W||V,ye=p()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(Q.a)({},"".concat(F,"-handler-up-disabled"),xe)),re=p()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(Q.a)({},"".concat(F,"-handler-down-disabled"),me)),ne=I?{onTouchStart:xe?h:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=I?{onTouchStart:me?h:this.down,onTouchEnd:this.stop}:{onMouseDown:me?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Ze,style:be,title:Ce,onMouseEnter:Te,onMouseLeave:Se,onMouseOver:pe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(F,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:ye}),X||P.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),P.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":me,className:re}),q||P.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),P.a.createElement("div",{className:"".concat(F,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ae,"aria-valuemax":de,"aria-valuenow":rt,required:te,type:Le,placeholder:_e,onPaste:st,onClick:fe,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:oe,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:h,onKeyUp:ut?this.onKeyUp:h,autoFocus:Fe,maxLength:We,readOnly:V,disabled:W,max:de,min:Ae,step:Ve,name:Ue,title:Ce,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Be,inputMode:Pe,onInput:ot},Oe))))}}]),S}(P.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var g=T,c=qe.a=g},f4xo:function(ht,qe,se){var ie=se("nVVt");function Q(R){this.mode=ie.MODE_8BIT_BYTE,this.data=R}Q.prototype={getLength:function(R){return this.data.length},write:function(R){for(var Y=0;Y<this.data.length;Y++)R.put(this.data.charCodeAt(Y),8)}},ht.exports=Q},h78n:function(ht,qe,se){"use strict";se.d(qe,"a",function(){return v});var ie=se("q1tI"),Q=se.n(ie),R=se("TSYQ"),Y=se.n(R),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},_=function(W){var V=W.map(function(){return Object(ie.useRef)()}),I=Object(ie.useRef)();return Object(ie.useEffect)(function(){var N=Date.now(),X=!1;Object.keys(V).forEach(function(q){var ae=V[q].current;if(!ae)return;X=!0;var de=ae.style;de.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(de.transitionDuration="0s, 0s")}),X&&(I.current=Date.now())}),[V]};function j(){return j=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(F[I]=V[I])}return F},j.apply(this,arguments)}function B(F,W){return M(F)||b(F,W)||A(F,W)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(F,W){if(!F)return;if(typeof F=="string")return p(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return p(F,W)}function p(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=F[V];return I}function b(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],I=!0,N=!1,X=void 0;try{for(var q=F[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(V.push(ae.value),W&&V.length===W);I=!0);}catch(de){N=!0,X=de}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return V}function M(F){if(Array.isArray(F))return F}function L(F,W){if(F==null)return{};var V=C(F,W),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(F);for(N=0;N<X.length;N++){if(I=X[N],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,I))continue;V[I]=F[I]}}return V}function C(F,W){if(F==null)return{};var V={},I=Object.keys(F),N,X;for(X=0;X<I.length;X++){if(N=I[X],W.indexOf(N)>=0)continue;V[N]=F[N]}return V}var E=function(W){var V=W.className,I=W.percent,N=W.prefixCls,X=W.strokeColor,q=W.strokeLinecap,ae=W.strokeWidth,de=W.style,Ae=W.trailColor,be=W.trailWidth,Ce=W.transition,Te=L(W,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var Se=Array.isArray(I)?I:[I],pe=Array.isArray(X)?X:[X],ue=_(Se),te=B(ue,1),fe=te[0],oe=ae/2,Le=100-ae/2,_e="M ".concat(q==="round"?oe:0,",").concat(oe,`
|
|
L `).concat(q==="round"?Le:100,",").concat(oe),Ee="0 0 100 ".concat(ae),Pe=0;return Q.a.createElement("svg",j({className:Y()("".concat(N,"-line"),V),viewBox:Ee,preserveAspectRatio:"none",style:de},Te),Q.a.createElement("path",{className:"".concat(N,"-line-trail"),d:_e,strokeLinecap:q,stroke:Ae,strokeWidth:be||ae,fillOpacity:"0"}),Se.map(function(Be,Ve){var We={strokeDasharray:"".concat(Be,"px, 100px"),strokeDashoffset:"-".concat(Pe,"px"),transition:Ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Fe=pe[Ve]||pe[pe.length-1];return Pe+=Be,Q.a.createElement("path",{key:Ve,className:"".concat(N,"-line-path"),d:_e,strokeLinecap:q,stroke:Fe,strokeWidth:ae,fillOpacity:"0",ref:fe[Ve],style:We})}))};E.defaultProps=U;var h=E;function o(){return o=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(F[I]=V[I])}return F},o.apply(this,arguments)}function l(F,W){return D(F)||y(F,W)||w(F,W)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,W){if(!F)return;if(typeof F=="string")return f(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return f(F,W)}function f(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=F[V];return I}function y(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],I=!0,N=!1,X=void 0;try{for(var q=F[Symbol.iterator](),ae;!(I=(ae=q.next()).done)&&!(V.push(ae.value),W&&V.length===W);I=!0);}catch(de){N=!0,X=de}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return V}function D(F){if(Array.isArray(F))return F}function T(F,W){if(F==null)return{};var V=g(F,W),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(F);for(N=0;N<X.length;N++){if(I=X[N],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,I))continue;V[I]=F[I]}}return V}function g(F,W){if(F==null)return{};var V={},I=Object.keys(F),N,X;for(X=0;X<I.length;X++){if(N=I[X],W.indexOf(N)>=0)continue;V[N]=F[N]}return V}var c=0;function u(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function S(F,W,V,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,q=50-I/2,ae=0,de=-q,Ae=0,be=-2*q;switch(X){case"left":ae=-q,de=0,Ae=2*q,be=0;break;case"right":ae=q,de=0,Ae=-2*q,be=0;break;case"bottom":de=q,be=2*q;break;default:}var Ce="M 50,50 m ".concat(ae,",").concat(de,`
|
|
a `).concat(q,",").concat(q," 0 1 1 ").concat(Ae,",").concat(-be,`
|
|
a `).concat(q,",").concat(q," 0 1 1 ").concat(-Ae,",").concat(be),Te=Math.PI*2*q,Se={stroke:V,strokeDasharray:"".concat(W/100*(Te-N),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(N/2+F/100*(Te-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ce,pathStyle:Se}}var x=function(W){var V=W.prefixCls,I=W.strokeWidth,N=W.trailWidth,X=W.gapDegree,q=W.gapPosition,ae=W.trailColor,de=W.strokeLinecap,Ae=W.style,be=W.className,Ce=W.strokeColor,Te=W.percent,Se=T(W,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ie.useMemo)(function(){return c+=1,c},[]),ue=S(0,100,ae,I,X,q),te=ue.pathString,fe=ue.pathStyle,oe=a(Te),Le=a(Ce),_e=Le.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),Ee=_(oe),Pe=l(Ee,1),Be=Pe[0],Ve=function(){var Fe=0;return oe.map(function(Ue,st){var ot=Le[st]||Le[Le.length-1],it=Object.prototype.toString.call(ot)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(pe,")"):"",Je=S(Fe,Ue,ot,I,X,q);return Fe+=Ue,Q.a.createElement("path",{key:st,className:"".concat(V,"-circle-path"),d:Je.pathString,stroke:it,strokeLinecap:de,strokeWidth:I,opacity:Ue===0?0:1,fillOpacity:"0",style:Je.pathStyle,ref:Be[st]})})};return Q.a.createElement("svg",o({className:Y()("".concat(V,"-circle"),be),viewBox:"0 0 100 100",style:Ae},Se),_e&&Q.a.createElement("defs",null,Q.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(_e).sort(function(We,Fe){return u(We)-u(Fe)}).map(function(We,Fe){return Q.a.createElement("stop",{key:Fe,offset:We,stopColor:_e[We]})}))),Q.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:ae,strokeLinecap:de,strokeWidth:N||I,fillOpacity:"0",style:fe}),Ve().reverse())};x.defaultProps=U;var v=x,O={Line:h,Circle:v}},kSUc:function(ht,qe,se){},lZu9:function(ht,qe,se){(function(ie){ie(se("VrN/"),se("1eCo"),se("8EBN"))})(function(ie){"use strict";ie.defineMode("markdown",function(Q,R){var Y=ie.getMode(Q,"text/html"),U=Y.name=="null";function _(I){if(ie.findModeByName){var N=ie.findModeByName(I);N&&(I=N.mime||N.mimes[0])}var X=ie.getMode(Q,I);return X.name=="null"?null:X}R.highlightFormatting===void 0&&(R.highlightFormatting=!1),R.maxBlockquoteDepth===void 0&&(R.maxBlockquoteDepth=0),R.taskLists===void 0&&(R.taskLists=!1),R.strikethrough===void 0&&(R.strikethrough=!1),R.emoji===void 0&&(R.emoji=!1),R.fencedCodeBlockHighlighting===void 0&&(R.fencedCodeBlockHighlighting=!0),R.fencedCodeBlockDefaultMode===void 0&&(R.fencedCodeBlockDefaultMode="text/plain"),R.xml===void 0&&(R.xml=!0),R.tokenTypeOverrides===void 0&&(R.tokenTypeOverrides={});var j={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 B in j)j.hasOwnProperty(B)&&R.tokenTypeOverrides[B]&&(j[B]=R.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,p=/^\[(x| )\](?=\s)/i,b=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(I,N,X){return N.f=N.inline=X,X(I,N)}function d(I,N,X){return N.f=N.block=X,X(I,N)}function w(I){return!I||!/\S/.test(I.string)}function f(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==D){var N=U;if(!N){var X=ie.innerMode(Y,I.htmlState);N=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}N&&(I.f=u,I.block=y,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function y(I,N){var X=I.column()===N.indentation,q=w(N.prevLine.stream),ae=N.indentedCode,de=N.prevLine.hr,Ae=N.list!==!1,be=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Ce=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ae)){for(N.list=null;Ce<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Ce-N.listStack[N.listStack.length-1])}var Te=!q&&!de&&!N.prevLine.header&&(!Ae||!ae)&&!N.prevLine.fencedCodeEnd,Se=(N.list===!1||de||q)&&N.indentation<=be&&I.match(P),pe=null;if(N.indentationDiff>=4&&(ae||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return I.skipToEnd(),N.indentedCode=!0,j.code;if(I.eatSpace())return null;if(X&&N.indentation<=be&&(pe=I.match(b))&&pe[1].length<=6)return N.quote=0,N.header=pe[1].length,N.thisLine.header=!0,R.highlightFormatting&&(N.formatting="header"),N.f=N.inline,g(N);if(N.indentation<=be&&I.eat(">"))return N.quote=X?1:N.quote+1,R.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),g(N);if(!Se&&!N.setext&&X&&N.indentation<=be&&(pe=I.match(A))){var ue=pe[1]?"ol":"ul";return N.indentation=Ce+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,R.taskLists&&I.match(p,!1)&&(N.taskList=!0),N.f=N.inline,R.highlightFormatting&&(N.formatting=["list","list-"+ue]),g(N)}else{if(X&&N.indentation<=be&&(pe=I.match(C,!0)))return N.quote=0,N.fencedEndRE=new RegExp(pe[1]+"+ *$"),N.localMode=R.fencedCodeBlockHighlighting&&_(pe[2]||R.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ie.startState(N.localMode)),N.f=N.block=T,R.highlightFormatting&&(N.formatting="code-block"),N.code=-1,g(N);if(N.setext||(!Te||!Ae)&&!N.quote&&N.list===!1&&!N.code&&!Se&&!E.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(M)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),R.highlightFormatting&&(N.formatting="header")):(N.header=pe[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,g(N);if(Se)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,j.hr;if(I.peek()==="[")return l(I,N,O)}return l(I,N,N.inline)}function D(I,N){var X=Y.token(I,N.htmlState);if(!U){var q=ie.innerMode(Y,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=u,N.block=y,N.htmlState=null)}return X}function T(I,N){var X=N.listStack[N.listStack.length-1]||0,q=N.indentation<X,ae=X+3;if(N.fencedEndRE&&N.indentation<=ae&&(q||I.match(N.fencedEndRE))){R.highlightFormatting&&(N.formatting="code-block");var de;return q||(de=g(N)),N.localMode=N.localState=null,N.block=y,N.f=u,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?d(I,N,N.block):de}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),j.code)}function g(I){var N=[];if(I.formatting){N.push(j.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var X=0;X<I.formatting.length;X++)N.push(j.formatting+"-"+I.formatting[X]),I.formatting[X]==="header"&&N.push(j.formatting+"-"+I.formatting[X]+"-"+I.header),I.formatting[X]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?N.push(j.formatting+"-"+I.formatting[X]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(j.linkHref,"url"):(I.strong&&N.push(j.strong),I.em&&N.push(j.em),I.strikethrough&&N.push(j.strikethrough),I.emoji&&N.push(j.emoji),I.linkText&&N.push(j.linkText),I.code&&N.push(j.code),I.image&&N.push(j.image),I.imageAltText&&N.push(j.imageAltText,"link"),I.imageMarker&&N.push(j.imageMarker)),I.header&&N.push(j.header,j.header+"-"+I.header),I.quote&&(N.push(j.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?N.push(j.quote+"-"+I.quote):N.push(j.quote+"-"+R.maxBlockquoteDepth)),I.list!==!1){var q=(I.listStack.length-1)%3;q?q===1?N.push(j.list2):N.push(j.list3):N.push(j.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(I,N){return I.match(L,!0)?g(N):void 0}function u(I,N){var X=N.text(I,N);if(typeof X!="undefined")return X;if(N.list)return N.list=null,g(N);if(N.taskList){var q=I.match(p,!0)[1]===" ";return q?N.taskOpen=!0:N.taskClosed=!0,R.highlightFormatting&&(N.formatting="task"),N.taskList=!1,g(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return R.highlightFormatting&&(N.formatting="header"),g(N);var ae=I.next();if(N.linkTitle){N.linkTitle=!1;var de=ae;ae==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ae="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(I.match(new RegExp(Ae),!0))return j.linkHref}if(ae==="`"){var be=N.formatting;R.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Ce=I.current().length;if(N.code==0&&(!N.quote||Ce==1))return N.code=Ce,g(N);if(Ce==N.code){var Te=g(N);return N.code=0,Te}else return N.formatting=be,g(N)}else if(N.code)return g(N);if(ae==="\\"&&(I.next(),R.highlightFormatting)){var Se=g(N),pe=j.formatting+"-escape";return Se?Se+" "+pe:pe}if(ae==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,R.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,R.highlightFormatting&&(N.formatting="image"),g(N);if(ae==="]"&&N.imageAltText){R.highlightFormatting&&(N.formatting="image");var Se=g(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=S,Se}if(ae==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,R.highlightFormatting&&(N.formatting="link")),g(N);if(ae==="]"&&N.linkText){R.highlightFormatting&&(N.formatting="link");var Se=g(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?S:u,Se}if(ae==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,R.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+j.linkInline}if(ae==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,R.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+j.linkEmail}if(R.xml&&ae==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var te=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ie.startState(Y),d(I,N,D)}if(R.xml&&ae==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var fe=1,oe=I.pos==1?" ":I.string.charAt(I.pos-2);fe<3&&I.eat(ae);)fe++;var Le=I.peek()||" ",_e=!/\s/.test(Le)&&(!h.test(Le)||/\s/.test(oe)||h.test(oe)),Ee=!/\s/.test(oe)&&(!h.test(oe)||/\s/.test(Le)||h.test(Le)),Pe=null,Be=null;if(fe%2&&(!N.em&&_e&&(ae==="*"||!Ee||h.test(oe))?Pe=!0:N.em==ae&&Ee&&(ae==="*"||!_e||h.test(Le))&&(Pe=!1)),fe>1&&(!N.strong&&_e&&(ae==="*"||!Ee||h.test(oe))?Be=!0:N.strong==ae&&Ee&&(ae==="*"||!_e||h.test(Le))&&(Be=!1)),Be!=null||Pe!=null){R.highlightFormatting&&(N.formatting=Pe==null?"strong":Be==null?"em":"strong em"),Pe===!0&&(N.em=ae),Be===!0&&(N.strong=ae);var Te=g(N);return Pe===!1&&(N.em=!1),Be===!1&&(N.strong=!1),Te}}else if(ae===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return g(N);I.backUp(1)}if(R.strikethrough){if(ae==="~"&&I.eatWhile(ae)){if(N.strikethrough){R.highlightFormatting&&(N.formatting="strikethrough");var Te=g(N);return N.strikethrough=!1,Te}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,R.highlightFormatting&&(N.formatting="strikethrough"),g(N)}else if(ae===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return g(N);I.backUp(2)}}if(R.emoji&&ae===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,R.highlightFormatting&&(N.formatting="emoji");var Ve=g(N);return N.emoji=!1,Ve}return ae===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),g(N)}function a(I,N){var X=I.next();if(X===">"){N.f=N.inline=u,R.highlightFormatting&&(N.formatting="link");var q=g(N);return q?q+=" ":q="",q+j.linkInline}return I.match(/^[^>]+/,!0),j.linkInline}function S(I,N){if(I.eatSpace())return null;var X=I.next();return X==="("||X==="["?(N.f=N.inline=v(X==="("?")":"]"),R.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,g(N)):"error"}var x={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(I){return function(N,X){var q=N.next();if(q===I){X.f=X.inline=u,R.highlightFormatting&&(X.formatting="link-string");var ae=g(X);return X.linkHref=!1,ae}return N.match(x[I]),X.linkHref=!0,g(X)}}function O(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=F,I.next(),R.highlightFormatting&&(N.formatting="link"),N.linkText=!0,g(N)):l(I,N,u)}function F(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=W,R.highlightFormatting&&(N.formatting="link");var X=g(N);return N.linkText=!1,X}return I.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function W(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=u,j.linkHref+" url")}var V={startState:function(){return{f:y,prevLine:{stream:null},thisLine:{stream:null},block:y,htmlState:null,indentation:0,inline:u,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ie.copyState(Y,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ie.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return f(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=D)){var X=I.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(N.indentation=X,N.indentationDiff=null,X>0)return null}}return N.f(I,N)},innerMode:function(I){return I.block==D?{state:I.htmlState,mode:Y}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:V}},indent:function(I,N,X){return I.block==D&&Y.indent?Y.indent(I.htmlState,N,X):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,X):ie.Pass},blankLine:f,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ie.defineMIME("text/markdown","markdown"),ie.defineMIME("text/x-markdown","markdown")})},nVVt:function(ht,qe){ht.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(ht,qe,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";var Q=ie.Pos;function R(h,o){return h.line-o.line||h.ch-o.ch}var Y="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=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",_=new RegExp("<(/?)(["+Y+"]["+U+"]*)","g");function j(h,o,l,d){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function B(h,o){var l=h.cm.getTokenTypeAt(Q(h.line,o));return l&&/\btag\b/.test(l)}function P(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function A(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function p(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(P(h))continue;return}if(!B(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function b(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(A(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}_.lastIndex=o,h.ch=o;var l=_.exec(h.text);if(l&&l.index==o)return l}}function M(h){for(;;){_.lastIndex=h.ch;var o=_.exec(h.text);if(!o){if(P(h))continue;return}if(!B(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function L(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(A(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function C(h,o){for(var l=[];;){var d=M(h),w,f=h.line,y=h.ch-(d?d[0].length:0);if(!d||!(w=p(h)))return;if(w=="selfClose")continue;if(d[1]){for(var D=l.length-1;D>=0;--D)if(l[D]==d[2]){l.length=D;break}if(D<0&&(!o||o==d[2]))return{tag:d[2],from:Q(f,y),to:Q(h.line,h.ch)}}else l.push(d[2])}}function E(h,o){for(var l=[];;){var d=L(h);if(!d)return;if(d=="selfClose"){b(h);continue}var w=h.line,f=h.ch,y=b(h);if(!y)return;if(y[1])l.push(y[2]);else{for(var D=l.length-1;D>=0;--D)if(l[D]==y[2]){l.length=D;break}if(D<0&&(!o||o==y[2]))return{tag:y[2],from:Q(h.line,h.ch),to:Q(w,f)}}}}ie.registerHelper("fold","xml",function(h,o){for(var l=new j(h,o.line,0);;){var d=M(l);if(!d||l.line!=o.line)return;var w=p(l);if(!w)return;if(!d[1]&&w!="selfClose"){var f=Q(l.line,l.ch),y=C(l,d[2]);return y&&R(y.from,f)>0?{from:f,to:y.from}:null}}}),ie.findMatchingTag=function(h,o,l){var d=new j(h,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=p(d),f=w&&Q(d.line,d.ch),y=w&&b(d);if(!w||!y||R(d,o)>0)return;var D={from:Q(d.line,d.ch),to:f,tag:y[2]};return w=="selfClose"?{open:D,close:null,at:"open"}:y[1]?{open:E(d,y[2]),close:D,at:"close"}:(d=new j(h,f.line,f.ch,l),{open:D,close:C(d,y[2]),at:"open"})},ie.findEnclosingTag=function(h,o,l,d){for(var w=new j(h,o.line,o.ch,l);;){var f=E(w,d);if(!f)break;var y=new j(h,o.line,o.ch,l),D=C(y,f.tag);if(D)return{open:f,close:D}}},ie.scanForClosingTag=function(h,o,l,d){var w=new j(h,o.line,o.ch,d?{from:0,to:d}:null);return C(w,l)}})},p5ED:function(ht,qe,se){"use strict";var ie=se("+L6B"),Q=se("2/Rp"),R=se("5Dmo"),Y=se("3S7+"),U=se("k1fw"),_=se("tJVT"),j=se("q1tI"),B=se.n(j),P=se("vHTk"),A=se.n(P),p=se("yEEn"),b=se("ZW9T"),M=se("1vsH");qe.a=function(L){var C=L.name,E=L.data,h=L.theme,o=L.type,l=L.filename,d=L.monacoEditor,w=L.className,f=L.style,y=L.close,D=L.onClose,T=L.hasMask,g=Object(j.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(_.a)(g,2),u=c[0],a=c[1],S=Object(j.useState)(""),x=Object(_.a)(S,2),v=x[0],O=x[1],F=Object(j.useRef)();l&&(d.filename=l),Object(j.useEffect)(function(){var I,N,X=(I=document.cookie)===null||I===void 0||((N=I.replace(/\s/g,""))===null||N===void 0)?void 0:N.split(";");X==null||X.map(function(q){var ae=q.split("=");ae[0]==="_educoder_session"&&O(ae[1])})},[]);var W=function(){if(E.startsWith("http")||E.startsWith("/")){V();return}Object(M.x)(l||"educoder",E,l)},V=function(){Object(M.v)(l||C,E)};return console.log("data:",E,"fileanme:",l," name:",C),B.a.createElement("div",{style:Object(U.a)({},f||{}),className:"".concat(T&&A.a.bgBlack," ").concat(o?A.a.wrp:"hide")},y&&B.a.createElement("div",{className:A.a.close,ref:F},B.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},B.a.createElement("span",{onClick:V},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},B.a.createElement("span",{className:"",onClick:D},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(A.a[w]," ").concat(w," ").concat(A.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&B.a.createElement(b.b,d)),o==="audio"&&B.a.createElement("audio",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?E:"data:audio/mp3;base64,").concat(E),autoPlay:!0}),o==="video"&&B.a.createElement(B.a.Fragment,null,E!=null&&E.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(E),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(E),autoPlay:!0})),o==="html"&&B.a.createElement("iframe",{src:E+"&disposition=inline"}),o==="pdf"&&B.a.createElement("embed",{className:A.a.embed,src:E}),o==="pdfeditor"&&B.a.createElement("div",null,B.a.createElement("iframe",{src:"https://a1office.co/solutions/editor/pdf-editor/\u67E5\u91CD\u6587\u68631-8839d79b81e8bda0d298ca058913ab88.pdf"}),B.a.createElement("div",{style:{position:"absolute",left:"1px",top:"1px",width:180,height:60,background:"#f9f9f9"}})),o==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(E)})),o==="other"&&B.a.createElement("div",null,B.a.createElement(Q.a,{type:"primary",size:"large",onClick:W},B.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&B.a.createElement(Q.a,{type:"primary",size:"large",onClick:W},B.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ht,qe,se){},"rAM+":function(ht,qe,se){"use strict";se.d(qe,"a",function(){return Q});var ie=se("Qw5x");function Q(R,Y){var U;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(U=Object(ie.a)(R))||Y&&R&&typeof R.length=="number"){U&&(R=U);var _=0,j=function(){};return{s:j,n:function(){return _>=R.length?{done:!0}:{done:!1,value:R[_++]}},e:function(b){throw b},f:j}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,P=!1,A;return{s:function(){U=R[Symbol.iterator]()},n:function(){var b=U.next();return B=b.done,b},e:function(b){P=!0,A=b},f:function(){try{!B&&U.return!=null&&U.return()}finally{if(P)throw A}}}}},rUJ1:function(ht,qe){const se=/[&<>"']/,ie=/[&<>"']/g,Q=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},U=T=>Y[T];function _(T,g){if(g){if(se.test(T))return T.replace(ie,U)}else if(Q.test(T))return T.replace(R,U);return T}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(T){return T.replace(j,(g,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 P=/(^|[^\[])\^/g;function A(T,g){T=T.source||T,g=g||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(P,"$1"),T=T.replace(u,a),c),getRegex:()=>new RegExp(T,g)};return c}const p=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(T,g,c){if(T){let u;try{u=decodeURIComponent(B(c)).replace(p,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}g&&!b.test(c)&&(c=o(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const L={},C=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(T,g){L[" "+T]||(C.test(T)?L[" "+T]=T+"/":L[" "+T]=f(T,"/",!0)),T=L[" "+T];const c=T.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:T.replace(E,"$1")+g:g.charAt(0)==="/"?c?g:T.replace(h,"$1")+g:T+g}const l={exec:function(){}};function d(T){let g=1,c,u;for(;g<arguments.length;g++){c=arguments[g];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(T[u]=c[u])}return T}function w(T,g){const c=T.replace(/\|/g,(S,x,v)=>{let O=!1,F=x;for(;--F>=0&&v[F]==="\\";)O=!O;return O?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>g)u.splice(g);else for(;u.length<g;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function f(T,g,c){const u=T.length;if(u===0)return"";let a=0;for(;a<u;){const S=T.charAt(u-a-1);if(S===g&&!c)a++;else if(S!==g&&c)a++;else break}return T.substr(0,u-a)}function y(T,g){if(T.indexOf(g[1])===-1)return-1;const c=T.length;let u=0,a=0;for(;a<c;a++)if(T[a]==="\\")a++;else if(T[a]===g[0])u++;else if(T[a]===g[1]&&(u--,u<0))return a;return-1}function D(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ht.exports={escape:_,unescape:B,edit:A,cleanUrl:M,resolveUrl:o,noopTest:l,merge:d,splitCells:w,rtrim:f,findClosingBracket:y,checkSanitizeDeprecation:D}},rcnY:function(ht,qe,se){var ie=se("aRTE");function Q(R,Y){this.totalCount=R,this.dataCount=Y}Q.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],Q.getRSBlocks=function(R,Y){var U=Q.getRsBlockTable(R,Y);if(U==null)throw new Error("bad rs block @ typeNumber:"+R+"/errorCorrectLevel:"+Y);for(var _=U.length/3,j=new Array,B=0;B<_;B++)for(var P=U[B*3+0],A=U[B*3+1],p=U[B*3+2],b=0;b<P;b++)j.push(new Q(A,p));return j},Q.getRsBlockTable=function(R,Y){switch(Y){case ie.L:return Q.RS_BLOCK_TABLE[(R-1)*4+0];case ie.M:return Q.RS_BLOCK_TABLE[(R-1)*4+1];case ie.Q:return Q.RS_BLOCK_TABLE[(R-1)*4+2];case ie.H:return Q.RS_BLOCK_TABLE[(R-1)*4+3];default:return}},ht.exports=Q},ulZh:function(ht,qe,se){typeof window!="undefined"&&function(Q,R){ht.exports=R()}(this,function(){return function(ie){var Q={};function R(Y){if(Q[Y])return Q[Y].exports;var U=Q[Y]={i:Y,l:!1,exports:{}};return ie[Y].call(U.exports,U,U.exports,R),U.l=!0,U.exports}return R.m=ie,R.c=Q,R.d=function(Y,U,_){R.o(Y,U)||Object.defineProperty(Y,U,{enumerable:!0,get:_})},R.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},R.t=function(Y,U){if(U&1&&(Y=R(Y)),U&8)return Y;if(U&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var _=Object.create(null);if(R.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:Y}),U&2&&typeof Y!="string")for(var j in Y)R.d(_,j,function(B){return Y[B]}.bind(null,j));return _},R.n=function(Y){var U=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return R.d(U,"a",U),U},R.o=function(Y,U){return Object.prototype.hasOwnProperty.call(Y,U)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ie,Q,R){"use strict";var Y=Object.prototype.hasOwnProperty,U="~";function _(){}Object.create&&(_.prototype=Object.create(null),new _().__proto__||(U=!1));function j(p,b,M){this.fn=p,this.context=b,this.once=M||!1}function B(p,b,M,L,C){if(typeof M!="function")throw new TypeError("The listener must be a function");var E=new j(M,L||p,C),h=U?U+b:b;return p._events[h]?p._events[h].fn?p._events[h]=[p._events[h],E]:p._events[h].push(E):(p._events[h]=E,p._eventsCount++),p}function P(p,b){--p._eventsCount===0?p._events=new _:delete p._events[b]}function A(){this._events=new _,this._eventsCount=0}A.prototype.eventNames=function(){var b=[],M,L;if(this._eventsCount===0)return b;for(L in M=this._events)Y.call(M,L)&&b.push(U?L.slice(1):L);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(M)):b},A.prototype.listeners=function(b){var M=U?U+b:b,L=this._events[M];if(!L)return[];if(L.fn)return[L.fn];for(var C=0,E=L.length,h=new Array(E);C<E;C++)h[C]=L[C].fn;return h},A.prototype.listenerCount=function(b){var M=U?U+b:b,L=this._events[M];return L?L.fn?1:L.length:0},A.prototype.emit=function(b,M,L,C,E,h){var o=U?U+b:b;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,w,f;if(l.fn){l.once&&this.removeListener(b,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,M),!0;case 3:return l.fn.call(l.context,M,L),!0;case 4:return l.fn.call(l.context,M,L,C),!0;case 5:return l.fn.call(l.context,M,L,C,E),!0;case 6:return l.fn.call(l.context,M,L,C,E,h),!0}for(f=1,w=new Array(d-1);f<d;f++)w[f-1]=arguments[f];l.fn.apply(l.context,w)}else{var y=l.length,D;for(f=0;f<y;f++){l[f].once&&this.removeListener(b,l[f].fn,void 0,!0);switch(d){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,M);break;case 3:l[f].fn.call(l[f].context,M,L);break;case 4:l[f].fn.call(l[f].context,M,L,C);break;default:if(!w)for(D=1,w=new Array(d-1);D<d;D++)w[D-1]=arguments[D];l[f].fn.apply(l[f].context,w)}}}return!0},A.prototype.on=function(b,M,L){return B(this,b,M,L,!1)},A.prototype.once=function(b,M,L){return B(this,b,M,L,!0)},A.prototype.removeListener=function(b,M,L,C){var E=U?U+b:b;if(!this._events[E])return this;if(!M)return P(this,E),this;var h=this._events[E];if(h.fn)h.fn===M&&(!C||h.once)&&(!L||h.context===L)&&P(this,E);else{for(var o=0,l=[],d=h.length;o<d;o++)(h[o].fn!==M||C&&!h[o].once||L&&h[o].context!==L)&&l.push(h[o]);l.length?this._events[E]=l.length===1?l[0]:l:P(this,E)}return this},A.prototype.removeAllListeners=function(b){var M;return b?(M=U?U+b:b,this._events[M]&&P(this,M)):(this._events=new _,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=U,A.EventEmitter=A,ie.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ie,Q,R){(function(Y){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,_=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(A,p,b){if(b=b||{},A=A.trim(),p=p.trim(),!p){if(!b.alwaysNormalize)return A;var M=P.parseURL(A);if(!M)throw new Error("Error trying to parse base URL.");return M.path=P.normalizePath(M.path),P.buildURLFromParts(M)}var L=P.parseURL(p);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return b.alwaysNormalize?(L.path=P.normalizePath(L.path),P.buildURLFromParts(L)):p;var C=P.parseURL(A);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var E=_.exec(C.path);C.netLoc=E[1],C.path=E[2]}C.netLoc&&!C.path&&(C.path="/");var h={scheme:C.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(h.netLoc=C.netLoc,L.path[0]!=="/"))if(!L.path)h.path=C.path,L.params||(h.params=C.params,L.query||(h.query=C.query));else{var o=C.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;h.path=P.normalizePath(l)}return h.path===null&&(h.path=b.alwaysNormalize?P.normalizePath(L.path):L.path),P.buildURLFromParts(h)},parseURL:function(A){var p=U.exec(A);return p?{scheme:p[1]||"",netLoc:p[2]||"",path:p[3]||"",params:p[4]||"",query:p[5]||"",fragment:p[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(j,"");A.length!==(A=A.replace(B,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ie.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ie,Q,R){function Y(b){var M={};function L(E){if(M[E])return M[E].exports;var h=M[E]={i:E,l:!1,exports:{}};return b[E].call(h.exports,h,h.exports,L),h.l=!0,h.exports}L.m=b,L.c=M,L.i=function(E){return E},L.d=function(E,h,o){L.o(E,h)||Object.defineProperty(E,h,{configurable:!1,enumerable:!0,get:o})},L.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},L.n=function(E){var h=E&&E.__esModule?function(){return E.default}:function(){return E};return L.d(h,"a",h),h},L.o=function(E,h){return Object.prototype.hasOwnProperty.call(E,h)},L.p="/",L.oe=function(E){throw console.error(E),E};var C=L(L.s=ENTRY_MODULE);return C.default||C}var U="[\\.|\\-|\\+|\\w|/|@]+",_="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function j(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(b){return!isNaN(1*b)}function P(b,M,L){var C={};C[L]=[];var E=M.toString(),h=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return C;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+j(o)+_,"g"),d;d=l.exec(E);){if(d[3]==="dll-reference")continue;C[L].push(d[3])}for(l=new RegExp("\\("+j(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+_,"g");d=l.exec(E);)b[d[2]]||(C[L].push(d[1]),b[d[2]]=R(d[1]).m),C[d[2]]=C[d[2]]||[],C[d[2]].push(d[4]);for(var w=Object.keys(C),f=0;f<w.length;f++)for(var y=0;y<C[w[f]].length;y++)B(C[w[f]][y])&&(C[w[f]][y]=1*C[w[f]][y]);return C}function A(b){var M=Object.keys(b);return M.reduce(function(L,C){return L||b[C].length>0},!1)}function p(b,M){for(var L={main:[M]},C={main:[]},E={main:{}};A(L);)for(var h=Object.keys(L),o=0;o<h.length;o++){var l=h[o],d=L[l],w=d.pop();if(E[l]=E[l]||{},E[l][w]||!b[l][w])continue;E[l][w]=!0,C[l]=C[l]||[],C[l].push(w);for(var f=P(b,b[l][w],l),y=Object.keys(f),D=0;D<y.length;D++)L[y[D]]=L[y[D]]||[],L[y[D]]=L[y[D]].concat(f[y[D]])}return C}ie.exports=function(b,M){M=M||{};var L={main:R.m},C=M.all?{main:Object.keys(L.main)}:p(L,b),E="";Object.keys(C).filter(function(w){return w!=="main"}).forEach(function(w){for(var f=0;C[w][f];)f++;C[w].push(f),L[w][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+w+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+C[w].map(function(y){return""+JSON.stringify(y)+": "+L[w][y].toString()}).join(",")+`});
|
|
`}),E=E+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+C.main.map(function(w){return""+JSON.stringify(w)+": "+L.main[w].toString()}).join(",")+"}))(self);";var h=new window.Blob([E],{type:"text/javascript"});if(M.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"hlsDefaultConfig",function(){return D}),R.d(Q,"mergeConfig",function(){return g}),R.d(Q,"enableStreamingMode",function(){return c});var Y=R("./src/controller/abr-controller.ts"),U=R("./src/controller/audio-stream-controller.ts"),_=R("./src/controller/audio-track-controller.ts"),j=R("./src/controller/subtitle-stream-controller.ts"),B=R("./src/controller/subtitle-track-controller.ts"),P=R("./src/controller/buffer-controller.ts"),A=R("./src/controller/timeline-controller.ts"),p=R("./src/controller/cap-level-controller.ts"),b=R("./src/controller/fps-controller.ts"),M=R("./src/controller/eme-controller.ts"),L=R("./src/controller/cmcd-controller.ts"),C=R("./src/utils/xhr-loader.ts"),E=R("./src/utils/fetch-loader.ts"),h=R("./src/utils/cues.ts"),o=R("./src/utils/mediakeys-helper.ts"),l=R("./src/utils/logger.ts");function d(){return d=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var S=arguments[a];for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(u[x]=S[x])}return u},d.apply(this,arguments)}function w(u,a){var S=Object.keys(u);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);a&&(x=x.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),S.push.apply(S,x)}return S}function f(u){for(var a=1;a<arguments.length;a++){var S=arguments[a]!=null?arguments[a]:{};a%2?w(Object(S),!0).forEach(function(x){y(u,x,S[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(S)):w(Object(S)).forEach(function(x){Object.defineProperty(u,x,Object.getOwnPropertyDescriptor(S,x))})}return u}function y(u,a,S){return a in u?Object.defineProperty(u,a,{value:S,enumerable:!0,configurable:!0,writable:!0}):u[a]=S,u}var D=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:P.default,capLevelController:p.default,fpsController:b.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:B.default,timelineController:A.TimelineController,audioStreamController:U.default,audioTrackController:_.default,emeController:M.default,cmcdController:L.default});function T(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function g(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},u,a)}function c(u){var a=u.loader;if(a!==E.default&&a!==C.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var S=Object(E.fetchSupported)();S&&(u.loader=E.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/ewma-bandwidth-estimator.ts"),_=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/errors.ts"),P=R("./src/types/loader.ts"),A=R("./src/utils/logger.ts");function p(L,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function b(L,C,E){return C&&p(L.prototype,C),E&&p(L,E),L}var M=function(){function L(E){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=E;var h=E.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var C=L.prototype;return C.registerListeners=function(){var h=this.hls;h.on(_.Events.FRAG_LOADING,this.onFragLoading,this),h.on(_.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(_.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var h=this.hls;h.off(_.Events.FRAG_LOADING,this.onFragLoading,this),h.off(_.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(_.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(h,o){var l=o.frag;if(l.type===P.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,w=l.config,f=l.media;if(!h||!f)return;var y=o?o.stats:h.stats,D=o?o.duration:h.duration;if(y.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||f.paused||!f.playbackRate||!f.readyState)return;var T=performance.now()-y.loading.start,g=Math.abs(f.playbackRate);if(T<=500*D/g)return;var c=l.levels,u=l.minAutoLevel,a=c[h.level],S=y.total||Math.max(y.loaded,Math.round(D*a.maxBitrate/8)),x=Math.max(1,y.bwEstimate?y.bwEstimate/8:y.loaded*1e3/T),v=(S-y.loaded)/x,O=f.currentTime,F=(j.BufferHelper.bufferInfo(f,O,w.maxBufferHole).end-O)/g;if(F>=2*D/g||v<=F)return;var W=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>u;V--){var I=c[V].maxBitrate;if(W=D*I/(8*.8*x),W<F)break}if(W>=v)return;var N=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(Y.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(T,y.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(_.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:y})},C.onFragLoaded=function(h,o){var l=o.frag,d=o.part;if(l.type===P.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(l.sn)){var w=d?d.stats:l.stats,f=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var y=this.hls.levels[l.level],D=(y.loaded?y.loaded.bytes:0)+w.loaded,T=(y.loaded?y.loaded.duration:0)+f;y.loaded={bytes:D,duration:T},y.realBitrate=Math.round(8*D/T)}if(l.bitrateTest){var g={stats:w,frag:l,part:d,id:l.type};this.onFragBuffered(_.Events.FRAG_BUFFERED,g),l.bitrateTest=!1}}},C.onFragBuffered=function(h,o){var l=o.frag,d=o.part,w=d?d.stats:l.stats;if(w.aborted)return;if(l.type!==P.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var f=w.parsing.end-w.loading.start;this.bwEstimator.sample(f,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},C.onError=function(h,o){switch(o.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,w=l.config,f=l.minAutoLevel,y=l.media,D=o?o.duration:h?h.duration:0,T=y?y.currentTime:0,g=y&&y.playbackRate!==0?Math.abs(y.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,u=(j.BufferHelper.bufferInfo(y,T,w.maxBufferHole).end-T)/g,a=this.findBestLevel(c,f,d,u,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;A.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var S=D?Math.min(D,w.maxStarvationDelay):w.maxStarvationDelay,x=w.abrBandWidthFactor,v=w.abrBandWidthUpFactor;if(!u){var O=this.bitrateTestDelay;if(O){var F=D?Math.min(D,w.maxLoadingDelay):w.maxLoadingDelay;S=F-O,A.logger.trace("bitrate test took "+Math.round(1e3*O)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*S)+" ms"),x=v=1}}return a=this.findBestLevel(c,f,d,u+S,x,v),Math.max(a,0)},C.findBestLevel=function(h,o,l,d,w,f){for(var y,D=this.fragCurrent,T=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,u=c[g],a=!!(u!=null&&(y=u.details)!==null&&y!==void 0&&y.live),S=u==null?void 0:u.codecSet,x=T?T.duration:D?D.duration:0,v=l;v>=o;v--){var O=c[v];if(!O||S&&O.codecSet!==S)continue;var F=O.details,W=(T?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||x,V=void 0;v<=g?V=w*h:V=f*h;var I=c[v].maxBitrate,N=I*W/V;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(V)+"/"+I+"/"+W+"/"+d+"/"+N),V>I&&(!N||a&&!this.bitrateTestDelay||N<d))return v}return-1},b(L,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),L}();Q.default=M},"./src/controller/audio-stream-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),_=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/controller/fragment-tracker.ts"),P=R("./src/types/level.ts"),A=R("./src/types/loader.ts"),p=R("./src/loader/fragment.ts"),b=R("./src/demux/chunk-cache.ts"),M=R("./src/demux/transmuxer-interface.ts"),L=R("./src/types/transmuxer.ts"),C=R("./src/controller/fragment-finders.ts"),E=R("./src/utils/discontinuities.ts"),h=R("./src/errors.ts"),o=R("./src/utils/logger.ts");function l(){return l=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},l.apply(this,arguments)}function d(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,w(D,T)}function w(D,T){return w=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},w(D,T)}var f=100,y=function(D){d(T,D);function T(c,u){var a;return a=D.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var g=T.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var u=this.hls;u.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(_.Events.ERROR,this.onError,this),u.on(_.Events.BUFFER_RESET,this.onBufferReset,this),u.on(_.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var u=this.hls;u.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(_.Events.ERROR,this.onError,this),u.off(_.Events.BUFFER_RESET,this.onBufferReset,this),u.off(_.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(u,a){var S=a.frag,x=a.id,v=a.initPTS;if(x==="main"){var O=S.cc;this.initPTS[S.cc]=v,this.log("InitPTS for cc: "+O+" found from main: "+v),this.videoTrackCC=O,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&u===-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=u,this.tick()},g.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var u,a=this.levels,S=this.trackId,x=a==null||((u=a[S])===null||u===void 0)?void 0:u.details;if(x){if(this.waitForCdnTuneIn(x))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var v,O=performance.now(),F=this.retryDate;(!F||O>=F||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var V=W.frag,I=W.part,N=W.cache,X=W.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var q=N.flush(),ae={frag:V,part:I,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ae),X&&D.prototype._handleFragmentLoadComplete.call(this,ae)}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 de=this.getLoadPosition(),Ae=j.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),be=Object(C.fragmentWithinToleranceTest)(Ae.end,this.config.maxFragLookUpTolerance,V);be<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},g.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,S=a.buffered;!this.loadedmetadata&&S.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},g.doTickIdle=function(){var u,a,S=this.hls,x=this.levels,v=this.media,O=this.trackId,F=S.config;if(!x||!x[O])return;if(!v&&(this.startFragRequested||!F.startFragPrefetch))return;var W=x[O],V=W.details;if(!V||V.live&&this.levelLastLoaded!==O||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,p.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=X&&!q)return;if(!q&&this._streamEnded(I,V)){S.trigger(_.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ae=V.fragments,de=ae[0].start,Ae=I.end;if(q){var be=this.getLoadPosition();Ae=be,V.PTSKnown&&be<de&&((I.end>de||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=de+.05))}var Ce=this.getNextFragment(Ae,V);if(!Ce){this.bufferFlushed=!0;return}((u=Ce.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Ce.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ce,V):this.loadFragment(Ce,V,Ae)},g.getMaxBufferLength=function(){var u=D.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},g.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(u,a){var S=a.audioTracks;this.resetTransmuxer(),this.levels=S.map(function(x){return new P.Level(x)})},g.onAudioTrackSwitching=function(u,a){var S=!!a.url;this.trackId=a.id;var x=this.fragCurrent;x!=null&&x.loader&&x.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),S?this.setInterval(f):this.resetTransmuxer(),S?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(u,a){this.mainDetails=a.details},g.onAudioTrackLoaded=function(u,a){var S,x=this.levels,v=a.details,O=a.id;if(!x){this.warn("Audio tracks were reset while loading level "+O);return}this.log("Track "+O+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var F=x[O],W=0;if(v.live||(S=F.details)!==null&&S!==void 0&&S.live){var V=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!V)return;!F.details&&v.hasProgramDateTime&&V.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(v,V),W=v.fragments[0].start):W=this.alignPlaylists(v,F.details)}F.details=v,this.levelLastLoaded=O,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(F.details,W),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=U.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(u){var a,S=u.frag,x=u.part,v=u.payload,O=this.config,F=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+S.sn+" of level "+S.level+" will not be buffered");return}var V=W[F];console.assert(V,"Audio track is defined on fragment load progress");var I=V.details;console.assert(I,"Audio track details are defined on fragment load progress");var N=O.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new M.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[S.cc],ae=(a=S.initSegment)===null||a===void 0?void 0:a.data;if(q!==void 0){var de=!1,Ae=x?x.index:-1,be=Ae!==-1,Ce=new L.ChunkMetadata(S.level,S.sn,S.stats.chunkCount,v.byteLength,Ae,be);X.push(v,ae,N,"",S,x,I.totalduration,de,Ce,q)}else{o.logger.log("Unknown video PTS for cc "+S.cc+", waiting for video PTS before demuxing audio frag "+S.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+F);var Te=this.waitingData=this.waitingData||{frag:S,part:x,cache:new b.default,complete:!1},Se=Te.cache;Se.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,u)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(u,a){var S=a.tracks.audio;S&&(this.mediaBuffer=S.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},g.onFragBuffered=function(u,a){var S=a.frag,x=a.part;if(S.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(S)){this.warn("Fragment "+S.sn+(x?" p: "+x.index:"")+" of level "+S.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}S.sn!=="initSegment"&&(this.fragPrevious=S,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(S,x)},g.onError=function(u,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var S=!0,x=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);x&&x.len>.5&&(S=!this.reduceMaxBufferLength(x.len)),S&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(u,a){var S=a.type;S===p.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(u){var a,S="audio",x=this.hls,v=u.remuxResult,O=u.chunkMeta,F=this.getCurrentContext(O);if(!F){this.warn("The loading context changed while buffering fragment "+O.sn+" of level "+O.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(O.level);return}var W=F.frag,V=F.part,I=v.audio,N=v.text,X=v.id3,q=v.initSegment;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,W,O),x.trigger(_.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:S,tracks:q.tracks})),I){var ae=I.startPTS,de=I.endPTS,Ae=I.startDTS,be=I.endDTS;V&&(V.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:de,startDTS:Ae,endDTS:be}),W.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ae,de,Ae,be),this.bufferFragmentData(I,W,V,O)}if(X!=null&&(a=X.samples)!==null&&a!==void 0&&a.length){var Ce=l({frag:W,id:S},X);x.trigger(_.Events.FRAG_PARSING_METADATA,Ce)}if(N){var Te=l({frag:W,id:S},N);x.trigger(_.Events.FRAG_PARSING_USERDATA,Te)}},g._bufferInitSegment=function(u,a,S){if(this.state!==U.State.PARSING)return;u.video&&delete u.video;var x=u.audio;if(!x)return;x.levelCodec=x.codec,x.id="audio",this.log("Init audio buffer, container:"+x.container+", codecs[parsed]=["+x.codec+"]"),this.hls.trigger(_.Events.BUFFER_CODECS,u);var v=x.initSegment;if(v!=null&&v.byteLength){var O={type:"audio",frag:a,part:null,chunkMeta:S,parent:a.type,data:v};this.hls.trigger(_.Events.BUFFER_APPENDING,O)}this.tick()},g.loadFragment=function(u,a,S){var x=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||x===B.FragmentState.NOT_LOADED||x===B.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(Y.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,u,a,S)))},g.completeAudioSwitch=function(){var u=this.hls,a=this.media,S=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:S})},T}(U.default);Q.default=y},"./src/controller/audio-track-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts"),U=R("./src/errors.ts"),_=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function B(M,L){for(var C=0;C<L.length;C++){var E=L[C];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(M,E.key,E)}}function P(M,L,C){return L&&B(M.prototype,L),C&&B(M,C),M}function A(M,L){M.prototype=Object.create(L.prototype),M.prototype.constructor=M,p(M,L)}function p(M,L){return p=Object.setPrototypeOf||function(E,h){return E.__proto__=h,E},p(M,L)}var b=function(M){A(L,M);function L(E){var h;return h=M.call(this,E,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var C=L.prototype;return C.registerListeners=function(){var h=this.hls;h.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Y.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var h=this.hls;h.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Y.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},C.onAudioTrackLoaded=function(h,o){var l=o.id,d=o.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var f=w.details;w.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,f))},C.onLevelLoading=function(h,o){this.switchLevel(o.level)},C.onLevelSwitching=function(h,o){this.switchLevel(o.level)},C.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(f){return!l||f.groupId===l});this.selectDefaultTrack&&!d.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},C.onError=function(h,o){if(M.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===j.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},C.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var d=o[h],w=d.id,f=d.groupId,y=f===void 0?"":f,D=d.name,T=d.type,g=d.url;if(this.trackId=h,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:y,name:D,type:T,url:g}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(c)},C.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},C.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,w=o.url;if(h)try{w=h.addDirectives(w)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:w,id:l,groupId:d,deliveryDirectives:h||null})}},P(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),L}(_.default);Q.default=b},"./src/controller/base-playlist-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return P});var Y=R("./src/polyfills/number.ts"),U=R("./src/types/level.ts"),_=R("./src/controller/level-helper.ts"),j=R("./src/utils/logger.ts"),B=R("./src/errors.ts"),P=function(){function A(b,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,M+":"),this.warn=j.logger.warn.bind(j.logger,M+":"),this.hls=b}var p=A.prototype;return p.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},p.onError=function(M,L){L.fatal&&L.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},p.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},p.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},p.stopLoad=function(){this.canLoad=!1,this.clearTimer()},p.switchParams=function(M,L){var C=L==null?void 0:L.renditionReports;if(C)for(var E=0;E<C.length;E++){var h=C[E],o=""+h.URI;if(o===M.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var w=Math.min(L.age-L.partTarget,L.targetduration);d!==void 0&&w>L.partTarget&&(d+=1)}if(Object(Y.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(Y.isFiniteNumber)(d)?d:void 0,U.HlsSkip.No)}}},p.loadPlaylist=function(M){},p.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},p.playlistLoaded=function(M,L,C){var E=this,h=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||C!=null&&C.live){if(h.reloaded(C),C&&this.log("live playlist "+M+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),C&&h.fragments.length>0&&Object(_.mergeDetails)(C,h),!this.canLoad||!h.live)return;var d,w=void 0,f=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var y=this.hls.config.lowLatencyMode,D=h.lastPartSn,T=h.endSN,g=h.lastPartIndex,c=g!==-1,u=D===T,a=y?0:g;c?(w=u?T+1:D,f=u?a:g+1):w=T+1;var S=h.age,x=S+h.ageHeader,v=Math.min(x-h.partTarget,h.targetduration*1.5);if(v>0){if(C&&v>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+v+" with playlist age: "+h.age),v=0;else{var O=Math.floor(v/h.targetduration);if(w+=O,f!==void 0){var F=Math.round(v%h.targetduration/h.partTarget);f+=F}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+S.toFixed(2)+"s goal: "+v+" skip sn "+O+" to part "+f)}h.tuneInGoal=v}if(d=this.getDeliveryDirectives(h,L.deliveryDirectives,w,f),y||!u){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,L.deliveryDirectives,w,f);var W=Object(_.computeReloadInterval)(h,o);w!==void 0&&h.canBlockReload&&(W-=h.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},W)}else this.clearTimer()},p.getDeliveryDirectives=function(M,L,C,E){var h=Object(U.getSkipValue)(M,C);return L!=null&&L.skip&&M.deltaUpdateFailed&&(C=L.msn,E=L.part,h=U.HlsSkip.No),new U.HlsUrlParameters(C,E,h)},p.retryLoadingOrFail=function(M){var L=this,C=this.hls.config,E=this.retryCount<C.levelLoadingMaxRetry;if(E){var h;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(h=M.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.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 E},A}()},"./src/controller/base-stream-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"State",function(){return T}),R.d(Q,"default",function(){return g});var Y=R("./src/polyfills/number.ts"),U=R("./src/task-loop.ts"),_=R("./src/controller/fragment-tracker.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/utils/logger.ts"),P=R("./src/events.ts"),A=R("./src/errors.ts"),p=R("./src/types/transmuxer.ts"),b=R("./src/utils/mp4-tools.ts"),M=R("./src/utils/discontinuities.ts"),L=R("./src/controller/fragment-finders.ts"),C=R("./src/controller/level-helper.ts"),E=R("./src/loader/fragment-loader.ts"),h=R("./src/crypt/decrypter.ts"),o=R("./src/utils/time-ranges.ts"),l=R("./src/types/loader.ts");function d(c,u){for(var a=0;a<u.length;a++){var S=u[a];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(c,S.key,S)}}function w(c,u,a){return u&&d(c.prototype,u),a&&d(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function y(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,D(c,u)}function D(c,u){return D=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},D(c,u)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},g=function(c){y(u,c);function u(S,x,v){var O;return O=c.call(this)||this,O.hls=void 0,O.fragPrevious=null,O.fragCurrent=null,O.fragmentTracker=void 0,O.transmuxer=null,O._state=T.STOPPED,O.media=void 0,O.mediaBuffer=void 0,O.config=void 0,O.bitrateTest=!1,O.lastCurrentTime=0,O.nextLoadPosition=0,O.startPosition=0,O.loadedmetadata=!1,O.fragLoadError=0,O.retryDate=0,O.levels=null,O.fragmentLoader=void 0,O.levelLastLoaded=null,O.startFragRequested=!1,O.decrypter=void 0,O.initPTS=[],O.onvseeking=null,O.onvended=null,O.logPrefix="",O.log=void 0,O.warn=void 0,O.logPrefix=v,O.log=B.logger.log.bind(B.logger,v+":"),O.warn=B.logger.warn.bind(B.logger,v+":"),O.hls=S,O.fragmentLoader=new E.default(S.config),O.fragmentTracker=x,O.config=S.config,O.decrypter=new h.default(S,S.config),S.on(P.Events.KEY_LOADED,O.onKeyLoaded,f(O)),O}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(x){},a.stopLoad=function(){this.fragmentLoader.abort();var x=this.fragCurrent;x&&this.fragmentTracker.removeFragment(x),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},a._streamEnded=function(x,v){var O=this.fragCurrent,F=this.fragmentTracker;if(!v.live&&O&&O.sn===v.endSN&&!x.nextStart){var W=F.getState(O);return W===_.FragmentState.PARTIAL||W===_.FragmentState.OK}return!1},a.onMediaAttached=function(x,v){var O=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),O.addEventListener("seeking",this.onvseeking),O.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var x=this.media;x!=null&&x.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),x&&(x.removeEventListener("seeking",this.onvseeking),x.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var x=this.config,v=this.fragCurrent,O=this.media,F=this.mediaBuffer,W=this.state,V=O?O.currentTime:0,I=j.BufferHelper.bufferInfo(F||O,V,x.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+W),W===T.ENDED)this.resetLoadingState();else if(v&&!I.len){var N=x.maxFragLookUpTolerance,X=v.start-N,q=v.start+v.duration+N,ae=V>q;(V<X||ae)&&(ae&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}O&&(this.lastCurrentTime=V),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(x,v){if(this.state!==T.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var O=this.levels[v.frag.level].details;O&&this.loadFragment(v.frag,O,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(P.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(x,v){this.log("Loading key for "+x.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level),this.state=T.KEY_LOADING,this.fragCurrent=x,this.hls.trigger(P.Events.KEY_LOADING,{frag:x})},a.loadFragment=function(x,v,O){this._loadFragForPlayback(x,v,O)},a._loadFragForPlayback=function(x,v,O){var F=this,W=function(I){if(F.fragContextChanged(x)){F.warn("Fragment "+x.sn+(I.part?" p: "+I.part.index:"")+" of level "+x.level+" was dropped during download."),F.fragmentTracker.removeFragment(x);return}x.stats.chunkCount++,F._handleFragmentLoadProgress(I)};this._doFragLoad(x,v,O,W).then(function(V){if(!V)return;F.fragLoadError=0;var I=F.state;if(F.fragContextChanged(x)){(I===T.FRAG_LOADING||I===T.BACKTRACKING||!F.fragCurrent&&I===T.PARSING)&&(F.fragmentTracker.removeFragment(x),F.state=T.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+x.sn+" of level "+x.level),F.hls.trigger(P.Events.FRAG_LOADED,V),F.state===T.BACKTRACKING)){F.fragmentTracker.backtrack(x,V),F.resetFragmentLoading(x);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(x)})},a.flushMainBuffer=function(x,v,O){if(O===void 0&&(O=null),!(x-v))return;var F={startOffset:x,endOffset:v,type:O};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(x){var v=this;this._doFragLoad(x).then(function(O){if(!O||v.fragContextChanged(x)||!v.levels)throw new Error("init load aborted");return O}).then(function(O){var F=v.hls,W=O.payload,V=x.decryptdata;if(W&&W.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var I=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(W),V.key.buffer,V.iv.buffer).then(function(N){var X=self.performance.now();return F.trigger(P.Events.FRAG_DECRYPTED,{frag:x,payload:N,stats:{tstart:I,tdecrypt:X}}),O.payload=N,O})}return O}).then(function(O){var F=v.fragCurrent,W=v.hls,V=v.levels;if(!V)throw new Error("init load aborted, missing levels");var I=V[x.level].details;console.assert(I,"Level details are defined when init segment is loaded");var N=x.stats;v.state=T.IDLE,v.fragLoadError=0,x.data=new Uint8Array(O.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),O.frag===F&&W.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:F,part:null,id:x.type}),v.tick()}).catch(function(O){v.warn(O),v.resetFragmentLoading(x)})},a.fragContextChanged=function(x){var v=this.fragCurrent;return!x||!v||x.level!==v.level||x.sn!==v.sn||x.urlId!==v.urlId},a.fragBufferedComplete=function(x,v){var O=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+x.type+" sn: "+x.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level+" "+o.default.toString(j.BufferHelper.getBuffered(O))),this.state=T.IDLE,this.tick()},a._handleFragmentLoadComplete=function(x){var v=this.transmuxer;if(!v)return;var O=x.frag,F=x.part,W=x.partsLoaded,V=!W||W.length===0||W.some(function(N){return!N}),I=new p.ChunkMetadata(O.level,O.sn,O.stats.chunkCount+1,0,F?F.index:-1,!V);v.flush(I)},a._handleFragmentLoadProgress=function(x){},a._doFragLoad=function(x,v,O,F){var W=this;if(O===void 0&&(O=null),!this.levels)throw new Error("frag load aborted, missing levels");if(O=Math.max(x.start,O||0),this.config.lowLatencyMode&&v){var V=v.partList;if(V&&F){O>x.end&&v.fragmentHint&&(x=v.fragmentHint);var I=this.getNextPart(V,x,O);if(I>-1){var N=V[I];return this.log("Loading part sn: "+x.sn+" p: "+N.index+" cc: "+x.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+I+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(O.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:x,part:V[I],targetBufferTime:O}),this.doFragPartsLoad(x,V,I,F).catch(function(X){return W.handleFragLoadError(X)})}else if(!x.url||this.loadedEndOfParts(V,O))return Promise.resolve(null)}}return this.log("Loading fragment "+x.sn+" cc: "+x.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(O.toFixed(3))),Object(Y.isFiniteNumber)(x.sn)&&!this.bitrateTest&&(this.nextLoadPosition=x.start+x.duration),this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:x,targetBufferTime:O}),this.fragmentLoader.load(x,F).catch(function(X){return W.handleFragLoadError(X)})},a.doFragPartsLoad=function(x,v,O,F){var W=this;return new Promise(function(V,I){var N=[],X=function q(ae){var de=v[ae];W.fragmentLoader.loadPart(x,de,F).then(function(Ae){N[de.index]=Ae;var be=Ae.part;W.hls.trigger(P.Events.FRAG_LOADED,Ae);var Ce=v[ae+1];if(Ce&&Ce.fragment===x)q(ae+1);else return V({frag:x,part:be,partsLoaded:N})}).catch(I)};X(O)})},a.handleFragLoadError=function(x){var v=x.data;return v&&v.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(P.Events.ERROR,v),null},a._handleTransmuxerFlush=function(x){var v=this.getCurrentContext(x);if(!v||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var O=v.frag,F=v.part,W=v.level,V=self.performance.now();O.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(O,F,W,x.partial)},a.getCurrentContext=function(x){var v=this.levels,O=x.level,F=x.sn,W=x.part;if(!v||!v[O])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+O+". The current chunk will not be buffered."),null;var V=v[O],I=W>-1?Object(C.getPartWith)(V,F,W):null,N=I?I.fragment:Object(C.getFragmentWithSN)(V,F,this.fragCurrent);return N?{frag:N,part:I,level:V}:null},a.bufferFragmentData=function(x,v,O,F){if(!x||this.state!==T.PARSING)return;var W=x.data1,V=x.data2,I=W;if(W&&V&&(I=Object(b.appendUint8Array)(W,V)),!I||!I.length)return;var N={type:x.type,frag:v,part:O,chunkMeta:F,parent:v.type,data:I};this.hls.trigger(P.Events.BUFFER_APPENDING,N),x.dropped&&x.independent&&!O&&this.flushBufferGap(v)},a.flushBufferGap=function(x){var v=this.media;if(!v)return;if(!j.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,x.start);return}var O=v.currentTime,F=j.BufferHelper.bufferInfo(v,O,0),W=x.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),I=Math.max(Math.min(x.start-V,F.end-V),O+V);x.start-I>V&&this.flushMainBuffer(I,x.start)},a.getFwdBufferInfo=function(x,v){var O=this.config,F=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(F))return null;var W=j.BufferHelper.bufferInfo(x,F,O.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,v);if(V&&W.nextStart<V.end)return j.BufferHelper.bufferInfo(x,F,Math.max(W.nextStart,O.maxBufferHole))}return W},a.getMaxBufferLength=function(x){var v=this.config,O;return x?O=Math.max(8*v.maxBufferSize/x,v.maxBufferLength):O=v.maxBufferLength,Math.min(O,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(x){var v=this.config,O=x||v.maxBufferLength;return v.maxMaxBufferLength>=O?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(x,v){var O,F,W=v.fragments,V=W.length;if(!V)return null;var I=this.config,N=W[0].start,X;if(v.live){var q=I.initialLiveManifestSize;if(V<q)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+q+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(v,W),this.startPosition=X?this.hls.liveSyncPosition||X.start:x)}else x<=N&&(X=W[0]);if(!X){var ae=I.lowLatencyMode?v.partEnd:v.fragmentEnd;X=this.getFragmentAtPosition(x,ae,v)}return(O=X)!==null&&O!==void 0&&O.initSegment&&!((F=X)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},a.getNextPart=function(x,v,O){for(var F=-1,W=!1,V=!0,I=0,N=x.length;I<N;I++){var X=x[I];if(V=V&&!X.independent,F>-1&&O<X.start)break;var q=X.loaded;!q&&(W||X.independent||V)&&X.fragment===v&&(F=I),W=q}return F},a.loadedEndOfParts=function(x,v){var O=x[x.length-1];return O&&v>O.start&&O.loaded},a.getInitialLiveFragment=function(x,v){var O=this.fragPrevious,F=null;if(O){if(x.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+O.programDateTime),F=Object(L.findFragmentByPDT)(v,O.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var W=O.sn+1;if(W>=x.startSN&&W<=x.endSN){var V=v[W-x.startSN];O.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(L.findFragWithCC)(v,O.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(F=this.getFragmentAtPosition(I,this.bitrateTest?x.fragmentEnd:x.edge,x))}return F},a.getFragmentAtPosition=function(x,v,O){var F=this.config,W=this.fragPrevious,V=O.fragments,I=O.endSN,N=O.fragmentHint,X=F.maxFragLookUpTolerance,q=!!(F.lowLatencyMode&&O.partList&&N);q&&N&&!this.bitrateTest&&(V=V.concat(N),I=N.sn);var ae;if(x<v){var de=x>v-X?0:X;ae=Object(L.findFragmentByPTS)(W,V,x,de)}else ae=V[V.length-1];if(ae){var Ae=ae.sn-O.startSN,be=W&&ae.level===W.level,Ce=V[Ae+1],Te=this.fragmentTracker.getState(ae);if(Te===_.FragmentState.BACKTRACKED){ae=null;for(var Se=Ae;V[Se]&&this.fragmentTracker.getState(V[Se])===_.FragmentState.BACKTRACKED;)W?ae=V[Se--]:ae=V[--Se];ae||(ae=Ce)}else W&&ae.sn===W.sn&&!q&&(be&&(ae.sn<I&&this.fragmentTracker.getState(Ce)!==_.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+Ce.sn),ae=Ce):ae=null))}return ae},a.synchronizeToLiveEdge=function(x){var v=this.config,O=this.media;if(!O)return;var F=this.hls.liveSyncPosition,W=O.currentTime,V=x.fragments[0].start,I=x.edge,N=W>=V-v.maxFragLookUpTolerance&&W<=I;if(F!==null&&O.duration>F&&(W<F||!N)){var X=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*x.targetduration;(!N&&O.readyState<4||W<I-X)&&(this.loadedmetadata||(this.nextLoadPosition=F),O.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+F.toFixed(3)),O.currentTime=F))}},a.alignPlaylists=function(x,v){var O=this.levels,F=this.levelLastLoaded,W=this.fragPrevious,V=F!==null?O[F]:null,I=x.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=x.fragments[0].start,X=!v,q=x.alignedSliding&&Object(Y.isFiniteNumber)(N);if(X||!q&&!N){Object(M.alignStream)(W,V,x);var ae=x.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+x.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+I),ae}return N},a.waitForCdnTuneIn=function(x){var v=3;return x.live&&x.canBlockReload&&x.tuneInGoal>Math.max(x.partHoldBack,x.partTarget*v)},a.setStartPosition=function(x,v){var O=this.startPosition;if(O<v&&(O=-1),O===-1||this.lastCurrentTime===-1){var F=x.startTimeOffset;Object(Y.isFiniteNumber)(F)?(O=v+F,F<0&&(O+=x.totalduration),O=Math.min(Math.max(v,O),v+x.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+O),this.startPosition=O):x.live?O=this.hls.liveSyncPosition||v:this.startPosition=O=0,this.lastCurrentTime=O}this.nextLoadPosition=O},a.getLoadPosition=function(){var x=this.media,v=0;return this.loadedmetadata&&x?v=x.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(x,v){this.transmuxer&&x.sn!=="initSegment"&&x.stats.aborted&&(this.warn("Fragment "+x.sn+(v?" part"+v.index:"")+" of level "+x.level+" was aborted"),this.resetFragmentLoading(x))},a.resetFragmentLoading=function(x){(!this.fragCurrent||!this.fragContextChanged(x))&&(this.state=T.IDLE)},a.onFragmentOrKeyLoadError=function(x,v){if(v.fatal)return;var O=v.frag;if(!O||O.type!==x)return;var F=this.fragCurrent;console.assert(F&&O.sn===F.sn&&O.level===F.level&&O.urlId===F.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(O.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+O.sn+" of "+x+" "+O.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(x===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(B.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},a.afterBufferFlushed=function(x,v,O){if(!x)return;var F=j.BufferHelper.getBuffered(x);this.fragmentTracker.detectEvictedFragments(v,F,O),this.state===T.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},a.resetLiveStartWhenNotLoaded=function(x){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[x].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(x,v,O,F){var W=this,V=O.details;console.assert(!!V,"level.details must be defined");var I=Object.keys(x.elementaryStreams).reduce(function(N,X){var q=x.elementaryStreams[X];if(q){var ae=q.endPTS-q.startPTS;if(ae<=0)return W.warn("Could not parse fragment "+x.sn+" "+X+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),N||!1;var de=F?0:Object(C.updateFragPTSDTS)(V,x,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return W.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:V,level:O,drift:de,type:X,frag:x,start:q.startPTS,end:q.endPTS}),!0}return N},!1);I?(this.state=T.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:x,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(u,[{key:"state",get:function(){return this._state},set:function(x){var v=this._state;v!==x&&(this._state=x,this.log(v+"->"+x))}}]),u}(U.default)},"./src/controller/buffer-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return L});var Y=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),_=R("./src/utils/logger.ts"),j=R("./src/errors.ts"),B=R("./src/utils/buffer-helper.ts"),P=R("./src/utils/mediasource-helper.ts"),A=R("./src/loader/fragment.ts"),p=R("./src/controller/buffer-operation-queue.ts"),b=Object(P.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function C(h){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,d=o.media,w=o.mediaSource;_.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){_.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){_.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var E=C.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var 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)},E.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)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new p.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,_.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&b){var w=this.mediaSource=new b;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(_.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(w){_.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):_.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)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(w){_.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,l){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(f){if(w){var y=d.tracks[f];if(y&&typeof y.buffer.changeType=="function"){var D=l[f],T=D.codec,g=D.levelCodec,c=D.container,u=(y.levelCodec||y.codec).replace(M,"$1"),a=(g||T).replace(M,"$1");if(u!==a){var S=c+";codecs="+(g||T);d.appendChangeType(f,S)}}}else d.pendingTracks[f]=l[f]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,l){var d=this,w=this.operationQueue,f={execute:function(){var D=d.sourceBuffer[o];D&&(_.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),D.changeType(l)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(D){_.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",D)}};w.append(f,o)},E.onBufferAppending=function(o,l){var d=this,w=this.hls,f=this.operationQueue,y=this.tracks,D=l.data,T=l.type,g=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[T],S=self.performance.now();a.start=S;var x=g.stats.buffering,v=c?c.stats.buffering:null;x.start===0&&(x.start=S),v&&v.start===0&&(v.start=S);var O=y.audio,F=T==="audio"&&u.id===1&&(O==null?void 0:O.container)==="audio/mpeg",W={execute:function(){if(a.executeStart=self.performance.now(),F){var I=d.sourceBuffer[T];if(I){var N=g.start-I.timestampOffset;Math.abs(N)>=.1&&(_.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+N+") sn: "+g.sn+")"),I.timestampOffset=g.start)}}d.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var I=self.performance.now();a.executeEnd=a.end=I,x.first===0&&(x.first=I),v&&v.first===0&&(v.first=I);var N=d.sourceBuffer,X={};for(var q in N)X[q]=B.BufferHelper.getBuffered(N[q]);d.appendError=0,d.hls.trigger(U.Events.BUFFER_APPENDED,{type:T,frag:g,part:c,chunkMeta:u,parent:g.type,timeRanges:X})},onError:function(I){_.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",I);var N={type:j.ErrorTypes.MEDIA_ERROR,parent:g.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=j.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,N.details=j.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(_.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),w.trigger(U.Events.ERROR,N)}};f.append(W,T)},E.onBufferFlushing=function(o,l){var d=this,w=this.operationQueue,f=function(D){return{execute:d.removeExecutor.bind(d,D,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(U.Events.BUFFER_FLUSHED,{type:D})},onError:function(g){_.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",g)}}};l.type?w.append(f(l.type),l.type):this.getSourceBufferTypes().forEach(function(y){w.append(f(y),y)})},E.onFragParsed=function(o,l){var d=this,w=l.frag,f=l.part,y=[],D=f?f.elementaryStreams:w.elementaryStreams;D[A.ElementaryStreamTypes.AUDIOVIDEO]?y.push("audiovideo"):(D[A.ElementaryStreamTypes.AUDIO]&&y.push("audio"),D[A.ElementaryStreamTypes.VIDEO]&&y.push("video"));var T=function(){var c=self.performance.now();w.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var u=f?f.stats:w.stats;d.hls.trigger(U.Events.FRAG_BUFFERED,{frag:w,part:f,stats:u,id:w.type})};y.length===0&&_.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(T,y)},E.onFragChanged=function(o,l){this.flushBackBuffer()},E.onBufferEos=function(o,l){var d=this,w=this.getSourceBufferTypes().reduce(function(f,y){var D=d.sourceBuffer[y];return(!l.type||l.type===y)&&(D&&!D.ended&&(D.ended=!0,_.logger.log("[buffer-controller]: "+y+" sourceBuffer now EOS"))),f&&!!(!D||D.ended)},!0);w&&this.blockBuffers(function(){var f=d.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},E.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,w=this.sourceBuffer;if(!d||l===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var y=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Y.isFiniteNumber)(y)||y<0)return;var D=d.currentTime,T=l.levelTargetDuration,g=Math.max(y,T),c=Math.floor(D/T)*T-g;f.forEach(function(u){var a=w[u];if(a){var S=B.BufferHelper.getBuffered(a);S.length>0&&c>S.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:u}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,w=this.mediaSource,f=o.fragments[0].start+o.totalduration,y=d.duration,D=Object(Y.isFiniteNumber)(w.duration)?w.duration:0;o.live&&l.config.liveDurationInfinity?(_.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(f>D&&f>y||!Object(Y.isFiniteNumber)(y))&&(_.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),w.duration=f)},E.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,w=d.length;if(w&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var f=Math.max(0,d[0].start),y=Math.max(f,f+o.totalduration);l.setLiveSeekableRange(f,y)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!o||w===2){this.createSourceBuffers(d),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(y){l.executeNext(y)})}},E.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var f in o)if(!l[f]){var y=o[f];if(!y)throw Error("source buffer exists for track "+f+", however track does not");var D=y.levelCodec||y.codec,T=y.container+";codecs="+D;_.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var g=l[f]=d.addSourceBuffer(T),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:g,codec:D,container:y.container,levelCodec:y.levelCodec,id:y.id},w++}catch(u){_.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}w&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,l){_.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},E.removeExecutor=function(o,l,d){var w=this.media,f=this.mediaSource,y=this.operationQueue,D=this.sourceBuffer,T=D[o];if(!w||!f||!T){_.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),y.shiftAndExecuteNext(o);return}var g=Object(Y.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(Y.isFiniteNumber)(f.duration)?f.duration:Infinity,u=Math.max(0,l),a=Math.min(d,g,c);a>u?(_.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!T.updating,o+" sourceBuffer must not be updating"),T.remove(u,a)):y.shiftAndExecuteNext(o)},E.appendExecutor=function(o,l){var d=this.operationQueue,w=this.sourceBuffer,f=w[l];if(!f){_.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}f.ended=!1,console.assert(!f.updating,l+" sourceBuffer must not be updating"),f.appendBuffer(o)},E.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){_.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,f=l.map(function(y){return w.appendBlocker(y)});Promise.all(f).then(function(){o(),l.forEach(function(y){var D=d.sourceBuffer[y];(!D||!D.updating)&&w.shiftAndExecuteNext(y)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,l,d){var w=this.sourceBuffer[o];if(!w)return;var f=d.bind(this,o);this.listeners[o].push({event:l,listener:f}),w.addEventListener(l,f)},E.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return U});var Y=R("./src/utils/logger.ts"),U=function(){function _(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var j=_.prototype;return j.append=function(P,A){var p=this.queues[A];p.push(P),p.length===1&&this.buffers[A]&&this.executeNext(A)},j.insertAbort=function(P,A){var p=this.queues[A];p.unshift(P),this.executeNext(A)},j.appendBlocker=function(P){var A,p=new Promise(function(M){A=M}),b={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,P),p},j.executeNext=function(P){var A=this.buffers,p=this.queues,b=A[P],M=p[P];if(M.length){var L=M[0];try{L.execute()}catch(C){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(C),(!b||!b.updating)&&(M.shift(),this.executeNext(P))}}},j.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},j.current=function(P){return this.queues[P][0]},_}()},"./src/controller/cap-level-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts");function U(B,P){for(var A=0;A<P.length;A++){var p=P[A];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(B,p.key,p)}}function _(B,P,A){return P&&U(B.prototype,P),A&&U(B,A),B}var j=function(){function B(A){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=B.prototype;return P.setStreamController=function(p){this.streamController=p},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var p=this.hls;p.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var p=this.hls;p.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(p,b){B.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},P.onMediaAttaching=function(p,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},P.onManifestParsed=function(p,b){var M=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onBufferCodecs=function(p,b){var M=this.hls;M.config.capLevelToPlayerSize&&b.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var p=this.hls.levels;if(p.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(p.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},P.getMaxLevel=function(p){var b=this,M=this.hls.levels;if(!M.length)return-1;var L=M.filter(function(C,E){return B.isLevelAllowed(E,b.restrictedLevels)&&E<=p});return this.clientRect=null,B.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var p=this.media,b={width:0,height:0};if(p){var M=p.getBoundingClientRect();b.width=M.width,b.height=M.height,!b.width&&!b.height&&(b.width=M.right-M.left||p.width||0,b.height=M.bottom-M.top||p.height||0)}return this.clientRect=b,b},B.isLevelAllowed=function(p,b){return b===void 0&&(b=[]),b.indexOf(p)===-1},B.getMaxLevelByMediaSize=function(p,b,M){if(!p||!p.length)return-1;for(var L=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},C=p.length-1,E=0;E<p.length;E+=1){var h=p[E];if((h.width>=b||h.height>=M)&&L(h,p[E+1])){C=E;break}}return C},_(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var p=1;try{p=self.devicePixelRatio}catch(b){}return p}}]),B}();Q.default=j},"./src/controller/cmcd-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return L});var Y=R("./src/events.ts"),U=R("./src/types/cmcd.ts"),_=R("./src/utils/buffer-helper.ts"),j=R("./src/utils/logger.ts");function B(C,E){for(var h=0;h<E.length;h++){var o=E[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(C,o.key,o)}}function P(C,E,h){return E&&B(C.prototype,E),h&&B(C,h),C}function A(C,E){var h=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(h)return(h=h.call(C)).next.bind(h);if(Array.isArray(C)||(h=p(C))||E&&C&&typeof C.length=="number"){h&&(C=h);var o=0;return function(){return o>=C.length?{done:!0}:{done:!1,value:C[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 p(C,E){if(!C)return;if(typeof C=="string")return b(C,E);var h=Object.prototype.toString.call(C).slice(8,-1);if(h==="Object"&&C.constructor&&(h=C.constructor.name),h==="Map"||h==="Set")return Array.from(C);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return b(C,E)}function b(C,E){(E==null||E>C.length)&&(E=C.length);for(var h=0,o=new Array(E);h<E;h++)o[h]=C[h];return o}function M(){return M=Object.assign||function(C){for(var E=1;E<arguments.length;E++){var h=arguments[E];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(C[o]=h[o])}return C},M.apply(this,arguments)}var L=function(){function C(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){j.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(w){try{var f=w.frag,y=o.hls.levels[f.level],D=o.getObjectType(f),T={d:f.duration*1e3,ot:D};(D===U.CMCDObjectType.VIDEO||D===U.CMCDObjectType.AUDIO||D==U.CMCDObjectType.MUXED)&&(T.br=y.bitrate/1e3,T.tb=o.getTopBandwidth(D),T.bl=o.getBufferLength(D)),o.apply(w,T)}catch(g){j.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=h;var l=this.config=h.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||C.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=C.prototype;return E.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,l){var d,w;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},E.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(o,l){l===void 0&&(l={}),M(l,this.createData());var d=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var w=C.toHeaders(l);if(!Object.keys(w).length)return;o.headers||(o.headers={}),M(o.headers,w)}else{var f=C.toQuery(l);if(!f)return;o.url=C.appendQueryToUri(o.url,f)}},E.getObjectType=function(o){var l=o.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(o){for(var l=0,d=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=A(d),f;!(f=w()).done;){var y=f.value;y.bitrate>l&&(l=y.bitrate)}return l>0?l:NaN},E.getBufferLength=function(o){var l=this.hls.media,d=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var w=_.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return w.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function w(y){this.loader=void 0,this.loader=new d(y)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,T,g){l(D),this.loader.load(D,T,g)},P(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},E.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function w(y){this.loader=void 0,this.loader=new d(y)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,T,g){l(D),this.loader.load(D,T,g)},P(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},C.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},C.serialize=function(o){for(var l=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},f=function(F){return w(F/100)*100},y=function(F){return encodeURIComponent(F)},D={br:w,d:w,bl:f,dl:f,mtp:f,nor:y,rtp:f,tb:w},T=Object.keys(o||{}).sort(),g=A(T),c;!(c=g()).done;){var u=c.value,a=o[u];if(!d(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var S=D[u];S&&(a=S(a));var x=typeof a,v=void 0;u==="ot"||u==="sf"||u==="st"?v=u+"="+a:x==="boolean"?v=u:x==="number"?v=u+"="+a:v=u+"="+JSON.stringify(a),l.push(v)}return l.join(",")},C.toHeaders=function(o){for(var l=Object.keys(o),d={},w=["Object","Request","Session","Status"],f=[{},{},{},{}],y={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},D=0,T=l;D<T.length;D++){var g=T[D],c=y[g]!=null?y[g]:1;f[c][g]=o[g]}for(var u=0;u<f.length;u++){var a=C.serialize(f[u]);a&&(d["CMCD-"+w[u]]=a)}return d},C.toQuery=function(o){return"CMCD="+encodeURIComponent(C.serialize(o))},C.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},C}()},"./src/controller/eme-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts"),U=R("./src/errors.ts"),_=R("./src/utils/logger.ts"),j=R("./src/utils/mediakeys-helper.ts");function B(L,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function P(L,C,E){return C&&B(L.prototype,C),E&&B(L,E),L}var A=3,p=function(C,E,h){var o={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),E.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},b=function(C,E,h,o){switch(C){case j.KeySystems.WIDEVINE:return p(E,h,o);default:throw new Error("Unknown key-system: "+C)}},M=function(){function L(E){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=E,this._config=E.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var C=L.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(h){switch(h){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},C._attemptKeySystemAccess=function(h,o,l){var d=this,w=b(h,o,l,this._drmSystemOptions);_.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(h,w);this.mediaKeysPromise=f.then(function(y){return d._onMediaKeySystemAccessObtained(h,y)}),f.catch(function(y){_.logger.error('Failed to obtain key-system "'+h+'" access:',y)})},C._onMediaKeySystemAccessObtained=function(h,o){var l=this;_.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return d.mediaKeys=f,_.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),f});return w.catch(function(f){_.logger.error("Failed to create media-keys:",f)}),w},C._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},C._onNewMediaKeySession=function(h){var o=this;_.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},C._onKeySessionMessage=function(h,o){_.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){_.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},C.onMediaEncrypted=function(h){var o=this;if(_.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},C._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}_.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(h,o){var l=this,d=this._mediaKeysList[0];if(!d){_.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){_.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){_.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){_.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}_.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(h,o).then(function(){_.logger.debug("Key-session generation succeeded")}).catch(function(f){_.logger.error("Error generating key-session request:",f),l.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(h,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,h),w=void 0}catch(f){_.logger.error(f)}try{d.readyState||d.open("POST",h,!0),w&&w.call(this.hls,d,h)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return d},C._onLicenseRequestReadyStageChange=function(h,o,l,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,_.logger.log("License request succeeded");var w=h.response,f=this._licenseResponseCallback;if(f)try{w=f.call(this.hls,h,o)}catch(D){_.logger.error(D)}d(w)}else{if(_.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var y=A-this._requestLicenseFailureCount+1;_.logger.warn("Retrying license request, "+y+" attempts left"),this._requestLicense(l,d)}break}},C._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},C._requestLicense=function(h,o){_.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){_.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),w=this._createLicenseXhr(d,h,o);_.logger.log("Sending license request to URL: "+d);var f=this._generateLicenseRequestChallenge(l,h);w.send(f)}catch(y){_.logger.error("Failure requesting DRM license: "+y),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,l,d)},P(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Q.default=M},"./src/controller/fps-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts"),U=R("./src/utils/logger.ts"),_=function(){function j(P){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=P,this.registerListeners()}var B=j.prototype;return B.setStreamController=function(A){this.streamController=A},B.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(A,p){var b=this.hls.config;if(b.capLevelOnFPSDrop){var M=p.media instanceof self.HTMLVideoElement?p.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),b.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(A,p,b){var M=performance.now();if(p){if(this.lastTime){var L=M-this.lastTime,C=b-this.lastDroppedFrames,E=p-this.lastDecodedFrames,h=1e3*C/L,o=this.hls;if(o.trigger(Y.Events.FPS_DROP,{currentDropped:C,currentDecoded:E,totalDroppedFrames:b}),h>0&&C>o.config.fpsDroppedMonitoringThreshold*E){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(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=b,this.lastDecodedFrames=p}},B.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var p=A.getVideoPlaybackQuality();this.checkFPS(A,p.totalVideoFrames,p.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},j}();Q.default=_},"./src/controller/fragment-finders.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"findFragmentByPDT",function(){return _}),R.d(Q,"findFragmentByPTS",function(){return j}),R.d(Q,"fragmentWithinToleranceTest",function(){return B}),R.d(Q,"pdtWithinToleranceTest",function(){return P}),R.d(Q,"findFragWithCC",function(){return A});var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/binary-search.ts");function _(p,b,M){if(b===null||!Array.isArray(p)||!p.length||!Object(Y.isFiniteNumber)(b))return null;var L=p[0].programDateTime;if(b<(L||0))return null;var C=p[p.length-1].endProgramDateTime;if(b>=(C||0))return null;M=M||0;for(var E=0;E<p.length;++E){var h=p[E];if(P(b,M,h))return h}return null}function j(p,b,M,L){M===void 0&&(M=0),L===void 0&&(L=0);var C=null;if(p?C=b[p.sn-b[0].sn+1]||null:M===0&&b[0].start===0&&(C=b[0]),C&&B(M,L,C)===0)return C;var E=U.default.search(b,B.bind(null,M,L));return E||C}function B(p,b,M){p===void 0&&(p=0),b===void 0&&(b=0);var L=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-L<=p?1:M.start-L>p&&M.start?-1:0}function P(p,b,M){var L=Math.min(b,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,C=M.endProgramDateTime||0;return C-L>p}function A(p,b){return U.default.search(p,function(M){return M.cc<b?1:M.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"FragmentState",function(){return _}),R.d(Q,"FragmentTracker",function(){return j});var Y=R("./src/events.ts"),U=R("./src/types/loader.ts"),_;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(_||(_={}));var j=function(){function A(b){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=b,this._registerListeners()}var p=A.prototype;return p._registerListeners=function(){var M=this.hls;M.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},p._unregisterListeners=function(){var M=this.hls;M.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},p.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},p.getAppendedFrag=function(M,L){if(L===U.PlaylistLevelType.MAIN){var C=this.activeFragment,E=this.activeParts;if(!C)return null;if(E)for(var h=E.length;h--;){var o=E[h],l=o?o.end:C.appendedPTS;if(o.start<=M&&l!==void 0&&M<=l)return h>9&&(this.activeParts=E.slice(h-9)),o}else if(C.start<=M&&C.appendedPTS!==void 0&&M<=C.appendedPTS)return C}return this.getBufferedFrag(M,L)},p.getBufferedFrag=function(M,L){for(var C=this.fragments,E=Object.keys(C),h=E.length;h--;){var o=C[E[h]];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},p.detectEvictedFragments=function(M,L,C){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(!o.buffered){o.body.type===C&&E.removeFragment(o.body);return}var l=o.range[M];if(!l)return;l.time.some(function(d){var w=!E.isTimeBuffered(d.startPTS,d.endPTS,L);return w&&E.removeFragment(o.body),w})})},p.detectPartialFragments=function(M){var L=this,C=this.timeRanges,E=M.frag,h=M.part;if(!C||E.sn==="initSegment")return;var o=P(E),l=this.fragments[o];if(!l)return;Object.keys(C).forEach(function(d){var w=E.elementaryStreams[d];if(!w)return;var f=C[d],y=h!==null||w.partial===!0;l.range[d]=L.getBufferedTimes(E,h,y,f)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},p.fragBuffered=function(M){var L=P(M),C=this.fragments[L];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},p.getBufferedTimes=function(M,L,C,E){for(var h={time:[],partial:C},o=L?L.start:M.start,l=L?L.end:M.end,d=M.minEndPTS||l,w=M.maxStartPTS||o,f=0;f<E.length;f++){var y=E.start(f)-this.bufferPadding,D=E.end(f)+this.bufferPadding;if(w>=y&&d<=D){h.time.push({startPTS:Math.max(o,E.start(f)),endPTS:Math.min(l,E.end(f))});break}else if(o<D&&l>y)h.partial=!0,h.time.push({startPTS:Math.max(o,E.start(f)),endPTS:Math.min(l,E.end(f))});else if(l<=y)break}return h},p.getPartialFragment=function(M){var L=null,C,E,h,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var f=d[w];if(!f)return;B(f)&&(E=f.body.start-l,h=f.body.end+l,M>=E&&M<=h&&(C=Math.min(M-E,h-M),o<=C&&(L=f.body,o=C)))}),L},p.getState=function(M){var L=P(M),C=this.fragments[L];return C?C.buffered?B(C)?_.PARTIAL:_.OK:C.backtrack?_.BACKTRACKED:_.APPENDING:_.NOT_LOADED},p.backtrack=function(M,L){var C=P(M),E=this.fragments[C];if(!E||E.backtrack)return null;var h=E.backtrack=L||E.loaded;return E.loaded=null,h},p.getBacktrackData=function(M){var L=P(M),C=this.fragments[L];if(C){var E,h=C.backtrack;if(h!=null&&(E=h.payload)!==null&&E!==void 0&&E.byteLength)return h;this.removeFragment(M)}return null},p.isTimeBuffered=function(M,L,C){for(var E,h,o=0;o<C.length;o++){if(E=C.start(o)-this.bufferPadding,h=C.end(o)+this.bufferPadding,M>=E&&L<=h)return!0;if(L<=E)return!1}return!1},p.onFragLoaded=function(M,L){var C=L.frag,E=L.part;if(C.sn==="initSegment"||C.bitrateTest||E)return;var h=P(C);this.fragments[h]={body:C,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},p.onBufferAppended=function(M,L){var C=this,E=L.frag,h=L.part,o=L.timeRanges;if(E.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=E,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var w=o[d];if(C.detectEvictedFragments(d,w),!h)for(var f=0;f<w.length;f++)E.appendedPTS=Math.max(w.end(f),E.appendedPTS||0)})},p.onFragBuffered=function(M,L){this.detectPartialFragments(L)},p.hasFragment=function(M){var L=P(M);return!!this.fragments[L]},p.removeFragmentsInRange=function(M,L,C){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===C&&l.start<L&&l.end>M&&E.removeFragment(l)}})},p.removeFragment=function(M){var L=P(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[L]},p.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function B(A){var p,b;return A.buffered&&(((p=A.range.video)===null||p===void 0?void 0:p.partial)||((b=A.range.audio)===null||b===void 0?void 0:b.partial))}function P(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"STALL_MINIMUM_DURATION_MS",function(){return B}),R.d(Q,"MAX_START_GAP_JUMP",function(){return P}),R.d(Q,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),R.d(Q,"SKIP_BUFFER_RANGE_START",function(){return p}),R.d(Q,"default",function(){return b});var Y=R("./src/utils/buffer-helper.ts"),U=R("./src/errors.ts"),_=R("./src/events.ts"),j=R("./src/utils/logger.ts"),B=250,P=2,A=.1,p=.05,b=function(){function M(C,E,h,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=C,this.media=E,this.fragmentTracker=h,this.hls=o}var L=M.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(E){var h=this.config,o=this.media,l=this.stalled,d=o.currentTime,w=o.seeking,f=this.seeking&&!w,y=!this.seeking&&w;if(this.seeking=w,d!==E){if(this.moved=!0,l!==null){if(this.stallReported){var D=self.performance.now()-l;j.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((y||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Y.BufferHelper.getBuffered(o).length)return;var T=Y.BufferHelper.bufferInfo(o,d,0),g=T.len>0,c=T.nextStart||0;if(!g&&!c)return;if(w){var u=T.len>P,a=!c||c-d>P&&!this.fragmentTracker.getPartialFragment(d);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var S,x=Math.max(c,T.start||0)-d,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,O=v==null||((S=v.details)===null||S===void 0)?void 0:S.live,F=O?v.details.targetduration*2:P;if(x>0&&x<=F){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(l===null){this.stalled=W;return}var V=W-l;!w&&V>=B&&this._reportStall(T.len);var I=Y.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(I,V)},L._tryFixBufferStall=function(E,h){var o=this.config,l=this.fragmentTracker,d=this.media,w=d.currentTime,f=l.getPartialFragment(w);if(f){var y=this._trySkipBufferHole(f);if(y)return}E.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(E){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),h.trigger(_.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},L._trySkipBufferHole=function(E){for(var h=this.config,o=this.hls,l=this.media,d=l.currentTime,w=0,f=Y.BufferHelper.getBuffered(l),y=0;y<f.length;y++){var D=f.start(y);if(d+h.maxBufferHole>=w&&d<D){var T=Math.max(D+p,l.currentTime+A);return j.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,E&&o.trigger(_.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+T,frag:E}),T}w=f.end(y)}return 0},L._tryNudgeBuffer=function(){var E=this.config,h=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var w=l+d*E.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+l+" to "+w),o.currentTime=w,h.trigger(_.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+E.nudgeMaxRetry+" nudges"),h.trigger(_.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),_=R("./src/demux/id3.ts"),j=.25,B=function(){function P(p){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=p,this._registerListeners()}var A=P.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var b=this.hls;b.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var b=this.hls;b.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(b,M){this.media=M.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(b){if(!this.media)return;for(var M=0;M<b.length;M++){var L=b[M];if(L.kind==="metadata"&&L.label==="id3")return Object(U.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(b,M){if(!this.media)return;var L=M.frag,C=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<C.length;h++){var o=_.getID3Frames(C[h].data);if(o){var l=C[h].pts,d=h<C.length-1?C[h+1].pts:L.end,w=d-l;w<=0&&(d=l+j);for(var f=0;f<o.length;f++){var y=o[f];if(!_.isTimeStampFrame(y)){var D=new E(l,d,"");D.value=y,this.id3Track.addCue(D)}}}}},A.onBufferFlushing=function(b,M){var L=M.startOffset,C=M.endOffset,E=M.type;if(!E||E==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,L,C)}},P}();Q.default=B},"./src/controller/latency-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return P});var Y=R("./src/errors.ts"),U=R("./src/events.ts"),_=R("./src/utils/logger.ts");function j(A,p){for(var b=0;b<p.length;b++){var M=p[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function B(A,p,b){return p&&j(A.prototype,p),b&&j(A,b),A}var P=function(){function A(b){var M=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return M.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var p=A.prototype;return p.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},p.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},p.onMediaAttached=function(M,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},p.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},p.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},p.onLevelUpdated=function(M,L){var C=L.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},p.onError=function(M,L){if(L.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,_.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},p.timeupdate=function(){var M=this.media,L=this.levelDetails;if(!M||!L)return;this.currentTime=M.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var E=this.config,h=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var d=C-l,w=Math.min(this.maxLatency,l+L.targetduration),f=d<w;if(L.live&&f&&d>.05&&this.forwardBufferLength>1){var y=Math.min(2,Math.max(1,o)),D=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;M.playbackRate=Math.min(y,Math.max(1,D))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},p.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},p.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},B(A,[{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,C=M.partHoldBack,E=M.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,d=h.lowLatencyMode,w=this.hls.userConfig,f=d&&C||L;(w.liveSyncDuration||w.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:l*E);var y=E,D=1;return f+Math.min(this.stallCount*D,y)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),L=this.targetLatency,C=this.levelDetails;if(M===null||L===null||C===null)return null;var E=C.edge,h=M-L-this.edgeStalled,o=E-C.totalduration,l=E-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(o,h),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 C=M.buffered.length;return C?M.buffered.end(C-1):L.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return h});var Y=R("./src/types/level.ts"),U=R("./src/events.ts"),_=R("./src/errors.ts"),j=R("./src/utils/codecs.ts"),B=R("./src/controller/level-helper.ts"),P=R("./src/controller/base-playlist-controller.ts"),A=R("./src/types/loader.ts");function p(){return p=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(o[w]=d[w])}return o},p.apply(this,arguments)}function b(o,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function M(o,l,d){return l&&b(o.prototype,l),d&&b(o,d),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,C(o,l)}function C(o,l){return C=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},C(o,l)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){L(l,o);function l(w){var f;return f=o.call(this,w,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var d=l.prototype;return d._registerListeners=function(){var f=this.hls;f.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(U.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var f=this.hls;f.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(U.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var f=this._levels;f.forEach(function(y){y.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(f,y){var D=[],T=[],g=[],c,u={},a,S=!1,x=!1,v=!1;if(y.levels.forEach(function(V){var I=V.attrs;S=S||!!(V.width&&V.height),x=x||!!V.videoCodec,v=v||!!V.audioCodec,E&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=u[N],a?a.url.push(V.url):(a=new Y.Level(V),u[N]=a,D.push(a)),I&&(I.AUDIO&&Object(B.addGroupId)(a,"audio",I.AUDIO),I.SUBTITLES&&Object(B.addGroupId)(a,"text",I.SUBTITLES))}),(S||x)&&v&&(D=D.filter(function(V){var I=V.videoCodec,N=V.width,X=V.height;return!!I||!!(N&&X)})),D=D.filter(function(V){var I=V.audioCodec,N=V.videoCodec;return(!I||Object(j.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(j.isCodecSupportedInMp4)(N,"video"))}),y.audioTracks&&(T=y.audioTracks.filter(function(V){return!V.audioCodec||Object(j.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(T)),y.subtitles&&(g=y.subtitles,Object(B.assignTrackIdsByGroup)(g)),D.length>0){c=D[0].bitrate,D.sort(function(V,I){return V.bitrate-I.bitrate}),this._levels=D;for(var O=0;O<D.length;O++)if(D[O].bitrate===c){this._firstLevel=O,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+c);break}var F=v&&!x,W={levels:D,audioTracks:T,subtitleTracks:g,firstLevel:this._firstLevel,stats:y.stats,audio:v,video:x,altAudio:!F&&T.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:y.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(f,y){if(o.prototype.onError.call(this,f,y),y.fatal)return;var D=y.context,T=this._levels[this.currentLevelIndex];if(D&&(D.type===A.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&D.groupId===T.audioGroupIds[T.urlId]||D.type===A.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&D.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,c=!0,u;switch(y.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:if(y.frag){var a=this._levels[y.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=y.frag.level)):u=y.frag.level}break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),u=D.level),g=!0;break;case _.ErrorDetails.REMUX_ALLOC_ERROR:u=y.level,g=!0;break}u!==void 0&&this.recoverLevel(y,u,g,c)},d.recoverLevel=function(f,y,D,T){var g=f.details,c=this._levels[y];if(c.loadError++,D){var u=this.retryLoadingOrFail(f);if(u)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(y);else if(this.manualLevelIndex===-1){var S=y===0?this._levels.length-1:y-1;this.currentLevelIndex!==S&&this._levels[S].loadError===0&&(this.warn(g+": switch to "+S),f.levelRetry=!0,this.hls.nextAutoLevel=S)}}},d.redundantFailover=function(f){var y=this._levels[f],D=y.url.length;if(D>1){var T=(y.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(g){g.urlId=T}),this.level=f}},d.onFragLoaded=function(f,y){var D=y.frag;if(D!==void 0&&D.type===A.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},d.onLevelLoaded=function(f,y){var D,T=y.level,g=y.details,c=this._levels[T];if(!c){var u;this.warn("Invalid level index "+T),(u=y.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(g.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,y,c.details)):(D=y.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(g.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(f,y){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,g=this.hls.audioTracks[y.id].groupId,c=0;c<D.audioGroupIds.length;c++)if(D.audioGroupIds[c]===g){T=c;break}T!==D.urlId&&(D.urlId=T,this.startLoad())}},d.loadPlaylist=function(f){var y=this.currentLevelIndex,D=this._levels[y];if(this.canLoad&&D&&D.url.length>0){var T=D.urlId,g=D.url[T];if(f)try{g=f.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+y+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+T+" "+g),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:g,level:y,id:T,deliveryDirectives:f||null})}},d.removeLevel=function(f,y){var D=function(c,u){return u!==y},T=this._levels.filter(function(g,c){return c!==f?!0:g.url.length>1&&y!==void 0?(g.url=g.url.filter(D),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(D)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(D)),g.urlId=0,!0):!1}).map(function(g,c){var u=g.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),g});this._levels=T,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:T})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var y,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===f&&(y=D[f])!==null&&y!==void 0&&y.details)return;if(f<0||f>=D.length){var T=f<0;if(this.hls.trigger(U.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:T,reason:"invalid level idx"}),T)return;f=Math.min(f,D.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=D[g],u=D[f];this.log("switching to level "+f+" from "+g),this.currentLevelIndex=f;var a=p({},u,{level:f,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var S=u.details;if(!S||S.live){var x=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(x)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),l}(P.default)},"./src/controller/level-helper.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"addGroupId",function(){return _}),R.d(Q,"assignTrackIdsByGroup",function(){return j}),R.d(Q,"updatePTS",function(){return B}),R.d(Q,"updateFragPTSDTS",function(){return A}),R.d(Q,"mergeDetails",function(){return p}),R.d(Q,"mapPartIntersection",function(){return b}),R.d(Q,"mapFragmentIntersection",function(){return M}),R.d(Q,"adjustSliding",function(){return L}),R.d(Q,"addSliding",function(){return C}),R.d(Q,"computeReloadInterval",function(){return E}),R.d(Q,"getFragmentWithSN",function(){return h}),R.d(Q,"getPartWith",function(){return o});var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts");function _(l,d,w){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function j(l){var d={};l.forEach(function(w){var f=w.groupId||"";w.id=d[f]=d[f]||0,d[f]++})}function B(l,d,w){var f=l[d],y=l[w];P(f,y)}function P(l,d){var w=d.startPTS;if(Object(Y.isFiniteNumber)(w)){var f=0,y;d.sn>l.sn?(f=w-l.start,y=l):(f=l.start-w,y=d),y.duration!==f&&(y.duration=f)}else if(d.sn>l.sn){var D=l.cc===d.cc;D&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function A(l,d,w,f,y,D){var T=f-w;T<=0&&(U.logger.warn("Fragment should have a positive duration",d),f=w+d.duration,D=y+d.duration);var g=w,c=f,u=d.startPTS,a=d.endPTS;if(Object(Y.isFiniteNumber)(u)){var S=Math.abs(u-w);Object(Y.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(S,d.deltaPTS):d.deltaPTS=S,g=Math.max(w,u),w=Math.min(w,u),y=Math.min(y,d.startDTS),c=Math.min(f,a),f=Math.max(f,a),D=Math.max(D,d.endDTS)}d.duration=f-w;var x=w-d.start;d.appendedPTS=f,d.start=d.startPTS=w,d.maxStartPTS=g,d.startDTS=y,d.endPTS=f,d.minEndPTS=c,d.endDTS=D;var v=d.sn;if(!l||v<l.startSN||v>l.endSN)return 0;var O,F=v-l.startSN,W=l.fragments;for(W[F]=d,O=F;O>0;O--)P(W[O],W[O-1]);for(O=F;O<W.length-1;O++)P(W[O],W[O+1]);return l.fragmentHint&&P(W[W.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,x}function p(l,d){for(var w=null,f=l.fragments,y=f.length-1;y>=0;y--){var D=f[y].initSegment;if(D){w=D;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,g;if(M(l,d,function(O,F){O.relurl&&(T=O.cc-F.cc),Object(Y.isFiniteNumber)(O.startPTS)&&Object(Y.isFiniteNumber)(O.endPTS)&&(F.start=F.startPTS=O.startPTS,F.startDTS=O.startDTS,F.appendedPTS=O.appendedPTS,F.maxStartPTS=O.maxStartPTS,F.endPTS=O.endPTS,F.endDTS=O.endDTS,F.minEndPTS=O.minEndPTS,F.duration=O.endPTS-O.startPTS,F.duration&&(g=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=O.elementaryStreams,F.loader=O.loader,F.stats=O.stats,F.urlId=O.urlId,O.initSegment&&(F.initSegment=O.initSegment,w=O.initSegment)}),w){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(O){var F;(!O.initSegment||O.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(O.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(O){return!O}),d.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=d.skippedSegments;u--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(T){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var S=0;S<a.length;S++)a[S].cc+=T}d.skippedSegments&&(d.startCC=d.fragments[0].cc),b(l.partList,d.partList,function(O,F){F.elementaryStreams=O.elementaryStreams,F.stats=O.stats}),g?A(d,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):L(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var x=d.advancedDateTime;if(d.advanced&&x){var v=d.edge;d.driftStart||(d.driftStartTime=x,d.driftStart=v),d.driftEndTime=x,d.driftEnd=v}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function b(l,d,w){if(l&&d)for(var f=0,y=0,D=l.length;y<=D;y++){var T=l[y],g=d[y+f];T&&g&&T.index===g.index&&T.fragment.sn===g.fragment.sn?w(T,g):f--}}function M(l,d,w){for(var f=d.skippedSegments,y=Math.max(l.startSN,d.startSN)-d.startSN,D=(l.fragmentHint?1:0)+(f?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,T=d.startSN-l.startSN,g=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=y;u<=D;u++){var a=c[T+u],S=g[u];f&&!S&&u<f&&(S=d.fragments[u]=a),a&&S&&w(a,S)}}function L(l,d){var w=d.startSN+d.skippedSegments-l.startSN,f=l.fragments;if(w<0||w>=f.length)return;C(d,f[w].start)}function C(l,d){if(d){for(var w=l.fragments,f=l.skippedSegments;f<w.length;f++)w[f].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function E(l,d){var w=1e3*l.levelTargetDuration,f=w/2,y=l.age,D=y>0&&y<w*3,T=d.loading.end-d.loading.start,g,c=l.availabilityDelay;if(l.updated===!1)if(D){var u=333*l.misses;g=Math.max(Math.min(f,T*2),u),l.availabilityDelay=(l.availabilityDelay||0)+g}else g=f;else D?(c=Math.min(c||w/2,y),l.availabilityDelay=c,g=c+w-y):g=w-T;return Math.round(g)}function h(l,d,w){if(!l||!l.details)return null;var f=l.details,y=f.fragments[d-f.startSN];return y||(y=f.fragmentHint,y&&y.sn===d?y:d<f.startSN&&w&&w.sn===d?w:null)}function o(l,d,w){if(!l||!l.details)return null;var f=l.details.partList;if(f)for(var y=f.length;y--;){var D=f[y];if(D.index===w&&D.fragment.sn===d)return D}return null}},"./src/controller/stream-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return f});var Y=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),_=R("./src/is-supported.ts"),j=R("./src/events.ts"),B=R("./src/utils/buffer-helper.ts"),P=R("./src/controller/fragment-tracker.ts"),A=R("./src/types/loader.ts"),p=R("./src/loader/fragment.ts"),b=R("./src/demux/transmuxer-interface.ts"),M=R("./src/types/transmuxer.ts"),L=R("./src/controller/gap-controller.ts"),C=R("./src/errors.ts"),E=R("./src/utils/logger.ts");function h(y,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(y,g.key,g)}}function o(y,D,T){return D&&h(y.prototype,D),T&&h(y,T),y}function l(y,D){y.prototype=Object.create(D.prototype),y.prototype.constructor=y,d(y,D)}function d(y,D){return d=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},d(y,D)}var w=100,f=function(y){l(D,y);function D(g,c){var u;return u=y.call(this,g,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var T=D.prototype;return T._registerListeners=function(){var c=this.hls;c.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(j.Events.ERROR,this.onError,this),c.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var c=this.hls;c.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(j.Events.ERROR,this.onError,this),c.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var S=a.startLevel;S===-1&&(a.config.testBandwidth?(S=0,this.bitrateTest=!0):S=a.nextAutoLevel),this.level=a.nextLoadLevel=S,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,S=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(S&&(!S.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(S))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var x,v=self.performance.now(),O=this.retryDate;(!O||v>=O||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,u,a=this.hls,S=this.levelLastLoaded,x=this.levels,v=this.media,O=a.config,F=a.nextLoadLevel;if(S===null||!v&&(this.startFragRequested||!O.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!x||!x[F])return;var W=x[F];this.level=a.nextLoadLevel=F;var V=W.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,A.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(W.maxBitrate);if(N>=X)return;if(this._streamEnded(I,V)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,q),this.state=U.State.ENDED;return}var ae=I.end,de=this.getNextFragment(ae,V);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Ae=de.sn-V.startSN;Ae>1&&(de=V.fragments[Ae-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===P.FragmentState.OK&&this.nextLoadPosition>ae){var be=this.audioOnly&&!this.altAudio?p.ElementaryStreamTypes.AUDIO:p.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,be,A.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,V)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((c=de.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=de.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(de,V):this.loadFragment(de,V,ae)},T.loadFragment=function(c,u,a){var S,x=this.fragmentTracker.getState(c);if(this.fragCurrent=c,x===P.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else x=P.FragmentState.NOT_LOADED}x===P.FragmentState.NOT_LOADED||x===P.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,y.prototype.loadFragment.call(this,c,u,a)):x===P.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((S=this.media)===null||S===void 0?void 0:S.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,S=this.getAppendedFrag(u.currentTime);if(S&&S.start>1&&this.flushMainBuffer(0,S.start-1),!u.paused&&c){var x=this.hls.nextLoadLevel,v=c[x],O=this.fragLastKbps;O&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*O)+1:a=0}else a=0;var F=this.getBufferedFrag(u.currentTime+a);if(F){var W=this.followingBufferedFrag(F);if(W){this.abortCurrentFrag();var V=W.maxStartPTS?W.maxStartPTS:W.start,I=W.duration,N=Math.max(F.end,V+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},T.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()},T.flushMainBuffer=function(c,u){y.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},T.onMediaAttached=function(c,u){y.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},T.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),y.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(Y.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(c,u){var a=!1,S=!1,x;u.levels.forEach(function(v){x=v.audioCodec,x&&(x.indexOf("mp4a.40.2")!==-1&&(a=!0),x.indexOf("mp4a.40.5")!==-1&&(S=!0))}),this.audioCodecSwitch=a&&S&&!Object(_.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},T.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var S=a[u.level];(!S.details||S.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(S.details))&&(this.state=U.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,u){var a,S=this.levels,x=u.level,v=u.details,O=v.totalduration;if(!S){this.warn("Levels were reset while loading level "+x);return}this.log("Level "+x+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+O);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==u.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var W=S[x],V=0;if(v.live||(a=W.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;V=this.alignPlaylists(v,W.details)}if(W.details=v,this.levelLastLoaded=x,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:v,level:x}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=U.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,V),this.tick()},T._handleFragmentLoadProgress=function(c){var u,a=c.frag,S=c.part,x=c.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var O=v[a.level],F=O.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var W=O.videoCodec,V=F.PTSKnown||!F.live,I=(u=a.initSegment)===null||u===void 0?void 0:u.data,N=this._getAudioCodec(O),X=this.transmuxer=this.transmuxer||new b.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=S?S.index:-1,ae=q!==-1,de=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,x.byteLength,q,ae),Ae=this.initPTS[a.cc];X.push(x,I,N,W,a,S,F.totalduration,V,de,Ae)},T.onAudioTrackSwitching=function(c,u){var a=this.altAudio,S=!!u.url,x=u.id;if(!S){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var O=this.hls;a&&O.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),O.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:x})}},T.onAudioTrackSwitched=function(c,u){var a=u.id,S=!!this.hls.audioTracks[a].url;if(S){var x=this.videoBuffer;x&&this.mediaBuffer!==x&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=x)}this.altAudio=S,this.tick()},T.onBufferCreated=function(c,u){var a=u.tracks,S,x,v=!1;for(var O in a){var F=a[O];if(F.id==="main"){if(x=O,S=F,O==="video"){var W=a[O];W&&(this.videoBuffer=W.buffer)}}else v=!0}v&&S?(this.log("Alternate track found, use "+x+".buffered to schedule main fragment loading"),this.mediaBuffer=S.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,u){var a=u.frag,S=u.part;if(a&&a.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(S?" p: "+S.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 x=S?S.stats:a.stats;this.fragLastKbps=Math.round(8*x.total/(x.buffering.end-x.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,S)},T.onError=function(c,u){switch(u.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,u);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=U.State.ERROR):!u.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,S=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);S&&S.len>.5&&(a=!this.reduceMaxBufferLength(S.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=B.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,u){var a=u.type;if(a!==p.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var S=(a===p.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(S,a,A.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){E.logger.log("could not seek to "+a+", already seeking at "+u);return}var S=B.BufferHelper.getBuffered(c),x=S.length?S.start(0):0,v=x-a;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},T._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},T._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var S=u.hls;if(!a||S.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=U.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var x=c.stats;x.parsing.start=x.parsing.end=x.buffering.start=x.buffering.end=self.performance.now(),S.trigger(j.Events.FRAG_LOADED,a)})},T._handleTransmuxComplete=function(c){var u,a="main",S=this.hls,x=c.remuxResult,v=c.chunkMeta,O=this.getCurrentContext(v);if(!O){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var F=O.frag,W=O.part,V=O.level,I=x.video,N=x.text,X=x.id3,q=x.initSegment,ae=this.altAudio?void 0:x.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,q){q.tracks&&(this._bufferInitSegment(V,q.tracks,F,v),S.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:q.tracks}));var de=q.initPTS,Ae=q.timescale;Object(Y.isFiniteNumber)(de)&&(this.initPTS[F.cc]=de,S.trigger(j.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:de,timescale:Ae}))}if(I&&x.independent!==!1){if(V.details){var be=I.startPTS,Ce=I.endPTS,Te=I.startDTS,Se=I.endDTS;if(W)W.elementaryStreams[I.type]={startPTS:be,endPTS:Ce,startDTS:Te,endDTS:Se};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<be){this.backtrack(F);return}F.setElementaryStreamInfo(I.type,F.start,Ce,F.start,Se,!0)}F.setElementaryStreamInfo(I.type,be,Ce,Te,Se),this.bufferFragmentData(I,F,W,v)}}else if(x.independent===!1){this.backtrack(F);return}if(ae){var ue=ae.startPTS,te=ae.endPTS,fe=ae.startDTS,oe=ae.endDTS;W&&(W.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:fe,endDTS:oe}),F.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ue,te,fe,oe),this.bufferFragmentData(ae,F,W,v)}if(X!=null&&(u=X.samples)!==null&&u!==void 0&&u.length){var Le={frag:F,id:a,samples:X.samples};S.trigger(j.Events.FRAG_PARSING_METADATA,Le)}if(N){var _e={frag:F,id:a,samples:N.samples};S.trigger(j.Events.FRAG_PARSING_USERDATA,_e)}},T._bufferInitSegment=function(c,u,a,S){var x=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var v=u.audio,O=u.video,F=u.audiovideo;if(v){var W=c.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),v.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(W="mp4a.40.5")),V.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),c.audioCodec&&c.audioCodec!==W&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+W+'"'),v.levelCodec=W,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}O&&(O.levelCodec=c.videoCodec,O.id="main",this.log("Init video buffer, container:"+O.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+O.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(I){var N=u[I],X=N.initSegment;X!=null&&X.byteLength&&x.hls.trigger(j.Events.BUFFER_APPENDING,{type:I,data:X,frag:a,part:null,chunkMeta:S,parent:a.type})}),this.tick()},T.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(B.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):B.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var S=this.fragPlaying,x=u.level;(!S||u.sn!==S.sn||S.level!==x||u.urlId!==S.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:u}),(!S||S.level!==x)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:x}),this.fragPlaying=u)}}},o(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"SubtitleStreamController",function(){return l});var Y=R("./src/events.ts"),U=R("./src/utils/logger.ts"),_=R("./src/utils/buffer-helper.ts"),j=R("./src/controller/fragment-finders.ts"),B=R("./src/utils/discontinuities.ts"),P=R("./src/controller/level-helper.ts"),A=R("./src/controller/fragment-tracker.ts"),p=R("./src/controller/base-stream-controller.ts"),b=R("./src/types/loader.ts"),M=R("./src/types/level.ts");function L(d,w){for(var f=0;f<w.length;f++){var y=w[f];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(d,y.key,y)}}function C(d,w,f){return w&&L(d.prototype,w),f&&L(d,f),d}function E(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,h(d,w)}function h(d,w){return h=Object.setPrototypeOf||function(y,D){return y.__proto__=D,y},h(d,w)}var o=500,l=function(d){E(w,d);function w(y,D){var T;return T=d.call(this,y,D,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var f=w.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var D=this.hls;D.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(Y.Events.ERROR,this.onError,this),D.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var D=this.hls;D.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(Y.Events.ERROR,this.onError,this),D.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=p.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(D,T){this.mainDetails=T.details},f.onSubtitleFragProcessed=function(D,T){var g=T.frag,c=T.success;if(this.fragPrevious=g,this.state=p.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,S=g.start,x=0;x<u.length;x++)if(S>=u[x].start&&S<=u[x].end){a=u[x];break}var v=g.start+g.duration;a?a.end=v:(a={start:S,end:v},u.push(a)),this.fragmentTracker.fragBuffered(g)},f.onBufferFlushing=function(D,T){var g=T.startOffset,c=T.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var S=a[u].details,x=S.targetduration,v=c-x;if(v<=0)return;T.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(O){for(var F=0;F<O.length;){if(O[F].end<=v){O.shift();continue}else if(O[F].start<v)O[F].start=v;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(g,v,b.PlaylistLevelType.SUBTITLE)}},f.onError=function(D,T){var g,c=T.frag;if(!c||c.type!==b.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=p.State.IDLE},f.onSubtitleTracksUpdated=function(D,T){var g=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new M.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){g.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(D,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(D,T){var g,c=T.details,u=T.id,a=this.currentTrackId,S=this.levels;if(!S.length)return;var x=S[a];if(u>=S.length||u!==a||!x)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=x.details)!==null&&g!==void 0&&g.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var O=v.fragments[0];if(!x.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(c,v):O&&Object(P.addSliding)(c,O.start);else{var F=this.alignPlaylists(c,x.details);F===0&&O&&Object(P.addSliding)(c,O.start)}}if(x.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===p.State.IDLE){var W=Object(j.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),x.details=void 0)}},f._handleFragmentLoadComplete=function(D){var T=D.frag,g=D.payload,c=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(S){var x=performance.now();u.trigger(Y.Events.FRAG_DECRYPTED,{frag:T,payload:S,stats:{tstart:a,tdecrypt:x}})})}},f.doTick=function(){if(!this.media){this.state=p.State.IDLE;return}if(this.state===p.State.IDLE){var D,T=this.currentTrackId,g=this.levels;if(!g.length||!g[T]||!g[T].details)return;var c=g[T].details,u=c.targetduration,a=this.config,S=this.media,x=_.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,S.currentTime-u,a.maxBufferHole),v=x.end,O=x.len,F=this.getMaxBufferLength()+u;if(O>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var W=c.fragments,V=W.length,I=c.edge,N,X=this.fragPrevious;if(v<I){var q=a.maxFragLookUpTolerance;X&&c.hasProgramDateTime&&(N=Object(j.findFragmentByPDT)(W,X.endProgramDateTime,q)),N||(N=Object(j.findFragmentByPTS)(X,W,v,q),!N&&X&&X.start<W[0].start&&(N=W[0]))}else N=W[V-1];(D=N)!==null&&D!==void 0&&D.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=p.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,c,v)}},f.loadFragment=function(D,T,g){this.fragCurrent=D,d.prototype.loadFragment.call(this,D,T,g)},C(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(p.default)},"./src/controller/subtitle-track-controller.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),_=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function B(L,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function P(L,C,E){return C&&B(L.prototype,C),E&&B(L,E),L}function A(L,C){L.prototype=Object.create(C.prototype),L.prototype.constructor=L,p(L,C)}function p(L,C){return p=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},p(L,C)}var b=function(L){A(C,L);function C(h){var o;return o=L.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var E=C.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Y.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Y.Events.ERROR,this.onError,this)},E.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=M(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},E.onSubtitleTrackLoaded=function(o,l){var d=l.id,w=l.details,f=this.trackId,y=this.tracksInGroup[f];if(!y){this.warn("Invalid subtitle track id "+d);return}var D=y.details;y.details=l.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,D))},E.onLevelLoading=function(o,l){this.switchLevel(l.level)},E.onLevelSwitching=function(o,l){this.switchLevel(l.level)},E.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(T){return!d||T.groupId===d});this.tracksInGroup=f;var y=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var D={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,D),y!==-1&&this.setSubtitleTrack(y,w)}},E.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var w=l[d];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},E.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},E.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,w=l.groupId,f=l.url;if(o)try{f=o.addDirectives(f)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:f,id:d,groupId:w,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var l=this,d=this.media,w=this.subtitleDisplay,f=this.trackId;if(!d)return;var y=M(d.textTracks),D=y.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(y).forEach(function(c){c.mode="disabled"});else{var T=D[f];T&&(T.mode="disabled")}var g=D[o];g&&(g.mode=w?"showing":"hidden")},E.setSubtitleTrack=function(o,l){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=w[o])!==null&&d!==void 0&&d.details)||o<-1||o>=w.length)return;this.clearTimer();var f=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var y=f.id,D=f.groupId,T=D===void 0?"":D,g=f.name,c=f.type,u=f.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:y,groupId:T,name:g,type:c,url:u});var a=this.switchParams(f.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.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),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},P(C,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),C}(_.default);function M(L){for(var C=[],E=0;E<L.length;E++){var h=L[E];h.kind==="subtitles"&&h.label&&C.push(L[E])}return C}Q.default=b},"./src/controller/timeline-controller.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"TimelineController",function(){return M});var Y=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),_=R("./src/utils/cea-608-parser.ts"),j=R("./src/utils/output-filter.ts"),B=R("./src/utils/webvtt-parser.ts"),P=R("./src/utils/texttrack-utils.ts"),A=R("./src/utils/imsc1-ttml-parser.ts"),p=R("./src/types/loader.ts"),b=R("./src/utils/logger.ts"),M=function(){function h(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new j.default(this,"textTrack1"),w=new j.default(this,"textTrack2"),f=new j.default(this,"textTrack3"),y=new j.default(this,"textTrack4");this.cea608Parser1=new _.default(1,d,w),this.cea608Parser2=new _.default(3,f,y)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(U.Events.FRAG_LOADING,this.onFragLoading,this),d.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,w,f,y,D){for(var T=!1,g=D.length;g--;){var c=D[g],u=C(c[0],c[1],w,f);if(u>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],f),T=!0,u/(f-w)>.5))return}if(T||D.push([w,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,w,f,y)}else{var S=this.Cues.newCue(null,w,f,y);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:S,track:d})}},o.onInitPtsFound=function(d,w){var f=this,y=w.frag,D=w.id,T=w.initPTS,g=w.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[y.cc]=T,this.timescale[y.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){f.onFragLoaded(U.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(d){var w=this.media;if(w)for(var f=0;f<w.textTracks.length;f++){var y=w.textTracks[f];if(y[d])return y}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var w=this.captionsProperties,f=this.captionsTracks,y=this.media,D=w[d],T=D.label,g=D.languageCode,c=this.getExistingTrack(d);if(c)f[d]=c,Object(P.clearCurrentCues)(f[d]),Object(P.sendAddTrackEvent)(f[d],y);else{var u=this.createTextTrack("captions",T,g);u&&(u[d]=!0,f[d]=u)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var f=w.label,y={_id:d,label:f,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=y,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[y]})},o.createTextTrack=function(d,w,f){var y=this.media;return y?y.addTextTrack(d,w,f):void 0},o.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(P.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var f=0;f<w.length;f++)Object(P.clearCurrentCues)(w[f])},o.onSubtitleTracksUpdated=function(d,w){var f=this;this.textTracks=[];var y=w.subtitleTracks||[],D=y.some(function(u){return u.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var T=this.tracks&&y&&this.tracks.length===y.length;if(this.tracks=y||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var S;if(a<g.length){for(var x=null,v=0;v<g.length;v++)if(L(g[v],u)){x=g[v];break}x&&(S=x)}S?Object(P.clearCurrentCues)(S):(S=f.createTextTrack("subtitles",u.name,u.lang),S&&(S.mode="disabled")),S&&(S.groupId=u.groupId,f.textTracks.push(S))})}else if(!T&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,w){var f=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(y){var D=/(?:CC|SERVICE)([1-4])/.exec(y.instreamId);if(!D)return;var T="textTrack"+D[1],g=f.captionsProperties[T];if(!g)return;g.label=y.name,y.lang&&(g.languageCode=y.lang),g.media=y})},o.onFragLoading=function(d,w){var f=this.cea608Parser1,y=this.cea608Parser2,D=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(f&&y))return;if(w.frag.type===p.PlaylistLevelType.MAIN){var g,c,u=w.frag.sn,a=(g=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;u===D+1||u===D&&a===T+1||(f.reset(),y.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(d,w){var f=w.frag,y=w.payload,D=this.initPTS,T=this.unparsedVttFrags;if(f.type===p.PlaylistLevelType.SUBTITLE)if(y.byteLength){if(!Object(Y.isFiniteNumber)(D[f.cc])){T.push(w),D.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var g=f.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[f.level],u=this.vttCCs;u[f.cc]||(u[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===A.IMSC1_CODEC?this._parseIMSC1(f,y):this._parseVTTs(f,y,u)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,w){var f=this,y=this.hls;Object(A.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(D){f._appendCues(D,d.level),y.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(D){b.logger.log("Failed to parse IMSC1: "+D),y.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:D})})},o._parseVTTs=function(d,w,f){var y=this,D=this.hls;Object(B.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],f,d.cc,d.start,function(T){y._appendCues(T,d.level),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(T){y._fallbackToIMSC1(d,w),b.logger.log("Failed to parse VTT cue: "+T),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:T})})},o._fallbackToIMSC1=function(d,w){var f=this,y=this.tracks[d.level];y.textCodec||Object(A.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){y.textCodec=A.IMSC1_CODEC,f._parseIMSC1(d,w)},function(){y.textCodec="wvtt"})},o._appendCues=function(d,w){var f=this.hls;if(this.config.renderTextTracksNatively){var y=this.textTracks[w];if(y.mode==="disabled")return;d.forEach(function(g){return Object(P.addCueToTrack)(y,g)})}else{var D=this.tracks[w],T=D.default?"default":"subtitles"+w;f.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:d,track:T})}},o.onFragDecrypted=function(d,w){var f=w.frag;if(f.type===p.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(U.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,w){var f=this.cea608Parser1,y=this.cea608Parser2;if(!this.enabled||!(f&&y))return;for(var D=0;D<w.samples.length;D++){var T=w.samples[D].bytes;if(T){var g=this.extractCea608Data(T);f.addData(w.samples[D].pts,g[0]),y.addData(w.samples[D].pts,g[1])}}},o.onBufferFlushing=function(d,w){var f=w.startOffset,y=w.endOffset,D=w.endOffsetSubtitles,T=w.type,g=this.media;if(!g||g.currentTime<y)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(P.removeCuesInRange)(c[a],f,y)})}if(this.config.renderTextTracksNatively&&(f===0&&D!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(P.removeCuesInRange)(u[a],f,D)})}},o.extractCea608Data=function(d){for(var w=d[0]&31,f=2,y=[[],[]],D=0;D<w;D++){var T=d[f++],g=127&d[f++],c=127&d[f++],u=(4&T)!==0,a=3&T;if(g===0&&c===0)continue;u&&((a===0||a===1)&&(y[a].push(g),y[a].push(c)))}return y},h}();function L(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function C(h,o,l,d){return Math.min(o,d)-Math.max(h,l)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return Y});var Y=function(){function U(j,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=B}var _=U.prototype;return _.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},U}()},"./src/crypt/aes-decryptor.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"removePadding",function(){return U}),R.d(Q,"default",function(){return _});var Y=R("./src/utils/typed-array.ts");function U(j){var B=j.byteLength,P=B&&new DataView(j.buffer).getUint8(B-1);return P?Object(Y.sliceUint8)(j,0,B-P):j}var _=function(){function j(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var B=j.prototype;return B.uint8ArrayToUint32Array_=function(A){for(var p=new DataView(A),b=new Uint32Array(4),M=0;M<4;M++)b[M]=p.getUint32(M*4);return b},B.initTable=function(){var A=this.sBox,p=this.invSBox,b=this.subMix,M=b[0],L=b[1],C=b[2],E=b[3],h=this.invSubMix,o=h[0],l=h[1],d=h[2],w=h[3],f=new Uint32Array(256),y=0,D=0,T=0;for(T=0;T<256;T++)T<128?f[T]=T<<1:f[T]=T<<1^283;for(T=0;T<256;T++){var g=D^D<<1^D<<2^D<<3^D<<4;g=g>>>8^g&255^99,A[y]=g,p[g]=y;var c=f[y],u=f[c],a=f[u],S=f[g]*257^g*16843008;M[y]=S<<24|S>>>8,L[y]=S<<16|S>>>16,C[y]=S<<8|S>>>24,E[y]=S,S=a*16843009^u*65537^c*257^y*16843008,o[g]=S<<24|S>>>8,l[g]=S<<16|S>>>16,d[g]=S<<8|S>>>24,w[g]=S,y?(y=c^f[f[f[a^c]]],D^=f[f[D]]):y=D=1}},B.expandKey=function(A){for(var p=this.uint8ArrayToUint32Array_(A),b=!0,M=0;M<p.length&&b;)b=p[M]===this.key[M],M++;if(b)return;this.key=p;var L=this.keySize=p.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var C=this.ksRows=(L+6+1)*4,E,h,o=this.keySchedule=new Uint32Array(C),l=this.invKeySchedule=new Uint32Array(C),d=this.sBox,w=this.rcon,f=this.invSubMix,y=f[0],D=f[1],T=f[2],g=f[3],c,u;for(E=0;E<C;E++){if(E<L){c=o[E]=p[E];continue}u=c,E%L===0?(u=u<<8|u>>>24,u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255],u^=w[E/L|0]<<24):L>6&&E%L===4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[u&255]),o[E]=c=(o[E-L]^u)>>>0}for(h=0;h<C;h++)E=C-h,h&3?u=o[E]:u=o[E-4],h<4||E<=4?l[h]=u:l[h]=y[d[u>>>24]]^D[d[u>>>16&255]]^T[d[u>>>8&255]]^g[d[u&255]],l[h]=l[h]>>>0},B.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},B.decrypt=function(A,p,b){for(var M=this.keySize+6,L=this.invKeySchedule,C=this.invSBox,E=this.invSubMix,h=E[0],o=E[1],l=E[2],d=E[3],w=this.uint8ArrayToUint32Array_(b),f=w[0],y=w[1],D=w[2],T=w[3],g=new Int32Array(A),c=new Int32Array(g.length),u,a,S,x,v,O,F,W,V,I,N,X,q,ae,de=this.networkToHostOrderSwap;p<g.length;){for(V=de(g[p]),I=de(g[p+1]),N=de(g[p+2]),X=de(g[p+3]),v=V^L[0],O=X^L[1],F=N^L[2],W=I^L[3],q=4,ae=1;ae<M;ae++)u=h[v>>>24]^o[O>>16&255]^l[F>>8&255]^d[W&255]^L[q],a=h[O>>>24]^o[F>>16&255]^l[W>>8&255]^d[v&255]^L[q+1],S=h[F>>>24]^o[W>>16&255]^l[v>>8&255]^d[O&255]^L[q+2],x=h[W>>>24]^o[v>>16&255]^l[O>>8&255]^d[F&255]^L[q+3],v=u,O=a,F=S,W=x,q=q+4;u=C[v>>>24]<<24^C[O>>16&255]<<16^C[F>>8&255]<<8^C[W&255]^L[q],a=C[O>>>24]<<24^C[F>>16&255]<<16^C[W>>8&255]<<8^C[v&255]^L[q+1],S=C[F>>>24]<<24^C[W>>16&255]<<16^C[v>>8&255]<<8^C[O&255]^L[q+2],x=C[W>>>24]<<24^C[v>>16&255]<<16^C[O>>8&255]<<8^C[F&255]^L[q+3],c[p]=de(u^f),c[p+1]=de(x^y),c[p+2]=de(S^D),c[p+3]=de(a^T),f=V,y=I,D=N,T=X,p=p+4}return c.buffer},j}()},"./src/crypt/decrypter.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return p});var Y=R("./src/crypt/aes-crypto.ts"),U=R("./src/crypt/fast-aes-key.ts"),_=R("./src/crypt/aes-decryptor.ts"),j=R("./src/utils/logger.ts"),B=R("./src/utils/mp4-tools.ts"),P=R("./src/utils/typed-array.ts"),A=16,p=function(){function b(L,C,E){var h=E===void 0?{}:E,o=h.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=C,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=b.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var E=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(_.removePadding)(E):E},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(C,E,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),E,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),E,h).then(o)},M.softwareDecrypt=function(C,E,h){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(C=Object(B.appendUint8Array)(d,C),this.remainderData=null);var w=this.getValidChunk(C);if(!w.length)return null;o&&(h=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new _.default),f.expandKey(E);var y=l;return this.currentResult=f.decrypt(w.buffer,0,h),this.currentIV=Object(P.sliceUint8)(w,-16).buffer,y||null},M.webCryptoDecrypt=function(C,E,h){var o=this,l=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new U.default(l,E)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new Y.default(l,h);return w.decrypt(C.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,C,E,h)})},M.onWebCryptoError=function(C,E,h,o){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,h,o)},M.getValidChunk=function(C){var E=C,h=C.length-C.length%A;return h!==C.length&&(E=Object(P.sliceUint8)(C,0,h),this.remainderData=Object(P.sliceUint8)(C,h)),E},M.logOnce=function(C){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return Y});var Y=function(){function U(j,B){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=B}var _=U.prototype;return _.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/adts.ts"),_=R("./src/utils/logger.ts"),j=R("./src/demux/id3.ts");function B(p,b){p.prototype=Object.create(b.prototype),p.prototype.constructor=p,P(p,b)}function P(p,b){return P=Object.setPrototypeOf||function(L,C){return L.__proto__=C,L},P(p,b)}var A=function(p){B(b,p);function b(L,C){var E;return E=p.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=L,E.config=C,E}var M=b.prototype;return M.resetInitSegment=function(C,E,h){p.prototype.resetInitSegment.call(this,C,E,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:h,inputTimeScale:9e4,dropped:0}},b.probe=function(C){if(!C)return!1;for(var E=j.getID3Data(C,0)||[],h=E.length,o=C.length;h<o;h++)if(U.probe(C,h))return _.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(C,E){return U.canParse(C,E)},M.appendFrame=function(C,E,h){U.initTrackConfig(C,this.observer,E,h,C.manifestCodec);var o=U.appendFrame(C,E,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},b}(Y.default);A.minProbeByteLength=9,Q.default=A},"./src/demux/adts.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"getAudioConfig",function(){return j}),R.d(Q,"isHeaderPattern",function(){return B}),R.d(Q,"getHeaderLength",function(){return P}),R.d(Q,"getFullFrameLength",function(){return A}),R.d(Q,"canGetFrameLength",function(){return p}),R.d(Q,"isHeader",function(){return b}),R.d(Q,"canParse",function(){return M}),R.d(Q,"probe",function(){return L}),R.d(Q,"initTrackConfig",function(){return C}),R.d(Q,"getFrameDuration",function(){return E}),R.d(Q,"parseFrameHeader",function(){return h}),R.d(Q,"appendFrame",function(){return o});var Y=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),_=R("./src/events.ts");function j(l,d,w,f){var y,D,T,g,c=navigator.userAgent.toLowerCase(),u=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];y=((d[w+2]&192)>>>6)+1;var S=(d[w+2]&60)>>>2;if(S>a.length-1){l.trigger(_.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S});return}return T=(d[w+2]&1)<<2,T|=(d[w+3]&192)>>>6,Y.logger.log("manifest codec:"+f+", ADTS type:"+y+", samplingIndex:"+S),/firefox/i.test(c)?S>=6?(y=5,g=new Array(4),D=S-3):(y=2,g=new Array(2),D=S):c.indexOf("android")!==-1?(y=2,g=new Array(2),D=S):(y=5,g=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&S>=6?D=S-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(S>=6&&T===1||/vivaldi/i.test(c))||!f&&T===1)&&(y=2,g=new Array(2)),D=S)),g[0]=y<<3,g[0]|=(S&14)>>1,g[1]|=(S&1)<<7,g[1]|=T<<3,y===5&&(g[1]|=(D&14)>>1,g[2]=(D&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:a[S],channelCount:T,codec:"mp4a.40."+y,manifestCodec:u}}function B(l,d){return l[d]===255&&(l[d+1]&246)===240}function P(l,d){return l[d+1]&1?7:9}function A(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function p(l,d){return d+5<l.length}function b(l,d){return d+1<l.length&&B(l,d)}function M(l,d){return p(l,d)&&B(l,d)&&A(l,d)<=l.length-d}function L(l,d){if(b(l,d)){var w=P(l,d);if(d+w>=l.length)return!1;var f=A(l,d);if(f<=w)return!1;var y=d+f;return y===l.length||b(l,y)}return!1}function C(l,d,w,f,y){if(!l.samplerate){var D=j(d,w,f,y);if(!D)return;l.config=D.config,l.samplerate=D.samplerate,l.channelCount=D.channelCount,l.codec=D.codec,l.manifestCodec=D.manifestCodec,Y.logger.log("parsed codec:"+l.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function E(l){return 1024*9e4/l}function h(l,d,w,f,y){var D=P(l,d),T=A(l,d);if(T-=D,T>0){var g=w+f*y;return{headerLength:D,frameLength:T,stamp:g}}}function o(l,d,w,f,y){var D=E(l.samplerate),T=h(d,w,f,y,D);if(T){var g=T.frameLength,c=T.headerLength,u=T.stamp,a=c+g,S=Math.max(0,w+a-d.length),x;S?(x=new Uint8Array(a-c),x.set(d.subarray(w+c,d.length),0)):x=d.subarray(w+c,w+a);var v={unit:x,pts:u};return S||l.samples.push(v),{sample:v,length:a,missing:S}}}},"./src/demux/base-audio-demuxer.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"initPTSFn",function(){return A});var Y=R("./src/polyfills/number.ts"),U=R("./src/demux/id3.ts"),_=R("./src/demux/dummy-demuxed-track.ts"),j=R("./src/utils/mp4-tools.ts"),B=R("./src/utils/typed-array.ts"),P=function(){function p(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=p.prototype;return b.resetInitSegment=function(L,C,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(L,C){return!1},b.appendFrame=function(L,C,E){},b.demux=function(L,C){this.cachedData&&(L=Object(j.appendUint8Array)(this.cachedData,L),this.cachedData=null);var E=U.getID3Data(L,0),h=E?E.length:0,o,l,d=this._audioTrack,w=this._id3Track,f=E?U.getTimeStamp(E):void 0,y=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(f,C)),E&&E.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),l=this.initPTS;h<y;){if(this.canParse(L,h)){var D=this.appendFrame(d,L,h);D?(this.frameIndex++,l=D.sample.pts,h+=D.length,o=h):h=y}else U.canParse(L,h)?(E=U.getID3Data(L,h),w.samples.push({pts:l,dts:l,data:E}),h+=E.length,o=h):h++;if(h===y&&o!==y){var T=Object(B.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:d,avcTrack:Object(_.dummyTrack)(),id3Track:w,textTrack:Object(_.dummyTrack)()}},b.demuxSampleAes=function(L,C,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(L){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(_.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(_.dummyTrack)()}},b.destroy=function(){},p}(),A=function(b,M){return Object(Y.isFiniteNumber)(b)?b*90:M*9e4};Q.default=P},"./src/demux/chunk-cache.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return Y});var Y=function(){function _(){this.chunks=[],this.dataLength=0}var j=_.prototype;return j.push=function(P){this.chunks.push(P),this.dataLength+=P.length},j.flush=function(){var P=this.chunks,A=this.dataLength,p;if(P.length)P.length===1?p=P[0]:p=U(P,A);else return new Uint8Array(0);return this.reset(),p},j.reset=function(){this.chunks.length=0,this.dataLength=0},_}();function U(_,j){for(var B=new Uint8Array(j),P=0,A=0;A<_.length;A++){var p=_[A];B.set(p,P),P+=p.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/utils/logger.ts"),U=function(){function _(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var j=_.prototype;return j.loadWord=function(){var P=this.data,A=this.bytesAvailable,p=P.byteLength-A,b=new Uint8Array(4),M=Math.min(4,A);if(M===0)throw new Error("no bytes available");b.set(P.subarray(p,p+M)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},j.skipBits=function(P){var A;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,A=P>>3,P-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},j.readBits=function(P){var A=Math.min(this.bitsAvailable,P),p=this.word>>>32-A;return P>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=P-A,A>0&&this.bitsAvailable?p<<A|this.readBits(A):p},j.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},j.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(P){for(var A=8,p=8,b,M=0;M<P;M++)p!==0&&(b=this.readEG(),p=(A+b+256)%256),A=p===0?A:p},j.readSPS=function(){var P=0,A=0,p=0,b=0,M,L,C,E=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),f=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);E();var D=E();if(h(5),d(3),E(),f(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var T=o();if(T===3&&d(1),f(),f(),d(1),l())for(L=T!==3?8:12,C=0;C<L;C++)l()&&(C<6?y(16):y(64))}f();var g=o();if(g===0)o();else if(g===1)for(d(1),w(),w(),M=o(),C=0;C<M;C++)w();f(),d(1);var c=o(),u=o(),a=h(1);a===0&&d(1),d(1),l()&&(P=o(),A=o(),p=o(),b=o());var S=[1,1];if(l()&&l()){var x=E();switch(x){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((c+1)*16-P*2-A*2),height:(2-a)*(u+1)*16-(a?2:4)*(p+b),pixelRatio:S}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},_}();Q.default=U},"./src/demux/id3.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"isHeader",function(){return Y}),R.d(Q,"isFooter",function(){return U}),R.d(Q,"getID3Data",function(){return _}),R.d(Q,"canParse",function(){return B}),R.d(Q,"getTimeStamp",function(){return P}),R.d(Q,"isTimeStampFrame",function(){return A}),R.d(Q,"getID3Frames",function(){return b}),R.d(Q,"decodeFrame",function(){return M}),R.d(Q,"utf8ArrayToStr",function(){return o}),R.d(Q,"testables",function(){return l});var Y=function(y,D){return D+10<=y.length&&(y[D]===73&&y[D+1]===68&&y[D+2]===51&&(y[D+3]<255&&y[D+4]<255&&(y[D+6]<128&&y[D+7]<128&&y[D+8]<128&&y[D+9]<128)))},U=function(y,D){return D+10<=y.length&&(y[D]===51&&y[D+1]===68&&y[D+2]===73&&(y[D+3]<255&&y[D+4]<255&&(y[D+6]<128&&y[D+7]<128&&y[D+8]<128&&y[D+9]<128)))},_=function(y,D){for(var T=D,g=0;Y(y,D);){g+=10;var c=j(y,D+6);g+=c,U(y,D+10)&&(g+=10),D+=g}return g>0?y.subarray(T,T+g):void 0},j=function(y,D){var T=0;return T=(y[D]&127)<<21,T|=(y[D+1]&127)<<14,T|=(y[D+2]&127)<<7,T|=y[D+3]&127,T},B=function(y,D){return Y(y,D)&&j(y,D+6)+10<=y.length-D},P=function(y){for(var D=b(y),T=0;T<D.length;T++){var g=D[T];if(A(g))return h(g)}return},A=function(y){return y&&y.key==="PRIV"&&y.info==="com.apple.streaming.transportStreamTimestamp"},p=function(y){var D=String.fromCharCode(y[0],y[1],y[2],y[3]),T=j(y,4),g=10;return{type:D,size:T,data:y.subarray(g,g+T)}},b=function(y){for(var D=0,T=[];Y(y,D);){var g=j(y,D+6);D+=10;for(var c=D+g;D+8<c;){var u=p(y.subarray(D)),a=M(u);a&&T.push(a),D+=u.size+10}U(y,D)&&(D+=10)}return T},M=function(y){return y.type==="PRIV"?L(y):y.type[0]==="W"?E(y):C(y)},L=function(y){if(y.size<2)return;var D=o(y.data,!0),T=new Uint8Array(y.data.subarray(D.length+1));return{key:y.type,info:D,data:T.buffer}},C=function(y){if(y.size<2)return;if(y.type==="TXXX"){var D=1,T=o(y.data.subarray(D),!0);D+=T.length+1;var g=o(y.data.subarray(D));return{key:y.type,info:T,data:g}}var c=o(y.data.subarray(1));return{key:y.type,data:c}},E=function(y){if(y.type==="WXXX"){if(y.size<2)return;var D=1,T=o(y.data.subarray(D),!0);D+=T.length+1;var g=o(y.data.subarray(D));return{key:y.type,info:T,data:g}}var c=o(y.data);return{key:y.type,data:c}},h=function(y){if(y.data.byteLength===8){var D=new Uint8Array(y.data),T=D[3]&1,g=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return g/=45,T&&(g+=4772185884e-2),Math.round(g)}return},o=function(y,D){D===void 0&&(D=!1);var T=w();if(T){var g=T.decode(y);if(D){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var u=y.length,a,S,x,v="",O=0;O<u;){if(a=y[O++],a===0&&D)return v;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(a);break;case 12:case 13:S=y[O++],v+=String.fromCharCode((a&31)<<6|S&63);break;case 14:S=y[O++],x=y[O++],v+=String.fromCharCode((a&15)<<12|(S&63)<<6|(x&63)<<0);break;default:}}return v},l={decodeTextFrame:C},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/id3.ts"),_=R("./src/utils/logger.ts"),j=R("./src/demux/mpegaudio.ts");function B(p,b){p.prototype=Object.create(b.prototype),p.prototype.constructor=p,P(p,b)}function P(p,b){return P=Object.setPrototypeOf||function(L,C){return L.__proto__=C,L},P(p,b)}var A=function(p){B(b,p);function b(){return p.apply(this,arguments)||this}var M=b.prototype;return M.resetInitSegment=function(C,E,h){p.prototype.resetInitSegment.call(this,C,E,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:h,inputTimeScale:9e4,dropped:0}},b.probe=function(C){if(!C)return!1;for(var E=U.getID3Data(C,0)||[],h=E.length,o=C.length;h<o;h++)if(j.probe(C,h))return _.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(C,E){return j.canParse(C,E)},M.appendFrame=function(C,E,h){return this.initPTS===null?void 0:j.appendFrame(C,E,h,this.initPTS,this.frameIndex)},b}(Y.default);A.minProbeByteLength=4,Q.default=A},"./src/demux/mp4demuxer.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/utils/mp4-tools.ts"),U=R("./src/demux/dummy-demuxed-track.ts"),_=function(){function j(P,A){this.remainderData=null,this.config=void 0,this.config=A}var B=j.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},j.probe=function(A){return Object(Y.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},B.demux=function(A){var p=A,b=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(p=Object(Y.appendUint8Array)(this.remainderData,A));var M=Object(Y.segmentValidRange)(p);this.remainderData=M.remainder,b.samples=M.valid||new Uint8Array}else b.samples=p;return{audioTrack:Object(U.dummyTrack)(),avcTrack:b,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.flush=function(){var A=Object(U.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.demuxSampleAes=function(A,p,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},j}();_.minProbeByteLength=1024,Q.default=_},"./src/demux/mpegaudio.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"appendFrame",function(){return P}),R.d(Q,"parseHeader",function(){return A}),R.d(Q,"isHeaderPattern",function(){return p}),R.d(Q,"isHeader",function(){return b}),R.d(Q,"canParse",function(){return M}),R.d(Q,"probe",function(){return L});var Y=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],_=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function P(C,E,h,o,l){if(h+24>E.length)return;var d=A(E,h);if(d&&h+d.frameLength<=E.length){var w=d.samplesPerFrame*9e4/d.sampleRate,f=o+l*w,y={unit:E.subarray(h,h+d.frameLength),pts:f,dts:f};return C.config=[],C.channelCount=d.channelCount,C.samplerate=d.sampleRate,C.samples.push(y),{sample:y,length:d.frameLength,missing:0}}}function A(C,E){var h=C[E+1]>>3&3,o=C[E+1]>>1&3,l=C[E+2]>>4&15,d=C[E+2]>>2&3;if(h!==1&&l!==0&&l!==15&&d!==3){var w=C[E+2]>>1&1,f=C[E+3]>>6,y=h===3?3-o:o===3?3:4,D=U[y*14+l-1]*1e3,T=h===3?0:h===2?1:2,g=_[T*3+d],c=f===3?1:2,u=j[h][o],a=B[o],S=u*8*a,x=Math.floor(u*D/g+w)*a;if(Y===null){var v=navigator.userAgent||"",O=v.match(/Chrome\/(\d+)/i);Y=O?parseInt(O[1]):0}var F=!!Y&&Y<=87;return F&&o===2&&D>=224e3&&f===0&&(C[E+3]=C[E+3]|128),{sampleRate:g,channelCount:c,frameLength:x,samplesPerFrame:S}}}function p(C,E){return C[E]===255&&(C[E+1]&224)===224&&(C[E+1]&6)!==0}function b(C,E){return E+1<C.length&&p(C,E)}function M(C,E){var h=4;return p(C,E)&&h<=C.length-E}function L(C,E){if(E+1<C.length&&p(C,E)){var h=4,o=A(C,E),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var d=E+l;return d===C.length||b(C,d)}return!1}},"./src/demux/sample-aes.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/crypt/decrypter.ts"),U=R("./src/demux/tsdemuxer.ts"),_=function(){function j(P,A,p){this.keyData=void 0,this.decrypter=void 0,this.keyData=p,this.decrypter=new Y.default(P,A,{removePKCS7Padding:!1})}var B=j.prototype;return B.decryptBuffer=function(A,p){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,p)},B.decryptAacSample=function(A,p,b,M){var L=A[p].unit,C=L.subarray(16,L.length-L.length%16),E=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),h=this;this.decryptBuffer(E,function(o){var l=new Uint8Array(o);L.set(l,16),M||h.decryptAacSamples(A,p+1,b)})},B.decryptAacSamples=function(A,p,b){for(;;p++){if(p>=A.length){b();return}if(A[p].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(A,p,b,M),!M)return}},B.getAvcEncryptedData=function(A){for(var p=Math.floor((A.length-48)/160)*16+16,b=new Int8Array(p),M=0,L=32;L<=A.length-16;L+=160,M+=16)b.set(A.subarray(L,L+16),M);return b},B.getAvcDecryptedUnit=function(A,p){for(var b=new Uint8Array(p),M=0,L=32;L<=A.length-16;L+=160,M+=16)A.set(b.subarray(M,M+16),L);return A},B.decryptAvcSample=function(A,p,b,M,L,C){var E=Object(U.discardEPB)(L.data),h=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(h.buffer,function(l){L.data=o.getAvcDecryptedUnit(E,l),C||o.decryptAvcSamples(A,p,b+1,M)})},B.decryptAvcSamples=function(A,p,b,M){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;p++,b=0){if(p>=A.length){M();return}for(var L=A[p].units;!(b>=L.length);b++){var C=L[b];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(A,p,b,M,C,E),!E)return}}},j}();Q.default=_},"./src/demux/transmuxer-interface.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return L});var Y=R("./node_modules/webworkify-webpack/index.js"),U=R.n(Y),_=R("./src/events.ts"),j=R("./src/demux/transmuxer.ts"),B=R("./src/utils/logger.ts"),P=R("./src/errors.ts"),A=R("./src/utils/mediasource-helper.ts"),p=R("./node_modules/eventemitter3/index.js"),b=R.n(p),M=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function C(h,o,l,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var f=h.config,y=function(u,a){a=a||{},a.frag=w.frag,a.id=w.id,h.trigger(u,a)};this.observer=new p.EventEmitter,this.observer.on(_.Events.FRAG_DECRYPTED,y),this.observer.on(_.Events.ERROR,y);var D={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var g;try{g=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){h.trigger(_.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:D,vendor:T,id:o,config:JSON.stringify(f)})}catch(c){B.logger.warn("Error in worker:",c),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new j.default(this.observer,D,f,T,o),this.worker=null}}else this.transmuxer=new j.default(this.observer,D,f,T,o)}var E=C.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,l,d,w,f,y,D,T,g,c){var u=this;g.transmuxing.start=self.performance.now();var a=this.transmuxer,S=this.worker,x=y?y.start:f.start,v=f.decryptdata,O=this.frag,F=!(O&&f.cc===O.cc),W=!(O&&g.level===O.level),V=O?g.sn-O.sn:-1,I=this.part?g.part-this.part.index:1,N=!W&&(V===1||V===0&&I===1),X=self.performance.now();(W||V||f.stats.parsing.start===0)&&(f.stats.parsing.start=X),y&&(I||!N)&&(y.stats.parsing.start=X);var q=new j.TransmuxState(F,N,T,W,x);if(!N||F){B.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+x);var ae=new j.TransmuxConfig(d,w,l,D,c);this.configureTransmuxer(ae)}if(this.frag=f,this.part=y,S)S.postMessage({cmd:"demux",data:o,decryptdata:v,chunkMeta:g,state:q},o instanceof ArrayBuffer?[o]:[]);else if(a){var de=a.push(o,v,g,q);Object(j.isPromise)(de)?de.then(function(Ae){u.handleTransmuxComplete(Ae)}):this.handleTransmuxComplete(de)}},E.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(d){var f=d.flush(o);Object(j.isPromise)(f)?f.then(function(y){l.handleFlushResult(y,o)}):this.handleFlushResult(f,o)}},E.handleFlushResult=function(o,l){var d=this;o.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(l)},E.onWorkerMessage=function(o){var l=o.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},E.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},C}()},"./src/demux/transmuxer-worker.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return P});var Y=R("./src/demux/transmuxer.ts"),U=R("./src/events.ts"),_=R("./src/utils/logger.ts"),j=R("./node_modules/eventemitter3/index.js"),B=R.n(j);function P(L){var C=new j.EventEmitter,E=function(o,l){L.postMessage({event:o,data:l})};C.on(U.Events.FRAG_DECRYPTED,E),C.on(U.Events.ERROR,E),L.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new Y.default(C,o.typeSupported,l,o.vendor,o.id),Object(_.enableLogs)(l.debug),E("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var d=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Y.isPromise)(d)?d.then(function(y){A(L,y)}):A(L,d);break}case"flush":{var w=o.chunkMeta,f=L.transmuxer.flush(w);Object(Y.isPromise)(f)?f.then(function(y){b(L,y,w)}):b(L,f,w);break}default:break}})}function A(L,C){if(M(C.remuxResult))return;var E=[],h=C.remuxResult,o=h.audio,l=h.video;o&&p(E,o),l&&p(E,l),L.postMessage({event:"transmuxComplete",data:C},E)}function p(L,C){C.data1&&L.push(C.data1.buffer),C.data2&&L.push(C.data2.buffer)}function b(L,C,E){C.forEach(function(h){A(L,h)}),L.postMessage({event:"flush",data:E})}function M(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return l}),R.d(Q,"isPromise",function(){return f}),R.d(Q,"TransmuxConfig",function(){return y}),R.d(Q,"TransmuxState",function(){return D});var Y=R("./src/events.ts"),U=R("./src/errors.ts"),_=R("./src/crypt/decrypter.ts"),j=R("./src/demux/aacdemuxer.ts"),B=R("./src/demux/mp4demuxer.ts"),P=R("./src/demux/tsdemuxer.ts"),A=R("./src/demux/mp3demuxer.ts"),p=R("./src/remux/mp4-remuxer.ts"),b=R("./src/remux/passthrough-remuxer.ts"),M=R("./src/demux/chunk-cache.ts"),L=R("./src/utils/mp4-tools.ts"),C=R("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(T){C.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var h=[{demux:P.default,remux:p.default},{demux:B.default,remux:b.default},{demux:j.default,remux:p.default},{demux:A.default,remux:p.default}],o=1024;h.forEach(function(T){var g=T.demux;o=Math.max(o,g.minProbeByteLength)});var l=function(){function T(c,u,a,S,x){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=u,this.config=a,this.vendor=S,this.id=x}var g=T.prototype;return g.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},g.push=function(u,a,S,x){var v=this,O=S.transmuxing;O.executeStart=E();var F=new Uint8Array(u),W=this.cache,V=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;x&&(this.currentTransmuxState=x);var X=d(F,a);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(V.enableSoftwareAES){var ae=q.softwareDecrypt(F,X.key.buffer,X.iv.buffer);if(!ae)return O.executeEnd=E(),w(S);F=new Uint8Array(ae)}else return this.decryptionPromise=q.webCryptoDecrypt(F,X.key.buffer,X.iv.buffer).then(function(Pe){var Be=v.push(Pe,null,S);return v.decryptionPromise=null,Be}),this.decryptionPromise}var de=x||I,Ae=de.contiguous,be=de.discontinuity,Ce=de.trackSwitch,Te=de.accurateTimeOffset,Se=de.timeOffset,pe=N.audioCodec,ue=N.videoCodec,te=N.defaultInitPts,fe=N.duration,oe=N.initSegmentData;if((be||Ce)&&this.resetInitSegment(oe,pe,ue,fe),be&&this.resetInitialTimestamp(te),Ae||this.resetContiguity(),this.needsProbing(F,be,Ce)){if(W.dataLength){var Le=W.flush();F=Object(L.appendUint8Array)(Le,F)}this.configureTransmuxer(F,N)}var _e=this.transmux(F,X,Se,Te,S),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,O.executeEnd=E(),_e},g.flush=function(u){var a=this,S=u.transmuxing;S.executeStart=E();var x=this.decrypter,v=this.cache,O=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(u)});var W=[],V=O.timeOffset;if(x){var I=x.flush();I&&W.push(this.push(I,null,u))}var N=v.dataLength;v.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return N>=o&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),S.executeEnd=E(),[w(u)];var ae=X.flush(V);return f(ae)?ae.then(function(de){return a.flushRemux(W,de,u),W}):(this.flushRemux(W,ae,u),W)},g.flushRemux=function(u,a,S){var x=a.audioTrack,v=a.avcTrack,O=a.id3Track,F=a.textTrack,W=this.currentTransmuxState,V=W.accurateTimeOffset,I=W.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+S.sn+(S.part>-1?" p: "+S.part:"")+" of level "+S.level);var N=this.remuxer.remux(x,v,O,F,I,V,!0,this.id);u.push({remuxResult:N,chunkMeta:S}),S.transmuxing.executeEnd=E()},g.resetInitialTimestamp=function(u){var a=this.demuxer,S=this.remuxer;if(!a||!S)return;a.resetTimeStamp(u),S.resetTimeStamp(u)},g.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},g.resetInitSegment=function(u,a,S,x){var v=this.demuxer,O=this.remuxer;if(!v||!O)return;v.resetInitSegment(a,S,x),O.resetInitSegment(u,a,S)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(u,a,S,x,v){var O;return a&&a.method==="SAMPLE-AES"?O=this.transmuxSampleAes(u,a,S,x,v):O=this.transmuxUnencrypted(u,S,x,v),O},g.transmuxUnencrypted=function(u,a,S,x){var v=this.demuxer.demux(u,a,!1,!this.config.progressive),O=v.audioTrack,F=v.avcTrack,W=v.id3Track,V=v.textTrack,I=this.remuxer.remux(O,F,W,V,a,S,!1,this.id);return{remuxResult:I,chunkMeta:x}},g.transmuxSampleAes=function(u,a,S,x,v){var O=this;return this.demuxer.demuxSampleAes(u,a,S).then(function(F){var W=O.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,S,x,!1,O.id);return{remuxResult:W,chunkMeta:v}})},g.configureTransmuxer=function(u,a){for(var S=this.config,x=this.observer,v=this.typeSupported,O=this.vendor,F=a.audioCodec,W=a.defaultInitPts,V=a.duration,I=a.initSegmentData,N=a.videoCodec,X,q=0,ae=h.length;q<ae;q++)if(h[q].demux.probe(u)){X=h[q];break}X||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:B.default,remux:b.default});var de=this.demuxer,Ae=this.remuxer,be=X.remux,Ce=X.demux;(!Ae||!(Ae instanceof be))&&(this.remuxer=new be(x,S,v,O)),(!de||!(de instanceof Ce))&&(this.demuxer=new Ce(x,S,v),this.probe=Ce.probe),this.resetInitSegment(I,F,N,V),this.resetInitialTimestamp(W)},g.needsProbing=function(u,a,S){return!this.demuxer||!this.remuxer||a||S},g.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new _.default(this.observer,this.config)),u},T}();function d(T,g){var c=null;return T.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var w=function(g){return{remuxResult:{},chunkMeta:g}};function f(T){return"then"in T&&T.then instanceof Function}var y=function(g,c,u,a,S){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=S},D=function(g,c,u,a,S){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=S}},"./src/demux/tsdemuxer.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"discardEPB",function(){return w});var Y=R("./src/demux/adts.ts"),U=R("./src/demux/mpegaudio.ts"),_=R("./src/demux/exp-golomb.ts"),j=R("./src/demux/id3.ts"),B=R("./src/demux/sample-aes.ts"),P=R("./src/events.ts"),A=R("./src/utils/mp4-tools.ts"),p=R("./src/utils/logger.ts"),b=R("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},L=function(){function f(D,T,g){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=D,this.config=T,this.typeSupported=g}f.probe=function(T){var g=f.syncOffset(T);return g<0?!1:(g&&p.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},f.syncOffset=function(T){for(var g=Math.min(1e3,T.length-3*188),c=0;c<g;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},f.createTrack=function(T,g){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:M[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?g:void 0}};var y=f.prototype;return y.resetInitSegment=function(T,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=g,this._duration=c},y.resetTimeStamp=function(){},y.resetContiguity=function(){var T=this._audioTrack,g=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},y.demux=function(T,g,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,S=this._avcTrack,x=this._audioTrack,v=this._id3Track,O=S.pid,F=S.pesData,W=x.pid,V=v.pid,I=x.pesData,N=v.pesData,X=!1,q=this.pmtParsed,ae=this._pmtId,de=T.length;if(this.remainderData&&(T=Object(A.appendUint8Array)(this.remainderData,T),de=T.length,this.remainderData=null),de<188&&!u)return this.remainderData=T,{audioTrack:x,avcTrack:S,id3Track:v,textTrack:this._txtTrack};var Ae=Math.max(0,f.syncOffset(T));de-=(de+Ae)%188,de<T.byteLength&&!u&&(this.remainderData=new Uint8Array(T.buffer,de,T.buffer.byteLength-de));for(var be=Ae;be<de;be+=188)if(T[be]===71){var Ce=!!(T[be+1]&64),Te=((T[be+1]&31)<<8)+T[be+2],Se=(T[be+3]&48)>>4,pe=void 0;if(Se>1){if(pe=be+5+T[be+4],pe===be+188)continue}else pe=be+4;switch(Te){case O:Ce&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(T.subarray(pe,be+188)),F.size+=be+188-pe);break;case W:Ce&&(I&&(a=o(I))&&(x.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),I={data:[],size:0}),I&&(I.data.push(T.subarray(pe,be+188)),I.size+=be+188-pe);break;case V:Ce&&(N&&(a=o(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(T.subarray(pe,be+188)),N.size+=be+188-pe);break;case 0:Ce&&(pe+=T[pe]+1),ae=this._pmtId=E(T,pe);break;case ae:{Ce&&(pe+=T[pe]+1);var ue=h(T,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);O=ue.avc,O>0&&(S.pid=O),W=ue.audio,W>0&&(x.pid=W,x.isAAC=ue.isAAC),V=ue.id3,V>0&&(v.pid=V),X&&!q&&(p.logger.log("reparse from beginning"),X=!1,be=Ae-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});S.pesData=F,x.pesData=I,v.pesData=N;var te={audioTrack:x,avcTrack:S,id3Track:v,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(te),te},y.flush=function(){var T=this.remainderData;this.remainderData=null;var g;return T?g=this.demux(T,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},y.extractRemainingSamples=function(T){var g=T.audioTrack,c=T.avcTrack,u=T.id3Track,a=c.pesData,S=g.pesData,x=u.pesData,v;a&&(v=o(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,S&&(v=o(S))?(g.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),g.pesData=null):(S!=null&&S.size&&p.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=S),x&&(v=o(x))?(this.parseID3PES(v),u.pesData=null):u.pesData=x},y.demuxSampleAes=function(T,g,c){var u=this.demux(T,c,!0,!this.config.progressive),a=this.sampleAes=new B.default(this.observer,this.config,g);return this.decrypt(u,a)},y.decrypt=function(T,g){return new Promise(function(c){var u=T.audioTrack,a=T.avcTrack;u.samples&&u.isAAC?g.decryptAacSamples(u.samples,0,function(){a.samples?g.decryptAvcSamples(a.samples,0,0,function(){c(T)}):c(T)}):a.samples&&g.decryptAvcSamples(a.samples,0,0,function(){c(T)})})},y.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},y.parseAVCPES=function(T,g){var c=this,u=this._avcTrack,a=this.parseAVCNALu(T.data),S=!1,x=this.avcSample,v,O=!1;T.data=null,x&&a.length&&!u.audFound&&(l(x,u),x=this.avcSample=C(!1,T.pts,T.dts,"")),a.forEach(function(F){switch(F.type){case 1:{v=!0,x||(x=c.avcSample=C(!0,T.pts,T.dts,"")),S&&(x.debug+="NDR "),x.frame=!0;var W=F.data;if(O&&W.length>4){var V=new _.default(W).readSliceType();(V===2||V===4||V===7||V===9)&&(x.key=!0)}break}case 5:v=!0,x||(x=c.avcSample=C(!0,T.pts,T.dts,"")),S&&(x.debug+="IDR "),x.key=!0,x.frame=!0;break;case 6:{v=!0,S&&x&&(x.debug+="SEI ");var I=new _.default(w(F.data));I.readUByte();for(var N=0,X=0,q=!1,ae=0;!q&&I.bytesAvailable>1;){N=0;do ae=I.readUByte(),N+=ae;while(ae===255);X=0;do ae=I.readUByte(),X+=ae;while(ae===255);if(N===4&&I.bytesAvailable!==0){q=!0;var de=I.readUByte();if(de===181){var Ae=I.readUShort();if(Ae===49){var be=I.readUInt();if(be===1195456820){var Ce=I.readUByte();if(Ce===3){for(var Te=I.readUByte(),Se=I.readUByte(),pe=31&Te,ue=[Te,Se],te=0;te<pe;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());d(c._txtTrack.samples,{type:3,pts:T.pts,bytes:ue})}}}}}else if(N===5&&I.bytesAvailable!==0){if(q=!0,X>16){for(var fe=[],oe=0;oe<16;oe++)fe.push(I.readUByte().toString(16)),(oe===3||oe===5||oe===7||oe===9)&&fe.push("-");for(var Le=X-16,_e=new Uint8Array(Le),Ee=0;Ee<Le;Ee++)_e[Ee]=I.readUByte();d(c._txtTrack.samples,{pts:T.pts,payloadType:N,uuid:fe.join(""),userData:Object(j.utf8ArrayToStr)(_e),userDataBytes:_e})}}else if(X<I.bytesAvailable)for(var Pe=0;Pe<X;Pe++)I.readUByte()}break}case 7:if(v=!0,O=!0,S&&x&&(x.debug+="SPS "),!u.sps){var Be=new _.default(F.data),Ve=Be.readSPS();u.width=Ve.width,u.height=Ve.height,u.pixelRatio=Ve.pixelRatio,u.sps=[F.data],u.duration=c._duration;for(var We=F.data.subarray(1,4),Fe="avc1.",Ue=0;Ue<3;Ue++){var st=We[Ue].toString(16);st.length<2&&(st="0"+st),Fe+=st}u.codec=Fe}break;case 8:v=!0,S&&x&&(x.debug+="PPS "),u.pps||(u.pps=[F.data]);break;case 9:v=!1,u.audFound=!0,x&&l(x,u),x=c.avcSample=C(!1,T.pts,T.dts,S?"AUD ":"");break;case 12:v=!1;break;default:v=!1,x&&(x.debug+="unknown NAL "+F.type+" ");break}if(x&&v){var ot=x.units;ot.push(F)}}),g&&x&&(l(x,u),this.avcSample=null)},y.getLastNalUnit=function(){var T,g=this.avcSample,c;if(!g||g.units.length===0){var u=this._avcTrack.samples;g=u[u.length-1]}if((T=g)!==null&&T!==void 0&&T.units){var a=g.units;c=a[a.length-1]}return c},y.parseAVCNALu=function(T){var g=T.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,S=[],x=0,v,O,F,W=-1,V=0;for(u===-1&&(W=0,V=T[0]&31,u=0,x=1);x<g;){if(v=T[x++],!u){u=v?0:1;continue}if(u===1){u=v?0:2;continue}if(!v)u=3;else if(v===1){if(W>=0){var I={data:T.subarray(W,x-u-1),type:V};S.push(I)}else{var N=this.getLastNalUnit();if(N&&(a&&x<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),O=x-u-1,O>0)){var X=new Uint8Array(N.data.byteLength+O);X.set(N.data,0),X.set(T.subarray(0,O),N.data.byteLength),N.data=X,N.state=0}}x<g?(F=T[x]&31,W=x,V=F,u=0):u=-1}else u=0}if(W>=0&&u>=0){var q={data:T.subarray(W,g),type:V,state:u};S.push(q)}if(S.length===0){var ae=this.getLastNalUnit();if(ae){var de=new Uint8Array(ae.data.byteLength+T.byteLength);de.set(ae.data,0),de.set(T,ae.data.byteLength),ae.data=de}}return c.naluState=u,S},y.parseAACPES=function(T){var g=0,c=this._audioTrack,u=this.aacOverFlow,a=T.data;if(u){this.aacOverFlow=null;var S=u.sample.unit.byteLength,x=Math.min(u.missing,S),v=S-x;u.sample.unit.set(a.subarray(0,x),v),c.samples.push(u.sample),g=u.missing}var O,F;for(O=g,F=a.length;O<F-1&&!Y.isHeader(a,O);O++);if(O!==g){var W,V;if(O<F-1?(W="AAC PES did not start with ADTS header,offset:"+O,V=!1):(W="no ADTS header found in AAC PES",V=!0),p.logger.warn("parsing error:"+W),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:W}),V)return}Y.initTrackConfig(c,this.observer,a,O,this.audioCodec);var I;if(T.pts!==void 0)I=T.pts;else if(u){var N=Y.getFrameDuration(c.samplerate);I=u.sample.pts+N}else{p.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;O<F;)if(Y.isHeader(a,O)){if(O+5<F){var q=Y.appendFrame(c,a,O,I,X);if(q)if(q.missing)this.aacOverFlow=q;else{O+=q.length,X++;continue}}break}else O++},y.parseMPEGPES=function(T){var g=T.data,c=g.length,u=0,a=0,S=T.pts;if(S===void 0){p.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(U.isHeader(g,a)){var x=U.appendFrame(this._audioTrack,g,a,S,u);if(x)a+=x.length,u++;else break}else a++},y.parseID3PES=function(T){if(T.pts===void 0){p.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},f}();L.minProbeByteLength=188;function C(f,y,D,T){return{key:f,frame:!1,pts:y,dts:D,units:[],debug:T,length:0}}function E(f,y){return(f[y+10]&31)<<8|f[y+11]}function h(f,y,D,T){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[y+1]&15)<<8|f[y+2],u=y+3+c-4,a=(f[y+10]&15)<<8|f[y+11];for(y+=12+a;y<u;){var S=(f[y+1]&31)<<8|f[y+2];switch(f[y]){case 207:if(!T){p.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=S);break;case 21:g.id3===-1&&(g.id3=S);break;case 219:if(!T){p.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=S);break;case 3:case 4:D?g.audio===-1&&(g.audio=S,g.isAAC=!1):p.logger.log("MPEG audio found, not supported in this browser");break;case 36:p.logger.warn("Unsupported HEVC stream type found");break;default:break}y+=((f[y+3]&15)<<8|f[y+4])+5}return g}function o(f){var y=0,D,T,g,c,u,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var S=new Uint8Array(a[0].length+a[1].length);S.set(a[0]),S.set(a[1],a[0].length),a[0]=S,a.splice(1,1)}D=a[0];var x=(D[0]<<16)+(D[1]<<8)+D[2];if(x===1){if(T=(D[4]<<8)+D[5],T&&T>f.size-6)return null;var v=D[7];v&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,v&64?(u=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-u>60*9e4&&(p.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),g=D[8];var O=g+9;if(f.size<=O)return null;f.size-=O;for(var F=new Uint8Array(f.size),W=0,V=a.length;W<V;W++){D=a[W];var I=D.byteLength;if(O)if(O>I){O-=I;continue}else D=D.subarray(O),I-=O,O=0;F.set(D,y),y+=I}return T&&(T-=g+3),{data:F,pts:c,dts:u,len:T}}return null}function l(f,y){if(f.units.length&&f.frame){if(f.pts===void 0){var D=y.samples,T=D.length;if(T){var g=D[T-1];f.pts=g.pts,f.dts=g.dts}else{y.dropped++;return}}y.samples.push(f)}f.debug.length&&p.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function d(f,y){var D=f.length;if(D>0){if(y.pts>=f[D-1].pts)f.push(y);else for(var T=D-1;T>=0;T--)if(y.pts<f[T].pts){f.splice(T,0,y);break}}else f.push(y)}function w(f){for(var y=f.byteLength,D=[],T=1;T<y-2;)f[T]===0&&f[T+1]===0&&f[T+2]===3?(D.push(T+2),T+=2):T++;if(D.length===0)return f;var g=y-D.length,c=new Uint8Array(g),u=0;for(T=0;T<g;u++,T++)u===D[0]&&(u++,D.shift()),c[T]=f[u];return c}Q.default=L},"./src/errors.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"ErrorTypes",function(){return Y}),R.d(Q,"ErrorDetails",function(){return U});var Y;(function(_){_.NETWORK_ERROR="networkError",_.MEDIA_ERROR="mediaError",_.KEY_SYSTEM_ERROR="keySystemError",_.MUX_ERROR="muxError",_.OTHER_ERROR="otherError"})(Y||(Y={}));var U;(function(_){_.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",_.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",_.KEY_SYSTEM_NO_SESSION="keySystemNoSession",_.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",_.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",_.MANIFEST_LOAD_ERROR="manifestLoadError",_.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",_.MANIFEST_PARSING_ERROR="manifestParsingError",_.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",_.LEVEL_EMPTY_ERROR="levelEmptyError",_.LEVEL_LOAD_ERROR="levelLoadError",_.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",_.LEVEL_SWITCH_ERROR="levelSwitchError",_.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",_.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",_.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",_.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",_.FRAG_LOAD_ERROR="fragLoadError",_.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",_.FRAG_DECRYPT_ERROR="fragDecryptError",_.FRAG_PARSING_ERROR="fragParsingError",_.REMUX_ALLOC_ERROR="remuxAllocError",_.KEY_LOAD_ERROR="keyLoadError",_.KEY_LOAD_TIMEOUT="keyLoadTimeOut",_.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",_.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",_.BUFFER_APPEND_ERROR="bufferAppendError",_.BUFFER_APPENDING_ERROR="bufferAppendingError",_.BUFFER_STALLED_ERROR="bufferStalledError",_.BUFFER_FULL_ERROR="bufferFullError",_.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",_.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",_.INTERNAL_EXCEPTION="internalException",_.INTERNAL_ABORTED="aborted",_.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"Events",function(){return Y});var Y;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return f});var Y=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Y),_=R("./src/loader/playlist-loader.ts"),j=R("./src/loader/key-loader.ts"),B=R("./src/controller/id3-track-controller.ts"),P=R("./src/controller/latency-controller.ts"),A=R("./src/controller/level-controller.ts"),p=R("./src/controller/fragment-tracker.ts"),b=R("./src/controller/stream-controller.ts"),M=R("./src/is-supported.ts"),L=R("./src/utils/logger.ts"),C=R("./src/config.ts"),E=R("./node_modules/eventemitter3/index.js"),h=R.n(E),o=R("./src/events.ts"),l=R("./src/errors.ts");function d(y,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(y,g.key,g)}}function w(y,D,T){return D&&d(y.prototype,D),T&&d(y,T),y}var f=function(){y.isSupported=function(){return Object(M.isSupported)()};function y(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var g=this.config=Object(C.mergeConfig)(y.DefaultConfig,T);this.userConfig=T,Object(L.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(C.enableStreamingMode)(g);var c=g.abrController,u=g.bufferController,a=g.capLevelController,S=g.fpsController,x=this.abrController=new c(this),v=this.bufferController=new u(this),O=this.capLevelController=new a(this),F=new S(this),W=new _.default(this),V=new j.default(this),I=new B.default(this),N=this.levelController=new A.default(this),X=new p.FragmentTracker(this),q=this.streamController=new b.default(this,X);O.setStreamController(q),F.setStreamController(q);var ae=[N,q];this.networkControllers=ae;var de=[W,V,x,v,O,F,I,X];this.audioTrackController=this.createController(g.audioTrackController,null,ae),this.createController(g.audioStreamController,X,ae),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,ae),this.createController(g.subtitleStreamController,X,ae),this.createController(g.timelineController,null,de),this.emeController=this.createController(g.emeController,null,de),this.cmcdController=this.createController(g.cmcdController,null,de),this.latencyController=this.createController(P.default,null,de),this.coreComponents=de}var D=y.prototype;return D.createController=function(g,c,u){if(g){var a=c?new g(this,c):new g(this);return u&&u.push(a),a}return null},D.on=function(g,c,u){u===void 0&&(u=this),this._emitter.on(g,c,u)},D.once=function(g,c,u){u===void 0&&(u=this),this._emitter.once(g,c,u)},D.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},D.off=function(g,c,u,a){u===void 0&&(u=this),this._emitter.off(g,c,u,a)},D.listeners=function(g){return this._emitter.listeners(g)},D.emit=function(g,c,u){return this._emitter.emit(g,c,u)},D.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(u){L.logger.error("An internal error happened while handling event "+g+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:u})}return!1},D.listenerCount=function(g){return this._emitter.listenerCount(g)},D.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},D.attachMedia=function(g){L.logger.log("attachMedia"),this._media=g,this.trigger(o.Events.MEDIA_ATTACHING,{media:g})},D.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(g){this.stopLoad();var c=this.media,u=this.url,a=this.url=Y.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:g})},D.startLoad=function(g){g===void 0&&(g=-1),L.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},D.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},D.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){L.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},D.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},w(y,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){L.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){L.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){L.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){L.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){L.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(L.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var u=g.length,a=0;a<u;a++)if(g[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,u;return c===-1&&g&&g.length?u=g.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 y.defaultConfig?y.defaultConfig:C.hlsDefaultConfig},set:function(g){y.defaultConfig=g}}]),y}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"isSupported",function(){return _}),R.d(Q,"changeTypeSupported",function(){return j});var Y=R("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function _(){var B=Object(Y.getMediaSource)();if(!B)return!1;var P=U(),A=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),p=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!A&&!!p}function j(){var B,P=U();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return L}),R.d(Q,"LoadError",function(){return E});var Y=R("./src/polyfills/number.ts"),U=R("./src/errors.ts");function _(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,p(h,o)}function j(h){var o=typeof Map=="function"?new Map:void 0;return j=function(d){if(d===null||!A(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,w)}function w(){return B(d,arguments,b(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),p(w,d)},j(h)}function B(h,o,l){return P()?B=Reflect.construct:B=function(w,f,y){var D=[null];D.push.apply(D,f);var T=Function.bind.apply(w,D),g=new T;return y&&p(g,y.prototype),g},B.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function A(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function p(h,o){return p=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},p(h,o)}function b(h){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},b(h)}var M=Math.pow(2,17),L=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,w){var f=this,y=d.url;if(!y)return Promise.reject(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(y?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=d.loader=T?new T(D):new g(D),S=C(d),x={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};d.stats=a.stats,a.load(S,x,{onSuccess:function(O,F,W,V){f.resetLoader(d,a),c({frag:d,part:null,payload:O.data,networkDetails:V})},onError:function(O,F,W){f.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:O,networkDetails:W}))},onAbort:function(O,F,W){f.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:W}))},onTimeout:function(O,F,W){f.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:W}))},onProgress:function(O,F,W,V){w&&w({frag:d,part:null,payload:W,networkDetails:V})}})})},o.loadPart=function(d,w,f){var y=this;this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(c,u){y.loader&&y.loader.destroy();var a=y.loader=d.loader=T?new T(D):new g(D),S=C(d,w),x={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};w.stats=a.stats,a.load(S,x,{onSuccess:function(O,F,W,V){y.resetLoader(d,a),y.updateStatsFromPart(d,w);var I={frag:d,part:w,payload:O.data,networkDetails:V};f(I),c(I)},onError:function(O,F,W){y.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:O,networkDetails:W}))},onAbort:function(O,F,W){d.stats.aborted=w.stats.aborted,y.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:W}))},onTimeout:function(O,F,W){y.resetLoader(d,a),u(new E({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:W}))}})})},o.updateStatsFromPart=function(d,w){var f=d.stats,y=w.stats,D=y.total;if(f.loaded+=y.loaded,D){var T=Math.round(d.duration/w.duration),g=Math.min(Math.round(f.loaded/D),T),c=T-g,u=c*Math.round(f.loaded/g);f.total=f.loaded+u}else f.total=Math.max(f.loaded,f.total);var a=f.loading,S=y.loading;a.start?a.first+=S.first-S.start:(a.start=S.start,a.first=S.first),a.end=S.end},o.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},h}();function C(h,o){o===void 0&&(o=null);var l=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,f=l.byteRangeEndOffset;return Object(Y.isFiniteNumber)(w)&&Object(Y.isFiniteNumber)(f)&&(d.rangeStart=w,d.rangeEnd=f),d}var E=function(h){_(o,h);function o(l){for(var d,w=arguments.length,f=new Array(w>1?w-1:0),y=1;y<w;y++)f[y-1]=arguments[y];return d=h.call.apply(h,[this].concat(f))||this,d.data=void 0,d.data=l,d}return o}(j(Error))},"./src/loader/fragment.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"ElementaryStreamTypes",function(){return L}),R.d(Q,"BaseSegment",function(){return C}),R.d(Q,"Fragment",function(){return E}),R.d(Q,"Part",function(){return h});var Y=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),_=R.n(U),j=R("./src/utils/logger.ts"),B=R("./src/loader/level-key.ts"),P=R("./src/loader/load-stats.ts");function A(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,p(o,l)}function p(o,l){return p=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},p(o,l)}function b(o,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function M(o,l,d){return l&&b(o.prototype,l),d&&b(o,d),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var C=function(){function o(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[L.AUDIO]=null,w[L.VIDEO]=null,w[L.AUDIOVIDEO]=null,w),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(w,f){var y=w.split("@",2),D=[];y.length===1?D[0]=f?f.byteRangeEndOffset:0:D[0]=parseInt(y[1]),D[1]=parseInt(y[0])+D[0],this._byteRange=D},M(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),E=function(o){A(l,o);function l(w,f){var y;return y=o.call(this,f)||this,y._decryptdata=null,y.rawProgramDateTime=null,y.programDateTime=null,y.tagList=[],y.duration=0,y.sn=0,y.levelkey=void 0,y.type=void 0,y.loader=null,y.level=-1,y.cc=0,y.startPTS=void 0,y.endPTS=void 0,y.appendedPTS=void 0,y.startDTS=void 0,y.endDTS=void 0,y.start=0,y.deltaPTS=void 0,y.maxStartPTS=void 0,y.minEndPTS=void 0,y.stats=new P.LoadStats,y.urlId=0,y.data=void 0,y.bitrateTest=!1,y.title=null,y.initSegment=null,y.type=w,y}var d=l.prototype;return d.createInitializationVector=function(f){for(var y=new Uint8Array(16),D=12;D<16;D++)y[D]=f>>8*(15-D)&255;return y},d.setDecryptDataFromLevelKey=function(f,y){var D=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(D=B.LevelKey.fromURI(f.uri),D.method=f.method,D.iv=this.createInitializationVector(y),D.keyFormat="identity"),D},d.setElementaryStreamInfo=function(f,y,D,T,g,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[f];if(!a){u[f]={startPTS:y,endPTS:D,startDTS:T,endDTS:g,partial:c};return}a.startPTS=Math.min(a.startPTS,y),a.endPTS=Math.max(a.endPTS,D),a.startDTS=Math.min(a.startDTS,T),a.endDTS=Math.max(a.endDTS,g)},d.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[L.AUDIO]=null,f[L.VIDEO]=null,f[L.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var f=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),l}(C),h=function(o){A(l,o);function l(d,w,f,y,D){var T;T=o.call(this,f)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new P.LoadStats,T.duration=d.decimalFloatingPoint("DURATION"),T.gap=d.bool("GAP"),T.independent=d.bool("INDEPENDENT"),T.relurl=d.enumeratedString("URI"),T.fragment=w,T.index=y;var g=d.enumeratedString("BYTERANGE");return g&&T.setByteRange(g,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(C)},"./src/loader/key-loader.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return j});var Y=R("./src/events.ts"),U=R("./src/errors.ts"),_=R("./src/utils/logger.ts"),j=function(){function B(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var p in this.loaders){var b=this.loaders[p];b&&b.destroy()}this.loaders={}},P.onKeyLoading=function(p,b){var M=b.frag,L=M.type,C=this.loaders[L];if(!M.decryptdata){_.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=M.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(C&&(_.logger.warn("abort previous key loader for type:"+L),C.abort()),!E){_.logger.warn("key uri is falsy");return}var o=h.loader,l=M.loader=this.loaders[L]=new o(h);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:M,responseType:"arraybuffer"},w={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,w,f)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:M}))},P.loadsuccess=function(p,b,M){var L=M.frag;if(!L.decryptdata){_.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(p.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:L})},P.loaderror=function(p,b){var M=b.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:p})},P.loadtimeout=function(p,b){var M=b.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},B}()},"./src/loader/level-details.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"LevelDetails",function(){return B});var Y=R("./src/polyfills/number.ts");function U(P,A){for(var p=0;p<A.length;p++){var b=A[p];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function _(P,A,p){return A&&U(P.prototype,A),p&&U(P,p),P}var j=10,B=function(){function P(p){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=p}var A=P.prototype;return A.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-b.lastPartSn,L=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!L||!!M,this.advanced=this.endSN>b.endSN||M>0||M===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},_(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var M=this.driftEnd-this.driftStart;return M*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"LevelKey",function(){return B});var Y=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Y);function _(P,A){for(var p=0;p<A.length;p++){var b=A[p];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function j(P,A,p){return A&&_(P.prototype,A),p&&_(P,p),P}var B=function(){P.fromURL=function(p,b){return new P(p,b)},P.fromURI=function(p){return new P(p)};function P(A,p){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,p?this._uri=Object(Y.buildAbsoluteURL)(A,p,{alwaysNormalize:!0}):this._uri=A}return j(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"LoadStats",function(){return Y});var Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return l});var Y=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),_=R.n(U),j=R("./src/loader/fragment.ts"),B=R("./src/loader/level-details.ts"),P=R("./src/loader/level-key.ts"),A=R("./src/utils/attr-list.ts"),p=R("./src/utils/logger.ts"),b=R("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(D){var T,g;return h.test((T=(g=U.parseURL(D))===null||g===void 0?void 0:g.path)!=null?T:"")}var l=function(){function D(){}return D.findGroup=function(g,c){for(var u=0;u<g.length;u++){var a=g[u];if(a.id===c)return a}},D.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return g},D.resolve=function(g,c){return U.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(g,c){var u=[],a={},S=!1;M.lastIndex=0;for(var x;(x=M.exec(g))!=null;)if(x[1]){var v=new A.AttrList(x[1]),O={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:D.resolve(x[2],c)},F=v.decimalResolution("RESOLUTION");F&&(O.width=F.width,O.height=F.height),d((v.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),O),O.videoCodec&&O.videoCodec.indexOf("avc1")!==-1&&(O.videoCodec=D.convertAVC1ToAVCOTI(O.videoCodec)),u.push(O)}else if(x[3]){var W=new A.AttrList(x[3]);W["DATA-ID"]&&(S=!0,a[W["DATA-ID"]]=W)}return{levels:u,sessionData:S?a:null}},D.parseMasterPlaylistMedia=function(g,c,u,a){a===void 0&&(a=[]);var S,x=[],v=0;for(L.lastIndex=0;(S=L.exec(g))!==null;){var O=new A.AttrList(S[1]);if(O.TYPE===u){var F={attrs:O,bitrate:0,id:v++,groupId:O["GROUP-ID"],instreamId:O["INSTREAM-ID"],name:O.NAME||O.LANGUAGE||"",type:u,default:O.bool("DEFAULT"),autoselect:O.bool("AUTOSELECT"),forced:O.bool("FORCED"),lang:O.LANGUAGE,url:O.URI?D.resolve(O.URI,c):""};if(a.length){var W=D.findGroup(a,F.groupId)||a[0];w(F,W,"audioCodec"),w(F,W,"textCodec")}x.push(F)}}return x},D.parseLevelPlaylist=function(g,c,u,a,S){var x=new B.LevelDetails(c),v=x.fragments,O=null,F=0,W=0,V=0,I=0,N=null,X=new j.Fragment(a,c),q,ae,de,Ae=-1,be=!1;for(C.lastIndex=0,x.m3u8=g;(q=C.exec(g))!==null;){be&&(be=!1,X=new j.Fragment(a,c),X.start=V,X.sn=F,X.cc=I,X.level=u,O&&(X.initSegment=O,X.rawProgramDateTime=O.rawProgramDateTime));var Ce=q[1];if(Ce){X.duration=parseFloat(Ce);var Te=(" "+q[2]).slice(1);X.title=Te||null,X.tagList.push(Te?["INF",Ce,Te]:["INF",Ce])}else if(q[3])Object(Y.isFiniteNumber)(X.duration)&&(X.start=V,de&&(X.levelkey=de),X.sn=F,X.level=u,X.cc=I,X.urlId=S,v.push(X),X.relurl=(" "+q[3]).slice(1),y(X,N),N=X,V+=X.duration,F++,W=0,be=!0);else if(q[4]){var Se=(" "+q[4]).slice(1);N?X.setByteRange(Se,N):X.setByteRange(Se)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ae===-1&&(Ae=v.length);else{if(q=q[0].match(E),!q){p.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<q.length&&!(typeof q[ae]!="undefined");ae++);var pe=(" "+q[ae]).slice(1),ue=(" "+q[ae+1]).slice(1),te=q[ae+2]?(" "+q[ae+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":x.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":F=x.startSN=parseInt(ue);break;case"SKIP":{var fe=new A.AttrList(ue),oe=fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(oe)){x.skippedSegments=oe;for(var Le=oe;Le--;)v.unshift(null);F+=oe}var _e=fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(x.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":x.targetduration=parseFloat(ue);break;case"VERSION":x.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":x.live=!1;break;case"#":(ue||te)&&X.tagList.push(te?[ue,te]:[ue]);break;case"DIS":I++;case"GAP":X.tagList.push([pe]);break;case"BITRATE":X.tagList.push([pe,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var Ee,Pe=new A.AttrList(ue),Be=Pe.enumeratedString("METHOD"),Ve=Pe.URI,We=Pe.hexadecimalInteger("IV"),Fe=Pe.enumeratedString("KEYFORMATVERSIONS"),Ue=Pe.enumeratedString("KEYID"),st=(Ee=Pe.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",ot=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ot.indexOf(st)>-1){p.logger.warn("Keyformat "+st+" is not supported from the manifest");continue}else if(st!=="identity")continue;Be&&(de=P.LevelKey.fromURL(c,Ve),Ve&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Be)>=0&&(de.method=Be,de.keyFormat=st,Ue&&(de.keyID=Ue),Fe&&(de.keyFormatVersions=Fe),de.iv=We));break}case"START":{var it=new A.AttrList(ue),Je=it.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Je)&&(x.startTimeOffset=Je);break}case"MAP":{var rt=new A.AttrList(ue);X.relurl=rt.URI,rt.BYTERANGE&&X.setByteRange(rt.BYTERANGE),X.level=u,X.sn="initSegment",de&&(X.levelkey=de),X.initSegment=null,O=X,be=!0;break}case"SERVER-CONTROL":{var $e=new A.AttrList(ue);x.canBlockReload=$e.bool("CAN-BLOCK-RELOAD"),x.canSkipUntil=$e.optionalFloat("CAN-SKIP-UNTIL",0),x.canSkipDateRanges=x.canSkipUntil>0&&$e.bool("CAN-SKIP-DATERANGES"),x.partHoldBack=$e.optionalFloat("PART-HOLD-BACK",0),x.holdBack=$e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new A.AttrList(ue);x.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=x.partList;Oe||(Oe=x.partList=[]);var ut=W>0?Oe[Oe.length-1]:void 0,at=W++,Ie=new j.Part(new A.AttrList(ue),X,c,at,ut);Oe.push(Ie),X.duration+=Ie.duration;break}case"PRELOAD-HINT":{var He=new A.AttrList(ue);x.preloadHint=He;break}case"RENDITION-REPORT":{var xe=new A.AttrList(ue);x.renditionReports=x.renditionReports||[],x.renditionReports.push(xe);break}default:p.logger.warn("line parsed but not handled: "+q);break}}}N&&!N.relurl?(v.pop(),V-=N.duration,x.partList&&(x.fragmentHint=N)):x.partList&&(y(X,N),X.cc=I,x.fragmentHint=X);var me=v.length,ye=v[0],re=v[me-1];if(V+=x.skippedSegments*x.targetduration,V>0&&me&&re){x.averagetargetduration=V/me;var ne=re.sn;x.endSN=ne!=="initSegment"?ne:0,ye&&(x.startCC=ye.cc,ye.initSegment||x.fragments.every(function(le){return le.relurl&&o(le.relurl)})&&(p.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new j.Fragment(a,c),X.relurl=re.relurl,X.level=u,X.sn="initSegment",ye.initSegment=X,x.needSidxRanges=!0))}else x.endSN=0,x.startCC=0;return x.fragmentHint&&(V+=x.fragmentHint.duration),x.totalduration=V,x.endCC=I,Ae>0&&f(v,Ae),x},D}();function d(D,T){["video","audio","text"].forEach(function(g){var c=D.filter(function(a){return Object(b.isCodecType)(a,g)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});T[g+"Codec"]=u.length>0?u[0]:c[0],D=D.filter(function(a){return c.indexOf(a)===-1})}}),T.unknownCodecs=D}function w(D,T,g){var c=T[g];c&&(D[g]=c)}function f(D,T){for(var g=D[T],c=T;c--;){var u=D[c];if(!u)return;u.programDateTime=g.programDateTime-u.duration*1e3,g=u}}function y(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(Y.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),_=R("./src/errors.ts"),j=R("./src/utils/logger.ts"),B=R("./src/utils/mp4-tools.ts"),P=R("./src/loader/m3u8-parser.ts"),A=R("./src/types/loader.ts"),p=R("./src/utils/attr-list.ts");function b(C){var E=C.type;switch(E){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function M(C,E){var h=C.url;return(h===void 0||h.indexOf("data:")===0)&&(h=E.url),h}var L=function(){function C(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var E=C.prototype;return E.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)},E.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)},E.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,w=l.loader,f=d||w,y=new f(l);return o.loader=y,this.loaders[o.type]=y,y},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,l){var d=l.id,w=l.level,f=l.url,y=l.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:A.PlaylistContextType.LEVEL,url:f,deliveryDirectives:y})},E.onAudioTrackLoading=function(o,l){var d=l.id,w=l.groupId,f=l.url,y=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:y})},E.onSubtitleTrackLoading=function(o,l){var d=l.id,w=l.groupId,f=l.url,y=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:y})},E.load=function(o){var l,d=this.hls.config,w=this.getInternalLoader(o);if(w){var f=w.context;if(f&&f.url===o.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var y,D,T,g;switch(o.type){case A.PlaylistContextType.MANIFEST:y=d.manifestLoadingMaxRetry,D=d.manifestLoadingTimeOut,T=d.manifestLoadingRetryDelay,g=d.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:y=0,D=d.levelLoadingTimeOut;break;default:y=d.levelLoadingMaxRetry,D=d.levelLoadingTimeOut,T=d.levelLoadingRetryDelay,g=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===A.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===A.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===A.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(D=Math.min(Math.max(u*3,a*.8)*1e3,D))}}var S={timeout:D,maxRetry:y,retryDelay:T,maxRetryDelay:g,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,S,x)},E.loadsuccess=function(o,l,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,w);return}this.resetInternalLoader(d.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,w):this.handleMasterPlaylist(o,l,d,w)},E.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},E.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},E.handleMasterPlaylist=function(o,l,d,w){var f=this.hls,y=o.data,D=M(o,d),T=P.default.parseMasterPlaylist(y,D),g=T.levels,c=T.sessionData;if(!g.length){this.handleManifestParsingError(o,d,"no level found in manifest",w);return}var u=g.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=g.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),S=P.default.parseMasterPlaylistMedia(y,D,"AUDIO",u),x=P.default.parseMasterPlaylistMedia(y,D,"SUBTITLES",a),v=P.default.parseMasterPlaylistMedia(y,D,"CLOSED-CAPTIONS");if(S.length){var O=S.some(function(F){return!F.url});!O&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),S.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new p.AttrList({}),bitrate:0,url:""}))}f.trigger(U.Events.MANIFEST_LOADED,{levels:g,audioTracks:S,subtitles:x,captions:v,url:D,stats:l,networkDetails:w,sessionData:c})},E.handleTrackOrLevelPlaylist=function(o,l,d,w){var f=this.hls,y=d.id,D=d.level,T=d.type,g=M(o,d),c=Object(Y.isFiniteNumber)(y)?y:0,u=Object(Y.isFiniteNumber)(D)?D:c,a=b(d),S=P.default.parseLevelPlaylist(o.data,g,u,a,c);if(!S.fragments.length){f.trigger(U.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(T===A.PlaylistContextType.MANIFEST){var x={attrs:new p.AttrList({}),bitrate:0,details:S,name:"",url:g};f.trigger(U.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:g,stats:l,networkDetails:w,sessionData:null})}if(l.parsing.end=performance.now(),S.needSidxRanges){var v,O=(v=S.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:O,isSidxRequest:!0,type:T,level:D,levelDetails:S,id:y,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=S,this.handlePlaylistLoaded(o,l,d,w)},E.handleSidxRequest=function(o,l){var d=Object(B.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var w=d.references,f=l.levelDetails;w.forEach(function(y,D){var T=y.info,g=f.fragments[D];g.byteRange.length===0&&g.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),g.initSegment&&g.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,l,d,w){this.hls.trigger(U.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===A.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:w})},E.handleNetworkError=function(o,l,d,w){d===void 0&&(d=!1),j.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=_.ErrorDetails.UNKNOWN,y=!1,D=this.getInternalLoader(o);switch(o.type){case A.PlaylistContextType.MANIFEST:f=d?_.ErrorDetails.MANIFEST_LOAD_TIMEOUT:_.ErrorDetails.MANIFEST_LOAD_ERROR,y=!0;break;case A.PlaylistContextType.LEVEL:f=d?_.ErrorDetails.LEVEL_LOAD_TIMEOUT:_.ErrorDetails.LEVEL_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.AUDIO_TRACK:f=d?_.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:_.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:f=d?_.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:_.ErrorDetails.SUBTITLE_LOAD_ERROR,y=!1;break}D&&this.resetInternalLoader(o.type);var T={type:_.ErrorTypes.NETWORK_ERROR,details:f,fatal:y,url:o.url,loader:D,context:o,networkDetails:l};w&&(T.response=w),this.hls.trigger(U.Events.ERROR,T)},E.handlePlaylistLoaded=function(o,l,d,w){var f=d.type,y=d.level,D=d.id,T=d.groupId,g=d.loader,c=d.levelDetails,u=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",w);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:y||0,id:D||0,stats:l,networkDetails:w,deliveryDirectives:u});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:l,networkDetails:w,deliveryDirectives:u});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:T||"",stats:l,networkDetails:w,deliveryDirectives:u});break}},C}();Q.default=L},"./src/polyfills/number.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"isFiniteNumber",function(){return Y}),R.d(Q,"MAX_SAFE_INTEGER",function(){return U});var Y=Number.isFinite||function(_){return typeof _=="number"&&isFinite(_)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=function(){function U(){}return U.getSilentFrame=function(j,B){switch(j){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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}();Q.default=Y},"./src/remux/mp4-generator.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=Math.pow(2,32)-1,U=function(){function _(){}return _.init=function(){_.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 B;for(B in _.types)_.types.hasOwnProperty(B)&&(_.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=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]),A=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]);_.HDLR_TYPES={video:P,audio:A};var p=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);_.STTS=_.STSC=_.STCO=b,_.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),_.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),_.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),_.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]),C=new Uint8Array([0,0,0,1]);_.FTYP=_.box(_.types.ftyp,M,C,M,L),_.DINF=_.box(_.types.dinf,_.box(_.types.dref,p))},_.box=function(B){for(var P=8,A=arguments.length,p=new Array(A>1?A-1:0),b=1;b<A;b++)p[b-1]=arguments[b];for(var M=p.length,L=M;M--;)P+=p[M].byteLength;var C=new Uint8Array(P);for(C[0]=P>>24&255,C[1]=P>>16&255,C[2]=P>>8&255,C[3]=P&255,C.set(B,4),M=0,P=8;M<L;M++)C.set(p[M],P),P+=p[M].byteLength;return C},_.hdlr=function(B){return _.box(_.types.hdlr,_.HDLR_TYPES[B])},_.mdat=function(B){return _.box(_.types.mdat,B)},_.mdhd=function(B,P){P*=B;var A=Math.floor(P/(Y+1)),p=Math.floor(P%(Y+1));return _.box(_.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,p>>24,p>>16&255,p>>8&255,p&255,85,196,0,0]))},_.mdia=function(B){return _.box(_.types.mdia,_.mdhd(B.timescale,B.duration),_.hdlr(B.type),_.minf(B))},_.mfhd=function(B){return _.box(_.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},_.minf=function(B){return B.type==="audio"?_.box(_.types.minf,_.box(_.types.smhd,_.SMHD),_.DINF,_.stbl(B)):_.box(_.types.minf,_.box(_.types.vmhd,_.VMHD),_.DINF,_.stbl(B))},_.moof=function(B,P,A){return _.box(_.types.moof,_.mfhd(B),_.traf(A,P))},_.moov=function(B){for(var P=B.length,A=[];P--;)A[P]=_.trak(B[P]);return _.box.apply(null,[_.types.moov,_.mvhd(B[0].timescale,B[0].duration)].concat(A).concat(_.mvex(B)))},_.mvex=function(B){for(var P=B.length,A=[];P--;)A[P]=_.trex(B[P]);return _.box.apply(null,[_.types.mvex].concat(A))},_.mvhd=function(B,P){P*=B;var A=Math.floor(P/(Y+1)),p=Math.floor(P%(Y+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,p>>24,p>>16&255,p>>8&255,p&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 _.box(_.types.mvhd,b)},_.sdtp=function(B){var P=B.samples||[],A=new Uint8Array(4+P.length),p,b;for(p=0;p<P.length;p++)b=P[p].flags,A[p+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return _.box(_.types.sdtp,A)},_.stbl=function(B){return _.box(_.types.stbl,_.stsd(B),_.box(_.types.stts,_.STTS),_.box(_.types.stsc,_.STSC),_.box(_.types.stsz,_.STSZ),_.box(_.types.stco,_.STCO))},_.avc1=function(B){var P=[],A=[],p,b,M;for(p=0;p<B.sps.length;p++)b=B.sps[p],M=b.byteLength,P.push(M>>>8&255),P.push(M&255),P=P.concat(Array.prototype.slice.call(b));for(p=0;p<B.pps.length;p++)b=B.pps[p],M=b.byteLength,A.push(M>>>8&255),A.push(M&255),A=A.concat(Array.prototype.slice.call(b));var L=_.box(_.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(A))),C=B.width,E=B.height,h=B.pixelRatio[0],o=B.pixelRatio[1];return _.box(_.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,C>>8&255,C&255,E>>8&255,E&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),L,_.box(_.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),_.box(_.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},_.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},_.mp4a=function(B){var P=B.samplerate;return _.box(_.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),_.box(_.types.esds,_.esds(B)))},_.mp3=function(B){var P=B.samplerate;return _.box(_.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},_.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?_.box(_.types.stsd,_.STSD,_.mp3(B)):_.box(_.types.stsd,_.STSD,_.mp4a(B)):_.box(_.types.stsd,_.STSD,_.avc1(B))},_.tkhd=function(B){var P=B.id,A=B.duration*B.timescale,p=B.width,b=B.height,M=Math.floor(A/(Y+1)),L=Math.floor(A%(Y+1));return _.box(_.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&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,p>>8&255,p&255,0,0,b>>8&255,b&255,0,0]))},_.traf=function(B,P){var A=_.sdtp(B),p=B.id,b=Math.floor(P/(Y+1)),M=Math.floor(P%(Y+1));return _.box(_.types.traf,_.box(_.types.tfhd,new Uint8Array([0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255])),_.box(_.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,M>>24,M>>16&255,M>>8&255,M&255])),_.trun(B,A.length+16+20+8+16+8+8),A)},_.trak=function(B){return B.duration=B.duration||4294967295,_.box(_.types.trak,_.tkhd(B),_.mdia(B))},_.trex=function(B){var P=B.id;return _.box(_.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},_.trun=function(B,P){var A=B.samples||[],p=A.length,b=12+16*p,M=new Uint8Array(b),L,C,E,h,o,l;for(P+=8+b,M.set([0,0,15,1,p>>>24&255,p>>>16&255,p>>>8&255,p&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),L=0;L<p;L++)C=A[L],E=C.duration,h=C.size,o=C.flags,l=C.cts,M.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return _.box(_.types.trun,M)},_.initSegment=function(B){_.types||_.init();var P=_.moov(B),A=new Uint8Array(_.FTYP.byteLength+P.byteLength);return A.set(_.FTYP),A.set(P,_.FTYP.byteLength),A},_}();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,Q.default=U},"./src/remux/mp4-remuxer.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return l}),R.d(Q,"normalizePts",function(){return d});var Y=R("./src/polyfills/number.ts"),U=R("./src/remux/aac-helper.ts"),_=R("./src/remux/mp4-generator.ts"),j=R("./src/events.ts"),B=R("./src/errors.ts"),P=R("./src/utils/logger.ts"),A=R("./src/types/loader.ts"),p=R("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},b.apply(this,arguments)}var M=10*1e3,L=1024,C=1152,E=null,h=null,o=!1,l=function(){function D(g,c,u,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=g,this.config=c,this.typeSupported=u,this.ISGenerated=!1,E===null){var S=navigator.userAgent||"",x=S.match(/Chrome\/(\d+)/i);E=x?parseInt(x[1]):0}if(h===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);h=v?parseInt(v[1]):0}o=!!E&&E<75||!!h&&h<600}var T=D.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(S,x){var v=x.pts-S;return v<-4294967296?(u=!0,d(S,x.pts)):v>0?S:x.pts},c[0].pts);return u&&P.logger.debug("PTS rollover detected"),a},T.remux=function(c,u,a,S,x,v,O,F){var W,V,I,N,X,q,ae=x,de=x,Ae=c.pid>-1,be=u.pid>-1,Ce=u.samples.length,Te=c.samples.length>0,Se=Ce>1,pe=(!Ae||Te)&&(!be||Se)||this.ISGenerated||O;if(pe){this.ISGenerated||(I=this.generateIS(c,u,x));var ue=this.isVideoContiguous,te=-1;if(Se&&(te=w(u.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,te>0){P.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ce+" video samples due to a missing keyframe");var fe=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(te),u.dropped+=te,de+=(u.samples[0].pts-fe)/(u.timescale||9e4)}else te===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),q=!1);if(this.ISGenerated){if(Te&&Se){var oe=this.getVideoStartPts(u.samples),Le=d(c.samples[0].pts,oe)-oe,_e=Le/u.inputTimeScale;ae+=Math.max(0,_e),de+=Math.max(0,-_e)}if(Te){if(c.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(c,u,x)),V=this.remuxAudio(c,ae,this.isAudioContiguous,v,be||Se||F===A.PlaylistLevelType.AUDIO?de:void 0),Se){var Ee=V?V.endPTS-V.startPTS:0;u.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(c,u,x)),W=this.remuxVideo(u,de,ue,Ee)}}else Se&&(W=this.remuxVideo(u,de,ue,0));W&&(W.firstKeyFrame=te,W.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&(X=this.remuxID3(a,x)),S.samples.length&&(N=this.remuxText(S,x))),{audio:V,video:W,initSegment:I,independent:q,text:N,id3:X}},T.generateIS=function(c,u,a){var S=c.samples,x=u.samples,v=this.typeSupported,O={},F=!Object(Y.isFiniteNumber)(this._initPTS),W="audio/mp4",V,I,N;if(F&&(V=I=Infinity),c.config&&S.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(W="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),O.audio={id:"audio",container:W,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):_.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(N=c.inputTimeScale,V=I=S[0].pts-Math.round(N*a))),u.sps&&u.pps&&x.length&&(u.timescale=u.inputTimeScale,O.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:_.default.initSegment([u]),metadata:{width:u.width,height:u.height}},F)){N=u.inputTimeScale;var X=this.getVideoStartPts(x),q=Math.round(N*a);I=Math.min(I,d(x[0].dts,X)-q),V=Math.min(V,X-q)}if(Object.keys(O).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=I),{tracks:O,initPTS:V,timescale:N}},T.remuxVideo=function(c,u,a,S){var x=c.inputTimeScale,v=c.samples,O=[],F=v.length,W=this._initPTS,V=this.nextAvcDts,I=8,N,X,q,ae=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Ae=0,be=!1;if(!a||V===null){var Ce=u*x,Te=v[0].pts-d(v[0].dts,v[0].pts);V=Ce-Te}for(var Se=0;Se<F;Se++){var pe=v[Se];if(pe.pts=d(pe.pts-W,V),pe.dts=d(pe.dts-W,V),pe.dts>pe.pts){var ue=9e4*.2;Ae=Math.max(Math.min(Ae,pe.pts-pe.dts),-1*ue)}pe.dts<v[Se>0?Se-1:Se].dts&&(be=!0)}be&&v.sort(function(xt,mt){var nt=xt.dts-mt.dts,_t=xt.pts-mt.pts;return nt||_t}),X=v[0].dts,q=v[v.length-1].dts;var te=Math.round((q-X)/(F-1));if(Ae<0){if(Ae<te*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(p.toMsFromMpegTsClock)(-te,!0)+" ms");for(var fe=Ae,oe=0;oe<F;oe++)v[oe].dts=fe=Math.max(fe,v[oe].pts-te),v[oe].pts=Math.max(fe,v[oe].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(p.toMsFromMpegTsClock)(Ae,!0)+" ms to overcome this issue");for(var Le=0;Le<F;Le++)v[Le].dts=v[Le].dts+Ae}X=v[0].dts}if(a){var _e=X-V,Ee=_e>te,Pe=_e<-1;if(Ee||Pe){Ee?P.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(_e,!0)+" ms ("+_e+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(-_e,!0)+" ms ("+_e+"dts) overlapping between fragments detected"),X=V;var Be=v[0].pts-_e;v[0].dts=X,v[0].pts=Be,P.logger.log("Video: First PTS/DTS adjusted: "+Object(p.toMsFromMpegTsClock)(Be,!0)+"/"+Object(p.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(p.toMsFromMpegTsClock)(_e,!0)+" ms")}}o&&(X=Math.max(0,X));for(var Ve=0,We=0,Fe=0;Fe<F;Fe++){for(var Ue=v[Fe],st=Ue.units,ot=st.length,it=0,Je=0;Je<ot;Je++)it+=st[Je].data.length;We+=it,Ve+=ot,Ue.length=it,Ue.dts=Math.max(Ue.dts,X),Ue.pts=Math.max(Ue.pts,Ue.dts,0),ae=Math.min(Ue.pts,ae),de=Math.max(Ue.pts,de)}q=v[F-1].dts;var rt=We+4*Ve+8,$e;try{$e=new Uint8Array(rt)}catch(xt){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var Ze=new DataView($e.buffer);Ze.setUint32(0,rt),$e.set(_.default.types.mdat,4);for(var Oe=0;Oe<F;Oe++){for(var ut=v[Oe],at=ut.units,Ie=0,He=0,xe=at.length;He<xe;He++){var me=at[He],ye=me.data,re=me.data.byteLength;Ze.setUint32(I,re),I+=4,$e.set(ye,I),I+=re,Ie+=4+re}if(Oe<F-1)N=v[Oe+1].dts-ut.dts;else{var ne=this.config,le=ut.dts-v[Oe>0?Oe-1:Oe].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ne.maxBufferHole*x),ke=(S?ae+S*x:this.nextAudioPts)-ut.pts;ke>he?(N=ke-le,N<0&&(N=le),P.logger.log("[mp4-remuxer]: It is approximately "+ke/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var Me=Math.round(ut.pts-ut.dts);O.push(new f(ut.key,N,Ie,Me))}if(O.length&&E&&E<70){var Ye=O[0].flags;Ye.dependsOn=2,Ye.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=q+N,this.isVideoContiguous=!0;var yt=_.default.moof(c.sequenceNumber++,X,b({},c,{samples:O})),At="video",ze={data1:yt,data2:$e,startPTS:ae/x,endPTS:(de+N)/x,startDTS:X/x,endDTS:V/x,type:At,hasAudio:!1,hasVideo:!0,nb:O.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert($e.length,"MDAT length must not be zero"),ze},T.remuxAudio=function(c,u,a,S,x){var v=c.inputTimeScale,O=c.samplerate?c.samplerate:v,F=v/O,W=c.isAAC?L:C,V=W*F,I=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,X=[],q=c.samples,ae=N?0:8,de=this.nextAudioPts||-1,Ae=u*v;if(this.isAudioContiguous=a=a||q.length&&de>0&&(S&&Math.abs(Ae-de)<9e3||Math.abs(d(q[0].pts-I,Ae)-de)<20*V),q.forEach(function(ye){ye.pts=d(ye.pts-I,Ae)}),!a||de<0){if(q=q.filter(function(ye){return ye.pts>=0}),!q.length)return;x===0?de=0:S?de=Math.max(0,Ae):de=q[0].pts}if(c.isAAC)for(var be=x!==void 0,Ce=this.config.maxAudioFramesDrift,Te=0,Se=de;Te<q.length;Te++){var pe=q[Te],ue=pe.pts,te=ue-Se,fe=Math.abs(1e3*te/v);if(te<=-Ce*V&&be)Te===0&&(P.logger.warn("Audio frame @ "+(ue/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/v)+" ms."),this.nextAudioPts=de=Se=ue);else if(te>=Ce*V&&fe<M&&be){var oe=Math.round(te/V);Se=ue-oe*V,Se<0&&(oe--,Se+=V),Te===0&&(this.nextAudioPts=de=Se),P.logger.warn("[mp4-remuxer]: Injecting "+oe+" audio frame @ "+(Se/v).toFixed(3)+"s due to "+Math.round(1e3*te/v)+" ms gap.");for(var Le=0;Le<oe;Le++){var _e=Math.max(Se,0),Ee=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Ee||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=pe.unit.subarray()),q.splice(Te,0,{unit:Ee,pts:_e}),Se+=V,Te++}}pe.pts=Se,Se+=V}for(var Pe=null,Be=null,Ve,We=0,Fe=q.length;Fe--;)We+=q[Fe].unit.byteLength;for(var Ue=0,st=q.length;Ue<st;Ue++){var ot=q[Ue],it=ot.unit,Je=ot.pts;if(Be!==null){var rt=X[Ue-1];rt.duration=Math.round((Je-Be)/F)}else if(a&&c.isAAC&&(Je=de),Pe=Je,We>0){We+=ae;try{Ve=new Uint8Array(We)}catch(ye){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!N){var $e=new DataView(Ve.buffer);$e.setUint32(0,We),Ve.set(_.default.types.mdat,4)}}else return;Ve.set(it,ae);var Ze=it.byteLength;ae+=Ze,X.push(new f(!0,W,Ze,0)),Be=Je}var Oe=X.length;if(!Oe)return;var ut=X[X.length-1];this.nextAudioPts=de=Be+F*ut.duration;var at=N?new Uint8Array(0):_.default.moof(c.sequenceNumber++,Pe/F,b({},c,{samples:X}));c.samples=[];var Ie=Pe/v,He=de/v,xe="audio",me={data1:at,data2:Ve,startPTS:Ie,endPTS:He,startDTS:Ie,endDTS:He,type:xe,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(Ve.length,"MDAT length must not be zero"),me},T.remuxEmptyAudio=function(c,u,a,S){var x=c.inputTimeScale,v=c.samplerate?c.samplerate:x,O=x/v,F=this.nextAudioPts,W=(F!==null?F:S.startDTS*x)+this._initDTS,V=S.endDTS*x+this._initDTS,I=O*L,N=Math.ceil((V-W)/I),X=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],ae=0;ae<N;ae++){var de=W+ae*I;q.push({unit:X,pts:de,dts:de})}return c.samples=q,this.remuxAudio(c,u,a,!1)},T.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var S=c.inputTimeScale,x=this._initPTS,v=this._initDTS,O=0;O<a;O++){var F=c.samples[O];F.pts=d(F.pts-x,u*S)/S,F.dts=d(F.dts-v,u*S)/S}var W=c.samples;return c.samples=[],{samples:W}},T.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var S=c.inputTimeScale,x=this._initPTS,v=0;v<a;v++){var O=c.samples[v];O.pts=d(O.pts-x,u*S)/S}c.samples.sort(function(W,V){return W.pts-V.pts});var F=c.samples;return c.samples=[],{samples:F}},D}();function d(D,T){var g;if(T===null)return D;for(T<D?g=-8589934592:g=8589934592;Math.abs(D-T)>4294967296;)D+=g;return D}function w(D){for(var T=0;T<D.length;T++)if(D[T].key)return T;return-1}var f=function(T,g,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=u,this.flags=new y(T)},y=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/mp4-tools.ts"),_=R("./src/loader/fragment.ts"),j=R("./src/utils/logger.ts"),B=function(){function p(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var b=p.prototype;return b.destroy=function(){},b.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(L,C,E){this.audioCodec=C,this.videoCodec=E,this.generateInitSegment(L),this.emitInitSegment=!0},b.generateInitSegment=function(L){var C=this.audioCodec,E=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(L);C||(C=A(h.audio,_.ElementaryStreamTypes.AUDIO)),E||(E=A(h.video,_.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:C+","+E,initSegment:L,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:C,initSegment:L,id:"audio"}:h.video?o.video={container:"video/mp4",codec:E,initSegment:L,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},b.remux=function(L,C,E,h,o){var l=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:h,id3:E,initSegment:void 0};Object(Y.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var f=C.samples;if(!f||!f.length)return w;var y={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(f),D=this.initData),!D||!D.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(l)||(this.initPTS=y.initPTS=l=P(D,f,d));var T=Object(U.getDuration)(f,D),g=d,c=T+g;Object(U.offsetStartDTS)(D,f,l),T>0?this.lastEndDTS=c:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!D.audio,a=!!D.video,S="";u&&(S+="audio"),a&&(S+="video");var x={data1:f,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:S,hasAudio:u,hasVideo:a,nb:1,dropped:0};return w.audio=x.type==="audio"?x:void 0,w.video=x.type!=="audio"?x:void 0,w.text=h,w.id3=E,w.initSegment=y,w},p}(),P=function(b,M,L){return Object(U.getStartDTS)(b,M)-L};function A(p,b){var M=p==null?void 0:p.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||b===_.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Q.default=B},"./src/task-loop.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return Y});var Y=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var _=U.prototype;return _.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},_.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},_.onHandlerDestroyed=function(){},_.hasInterval=function(){return!!this._tickInterval},_.hasNextTick=function(){return!!this._tickTimer},_.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},_.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},_.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},_.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},_.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},_.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"CMCDVersion",function(){return Y}),R.d(Q,"CMCDObjectType",function(){return U}),R.d(Q,"CMCDStreamingFormat",function(){return _}),R.d(Q,"CMCDStreamType",function(){return j});var Y=1,U;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(U||(U={}));var _;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(_||(_={}));var j;(function(B){B.VOD="v",B.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"HlsSkip",function(){return _}),R.d(Q,"getSkipValue",function(){return j}),R.d(Q,"HlsUrlParameters",function(){return B}),R.d(Q,"Level",function(){return P});function Y(A,p){for(var b=0;b<p.length;b++){var M=p[b];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function U(A,p,b){return p&&Y(A.prototype,p),b&&Y(A,b),A}var _;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(_||(_={}));function j(A,p){var b=A.canSkipUntil,M=A.canSkipDateRanges,L=A.endSN,C=p!==void 0?p-L:0;return b&&C<b?M?_.v2:_.Yes:_.No}var B=function(){function A(b,M,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=M,this.skip=L}var p=A.prototype;return p.addDirectives=function(M){var L=new self.URL(M);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},A}(),P=function(){function A(p){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[p.url],this.attrs=p.attrs,this.bitrate=p.bitrate,p.details&&(this.details=p.details),this.id=p.id||0,this.name=p.name,this.width=p.width||0,this.height=p.height||0,this.audioCodec=p.audioCodec,this.videoCodec=p.videoCodec,this.unknownCodecs=p.unknownCodecs,this.codecSet=[p.videoCodec,p.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return U(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(b){var M=b%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),A}()},"./src/types/loader.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"PlaylistContextType",function(){return Y}),R.d(Q,"PlaylistLevelType",function(){return U});var Y;(function(_){_.MANIFEST="manifest",_.LEVEL="level",_.AUDIO_TRACK="audioTrack",_.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var U;(function(_){_.MAIN="main",_.AUDIO="audio",_.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"ChunkMetadata",function(){return Y});var Y=function(j,B,P,A,p,b){A===void 0&&(A=0),p===void 0&&(p=-1),b===void 0&&(b=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=j,this.sn=B,this.id=P,this.size=A,this.part=p,this.partial=b};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"AttrList",function(){return _});var Y=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,_=function(){function j(P){typeof P=="string"&&(P=j.parseAttrList(P));for(var A in P)P.hasOwnProperty(A)&&(this[A]=P[A])}var B=j.prototype;return B.decimalInteger=function(A){var p=parseInt(this[A],10);return p>Number.MAX_SAFE_INTEGER?Infinity:p},B.hexadecimalInteger=function(A){if(this[A]){var p=(this[A]||"0x").slice(2);p=(p.length&1?"0":"")+p;for(var b=new Uint8Array(p.length/2),M=0;M<p.length/2;M++)b[M]=parseInt(p.slice(M*2,M*2+2),16);return b}else return null},B.hexadecimalIntegerAsNumber=function(A){var p=parseInt(this[A],16);return p>Number.MAX_SAFE_INTEGER?Infinity:p},B.decimalFloatingPoint=function(A){return parseFloat(this[A])},B.optionalFloat=function(A,p){var b=this[A];return b?parseFloat(b):p},B.enumeratedString=function(A){return this[A]},B.bool=function(A){return this[A]==="YES"},B.decimalResolution=function(A){var p=Y.exec(this[A]);return p===null?void 0:{width:parseInt(p[1],10),height:parseInt(p[2],10)}},j.parseAttrList=function(A){var p,b={},M='"';for(U.lastIndex=0;(p=U.exec(A))!==null;){var L=p[2];L.indexOf(M)===0&&L.lastIndexOf(M)===L.length-1&&(L=L.slice(1,-1)),b[p[1]]=L}return b},j}()},"./src/utils/binary-search.ts":function(ie,Q,R){"use strict";R.r(Q);var Y={search:function(_,j){for(var B=0,P=_.length-1,A=null,p=null;B<=P;){A=(B+P)/2|0,p=_[A];var b=j(p);if(b>0)B=A+1;else if(b<0)P=A-1;else return p}return null}};Q.default=Y},"./src/utils/buffer-helper.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"BufferHelper",function(){return _});var Y=R("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},_=function(){function j(){}return j.isBuffered=function(P,A){try{if(P){for(var p=j.getBuffered(P),b=0;b<p.length;b++)if(A>=p.start(b)&&A<=p.end(b))return!0}}catch(M){}return!1},j.bufferInfo=function(P,A,p){try{if(P){var b=j.getBuffered(P),M=[],L;for(L=0;L<b.length;L++)M.push({start:b.start(L),end:b.end(L)});return this.bufferedInfo(M,A,p)}}catch(C){}return{len:0,start:A,end:A,nextStart:void 0}},j.bufferedInfo=function(P,A,p){A=Math.max(0,A),P.sort(function(y,D){var T=y.start-D.start;return T||D.end-y.end});var b=[];if(p)for(var M=0;M<P.length;M++){var L=b.length;if(L){var C=b[L-1].end;P[M].start-C<p?P[M].end>C&&(b[L-1].end=P[M].end):b.push(P[M])}else b.push(P[M])}else b=P;for(var E=0,h,o=A,l=A,d=0;d<b.length;d++){var w=b[d].start,f=b[d].end;if(A+p>=w&&A<f)o=w,l=f,E=l-A;else if(A+p<w){h=w;break}}return{len:E,start:o||0,end:l||0,nextStart:h}},j.getBuffered=function(P){try{return P.buffered}catch(A){return Y.logger.log("failed to get media.buffered",A),U}},j}()},"./src/utils/cea-608-parser.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"Row",function(){return l}),R.d(Q,"CaptionScreen",function(){return d});var Y=R("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_=function(c){var u=c;return U.hasOwnProperty(c)&&(u=U[c]),String.fromCharCode(u)},j=15,B=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},p={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(L||(L={}));var C=function(){function g(){this.time=null,this.verboseLevel=L.ERROR}var c=g.prototype;return c.log=function(a,S){this.verboseLevel>=a&&Y.logger.log(this.time+" ["+a+"] "+S)},g}(),E=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},h=function(){function g(u,a,S,x,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=S||!1,this.background=x||"black",this.flash=v||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var S=["foreground","underline","italics","background","flash"],x=0;x<S.length;x++){var v=S[x];a.hasOwnProperty(v)&&(this[v]=a[v])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),o=function(){function g(u,a,S,x,v,O){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new h(a,S,x,v,O)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,S){this.uchar=a,this.penState.copy(S)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),l=function(){function g(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<B;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new h}var c=g.prototype;return c.equals=function(a){for(var S=!0,x=0;x<B;x++)if(!this.chars[x].equals(a.chars[x])){S=!1;break}return S},c.copy=function(a){for(var S=0;S<B;S++)this.chars[S].copy(a.chars[S])},c.isEmpty=function(){for(var a=!0,S=0;S<B;S++)if(!this.chars[S].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},c.moveCursor=function(a){var S=this.pos+a;if(a>1)for(var x=this.pos+1;x<S+1;x++)this.chars[x].setPenState(this.currPenState);this.setCursor(S)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var S=_(a);if(this.pos>=B){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+S+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(S,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var S;for(S=a;S<B;S++)this.chars[S].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],S=!0,x=0;x<B;x++){var v=this.chars[x].uchar;v!==" "&&(S=!1),a.push(v)}return S?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var S=this.chars[this.pos];S.setPenState(this.currPenState)},g}(),d=function(){function g(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<j;a++)this.rows.push(new l(u));this.logger=u,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var a=0;a<j;a++)this.rows[a].clear();this.currRow=j-1},c.equals=function(a){for(var S=!0,x=0;x<j;x++)if(!this.rows[x].equals(a.rows[x])){S=!1;break}return S},c.copy=function(a){for(var S=0;S<j;S++)this.rows[S].copy(a.rows[S])},c.isEmpty=function(){for(var a=!0,S=0;S<j;S++)if(!this.rows[S].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var S=this.rows[this.currRow];S.insertChar(a)},c.setPen=function(a){var S=this.rows[this.currRow];S.setPenStyles(a)},c.moveCursor=function(a){var S=this.rows[this.currRow];S.moveCursor(a)},c.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var S=this.rows[this.currRow];S.setCursor(a)},c.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var S=a.row-1;if(this.nrRollUpRows&&S<this.nrRollUpRows-1&&(S=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==S){for(var x=0;x<j;x++)this.rows[x].clear();var v=this.currRow+1-this.nrRollUpRows,O=this.lastOutputScreen;if(O){var F=O.rows[v].cueStartTime,W=this.logger.time;if(F&&W!==null&&F<W)for(var V=0;V<this.nrRollUpRows;V++)this.rows[S-this.nrRollUpRows+V+1].copy(O.rows[v+V])}}this.currRow=S;var I=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,X=Math.max(N-1,0);I.setCursor(a.indent),a.color=I.chars[X].penState.foreground}var q={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(q)},c.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,S=this.rows.splice(a,1)[0];S.clear(),this.rows.splice(this.currRow,0,S),this.logger.log(L.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var S=[],x="",v=-1,O=0;O<j;O++){var F=this.rows[O].getTextString();F&&(v=O+1,a?S.push("Row "+v+": '"+F+"'"):S.push(F.trim()))}return S.length>0&&(a?x="["+S.join(" | ")+"]":x=S.join(`
|
|
`)),x},c.getTextAndFormat=function(){return this.rows},g}(),w=function(){function g(u,a,S){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(S),this.nonDisplayedMemory=new d(S),this.lastOutputScreen=new d(S),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=S}var c=g.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[j-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 S=0;S<a.length;S++)this.writeScreen.insertChar(a[S]);var x=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,x+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var S={flash:!1};if(S.underline=a%2===1,S.italics=a>=46,S.italics)S.foreground="white";else{var x=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];S.foreground=v[x]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(S)),this.writeScreen.setPen(S)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var S=this.logger.time;if(S===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=S:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,S,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:S),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))},g}(),f=function(){function g(u,a,S){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var x=new C;this.channels=[null,new w(u,a,x),new w(u+1,S,x)],this.cmdHistory=T(),this.logger=x}var c=g.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,S){this.channels[a].setHandler(S)},c.addData=function(a,S){var x,v,O,F=!1;this.logger.time=a;for(var W=0;W<S.length;W+=2){if(v=S[W]&127,O=S[W+1]&127,v===0&&O===0)continue;if(this.logger.log(L.DATA,"["+E([S[W],S[W+1]])+"] -> ("+E([v,O])+")"),x=this.parseCmd(v,O),x||(x=this.parseMidrow(v,O)),x||(x=this.parsePAC(v,O)),x||(x=this.parseBackgroundAttributes(v,O)),!x&&(F=this.parseChars(v,O),F)){var V=this.currentChannel;if(V&&V>0){var I=this.channels[V];I.insertChars(F)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!x&&!F&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+E([v,O])+" orig: "+E([S[W],S[W+1]]))}},c.parseCmd=function(a,S){var x=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&S>=32&&S<=47,O=(a===23||a===31)&&S>=33&&S<=35;if(!(v||O))return!1;if(D(a,S,x))return y(null,null,x),this.logger.log(L.DEBUG,"Repeated command ("+E([a,S])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,W=this.channels[F];return a===20||a===21||a===28||a===29?S===32?W.ccRCL():S===33?W.ccBS():S===34?W.ccAOF():S===35?W.ccAON():S===36?W.ccDER():S===37?W.ccRU(2):S===38?W.ccRU(3):S===39?W.ccRU(4):S===40?W.ccFON():S===41?W.ccRDC():S===42?W.ccTR():S===43?W.ccRTD():S===44?W.ccEDM():S===45?W.ccCR():S===46?W.ccENM():S===47&&W.ccEOC():W.ccTO(S-32),y(a,S,x),this.currentChannel=F,!0},c.parseMidrow=function(a,S){var x=0;if((a===17||a===25)&&S>=32&&S<=47){if(a===17?x=1:x=2,x!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[x];return v?(v.ccMIDROW(S),this.logger.log(L.DEBUG,"MIDROW ("+E([a,S])+")"),!0):!1}return!1},c.parsePAC=function(a,S){var x,v=this.cmdHistory,O=(a>=17&&a<=23||a>=25&&a<=31)&&S>=64&&S<=127,F=(a===16||a===24)&&S>=64&&S<=95;if(!(O||F))return!1;if(D(a,S,v))return y(null,null,v),!0;var W=a<=23?1:2;S>=64&&S<=95?x=W===1?P[a]:p[a]:x=W===1?A[a]:b[a];var V=this.channels[W];return V?(V.setPAC(this.interpretPAC(x,S)),y(a,S,v),this.currentChannel=W,!0):!1},c.interpretPAC=function(a,S){var x,v={color:null,italics:!1,indent:null,underline:!1,row:a};return S>95?x=S-96:x=S-64,v.underline=(x&1)===1,x<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(x/2)]:x<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((x-16)/2)*4,v},c.parseChars=function(a,S){var x,v=null,O=null;if(a>=25?(x=2,O=a-8):(x=1,O=a),O>=17&&O<=19){var F;O===17?F=S+80:O===18?F=S+112:F=S+144,this.logger.log(L.INFO,"Special char '"+_(F)+"' in channel "+x),v=[F]}else a>=32&&a<=127&&(v=S===0?[a]:[a,S]);if(v){var W=E(v);this.logger.log(L.DEBUG,"Char codes = "+W.join(",")),y(a,S,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,S){var x=(a===16||a===24)&&S>=32&&S<=47,v=(a===23||a===31)&&S>=45&&S<=47;if(!(x||v))return!1;var O,F={};a===16||a===24?(O=Math.floor((S-32)/2),F.background=M[O],S%2===1&&(F.background=F.background+"_semi")):S===45?F.background="transparent":(F.foreground="black",S===47&&(F.underline=!0));var W=a<=23?1:2,V=this.channels[W];return V.setBkgData(F),y(a,S,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var S=this.channels[a];S&&S.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(a){for(var S=0;S<this.channels.length;S++){var x=this.channels[S];x&&x.cueSplitAtTime(a)}},g}();function y(g,c,u){u.a=g,u.b=c}function D(g,c,u){return u.a===g&&u.b===c}function T(){return{a:null,b:null}}Q.default=f},"./src/utils/codecs.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"isCodecType",function(){return U}),R.d(Q,"isCodecSupportedInMp4",function(){return _});var Y={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(j,B){var P=Y[B];return!!P&&P[j.slice(0,4)]===!0}function _(j,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/utils/vttparser.ts"),U=R("./src/utils/webvtt-parser.ts"),_=R("./src/utils/texttrack-utils.ts"),j=/\s/,B={newCue:function(A,p,b,M){for(var L=[],C,E,h,o,l,d=self.VTTCue||self.TextTrackCue,w=0;w<M.rows.length;w++)if(C=M.rows[w],h=!0,o=0,l="",!C.isEmpty()){for(var f=0;f<C.chars.length;f++)j.test(C.chars[f].uchar)&&h?o++:(l+=C.chars[f].uchar,h=!1);C.cueStartTime=p,p===b&&(b+=1e-4),o>=16?o--:o++;var y=Object(Y.fixLineBreaks)(l.trim()),D=Object(U.generateCueId)(p,b,y);(!A||!A.cues||!A.cues.getCueById(D))&&(E=new d(p,b,y),E.id=D,E.line=w+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(E))}return A&&L.length&&(L.sort(function(T,g){return T.line==="auto"||g.line==="auto"?0:T.line>8&&g.line>8?g.line-T.line:T.line-g.line}),L.forEach(function(T){return Object(_.addCueToTrack)(A,T)})),L}};Q.default=B},"./src/utils/discontinuities.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"findFirstFragWithCC",function(){return j}),R.d(Q,"shouldAlignOnDiscontinuities",function(){return B}),R.d(Q,"findDiscontinuousReferenceFrag",function(){return P}),R.d(Q,"adjustSlidingStart",function(){return p}),R.d(Q,"alignStream",function(){return b}),R.d(Q,"alignPDT",function(){return L}),R.d(Q,"alignFragmentByPDTDelta",function(){return C}),R.d(Q,"alignMediaPlaylistByPDT",function(){return E});var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts"),_=R("./src/controller/level-helper.ts");function j(h,o){for(var l=null,d=0,w=h.length;d<w;d++){var f=h[d];if(f&&f.cc===o){l=f;break}}return l}function B(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function P(h,o){var l=h.fragments,d=o.fragments;if(!d.length||!l.length){U.logger.log("No fragments to align");return}var w=j(l,d[0].cc);if(!w||w&&!w.startPTS){U.logger.log("No frag in previous level to align on");return}return w}function A(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function p(h,o){for(var l=o.fragments,d=0,w=l.length;d<w;d++)A(l[d],h);o.fragmentHint&&A(o.fragmentHint,h),o.alignedSliding=!0}function b(h,o,l){if(!o)return;M(h,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(_.adjustSliding)(o.details,l)}function M(h,o,l){if(B(h,l,o)){var d=P(l.details,o);d&&Object(Y.isFiniteNumber)(d.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),p(d.start,o))}}function L(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,w=(d-l)/1e3+o.fragments[0].start;w&&Object(Y.isFiniteNumber)(w)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+w.toFixed(3)+" "+h.url+" "),p(w,h))}function C(h,o){var l=h.programDateTime;if(!l)return;var d=(l-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function E(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,w=l-d*1e3;h.fragments.forEach(function(f){C(f,w)}),h.fragmentHint&&C(h.fragmentHint,w),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/utils/ewma.ts"),U=function(){function _(B,P,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(B),this.fast_=new Y.default(P)}var j=_.prototype;return j.update=function(P,A){var p=this.slow_,b=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new Y.default(P,p.getEstimate(),p.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new Y.default(A,b.getEstimate(),b.getTotalWeight()))},j.sample=function(P,A){P=Math.max(P,this.minDelayMs_);var p=8*A,b=P/1e3,M=p/b;this.fast_.sample(b,M),this.slow_.sample(b,M)},j.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},_}();Q.default=U},"./src/utils/ewma.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=function(){function U(j,B,P){B===void 0&&(B=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=B,this.totalWeight_=P}var _=U.prototype;return _.sample=function(B,P){var A=Math.pow(this.alpha_,B);this.estimate_=P*(1-A)+A*this.estimate_,this.totalWeight_+=B},_.getTotalWeight=function(){return this.totalWeight_},_.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},U}();Q.default=Y},"./src/utils/fetch-loader.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"fetchSupported",function(){return C});var Y=R("./src/polyfills/number.ts"),U=R("./src/loader/load-stats.ts"),_=R("./src/demux/chunk-cache.ts");function j(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,b(d,w)}function B(d){var w=typeof Map=="function"?new Map:void 0;return B=function(y){if(y===null||!p(y))return y;if(typeof y!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(y))return w.get(y);w.set(y,D)}function D(){return P(y,arguments,M(this).constructor)}return D.prototype=Object.create(y.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),b(D,y)},B(d)}function P(d,w,f){return A()?P=Reflect.construct:P=function(D,T,g){var c=[null];c.push.apply(c,T);var u=Function.bind.apply(D,c),a=new u;return g&&b(a,g.prototype),a},P.apply(null,arguments)}function A(){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 p(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function b(d,w){return b=Object.setPrototypeOf||function(y,D){return y.__proto__=D,y},b(d,w)}function M(d){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},M(d)}function L(){return L=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var f=arguments[w];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(d[y]=f[y])}return d},L.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var E=function(){function d(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var y=this.response;(!y||!y.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(y,D,T){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=h(y,this.controller.signal),a=T.onProgress,S=y.responseType==="arraybuffer",x=S?"byteLength":"length";this.context=y,this.config=D,this.callbacks=T,this.request=this.fetchSetup(y,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),T.onTimeout(c,y,g.response)},D.timeout),self.fetch(this.request).then(function(v){if(g.response=g.loader=v,!v.ok){var O=v.status,F=v.statusText;throw new l(F||"fetch, bad network response",O,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(Y.isFiniteNumber)(D.highWaterMark)?g.loadProgressively(v,c,y,D.highWaterMark,a):S?v.arrayBuffer():v.text()}).then(function(v){var O=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[x];var F={url:O.url,data:v};a&&!Object(Y.isFiniteNumber)(D.highWaterMark)&&a(c,y,v,O),T.onSuccess(F,c,y,O)}).catch(function(v){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var O=v.code||0;T.onError({code:O,text:v.message},y,v.details)})},w.getCacheAge=function(){var y=null;if(this.response){var D=this.response.headers.get("age");y=D?parseFloat(D):null}return y},w.loadProgressively=function(y,D,T,g,c){g===void 0&&(g=0);var u=new _.default,a=y.body.getReader(),S=function x(){return a.read().then(function(v){if(v.done)return u.dataLength&&c(D,T,u.flush(),y),Promise.resolve(new ArrayBuffer(0));var O=v.value,F=O.length;return D.loaded+=F,F<g||u.dataLength?(u.push(O),u.dataLength>=g&&c(D,T,u.flush(),y)):c(D,T,O,y),x()}).catch(function(){return Promise.reject()})};return S()},d}();function h(d,w){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(L({},d.headers))};return d.rangeEnd&&f.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),f}function o(d,w){return new self.Request(d.url,w)}var l=function(d){j(w,d);function w(f,y,D){var T;return T=d.call(this,f)||this,T.code=void 0,T.details=void 0,T.code=y,T.details=D,T}return w}(B(Error));Q.default=E},"./src/utils/imsc1-ttml-parser.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"IMSC1_CODEC",function(){return p}),R.d(Q,"parseIMSC1",function(){return C});var Y=R("./src/utils/mp4-tools.ts"),U=R("./src/utils/vttparser.ts"),_=R("./src/utils/vttcue.ts"),j=R("./src/demux/id3.ts"),B=R("./src/utils/timescale-conversion.ts"),P=R("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(g[a]=u[a])}return g},A.apply(this,arguments)}var p="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(g,c,u,a,S){var x=Object(Y.findBox)(new Uint8Array(g),["mdat"]);if(x.length===0){S(new Error("Could not parse IMSC1 mdat"));return}var v=x[0],O=Object(j.utf8ArrayToStr)(new Uint8Array(g,v.start,v.end-v.start)),F=Object(B.toTimescaleFromScale)(c,1,u);try{a(E(O,F))}catch(W){S(W)}}function E(g,c){var u=new DOMParser,a=u.parseFromString(g,"text/xml"),S=a.getElementsByTagName("tt")[0];if(!S)throw new Error("Invalid ttml");var x={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(x).reduce(function(I,N){return I[N]=S.getAttribute("ttp:"+N)||x[N],I},{}),O=S.getAttribute("xml:space")!=="preserve",F=o(h(S,"styling","style")),W=o(h(S,"layout","region")),V=h(S,"body","[begin]");return[].map.call(V,function(I){var N=l(I,O);if(!N||!I.hasAttribute("begin"))return null;var X=y(I.getAttribute("begin"),v),q=y(I.getAttribute("dur"),v),ae=y(I.getAttribute("end"),v);if(X===null)throw f(I);if(ae===null){if(q===null)throw f(I);ae=X+q}var de=new _.default(X-c,ae-c,N);de.id=Object(P.generateCueId)(de.startTime,de.endTime,de.text);var Ae=W[I.getAttribute("region")],be=F[I.getAttribute("style")];de.position=10,de.size=80;var Ce=d(Ae,be),Te=Ce.textAlign;if(Te){var Se=L[Te];Se&&(de.lineAlign=Se),de.align=Te}return A(de,Ce),de}).filter(function(I){return I!==null})}function h(g,c,u){var a=g.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(g){return g.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(g,c){return[].slice.call(g.childNodes).reduce(function(u,a,S){var x;return a.nodeName==="br"&&S?u+`
|
|
`:(x=a.childNodes)!==null&&x!==void 0&&x.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function d(g,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(S,x){var v=w(c,u,x)||w(g,u,x);return v&&(S[x]=v),S},{})}function w(g,c,u){return g.hasAttributeNS(c,u)?g.getAttributeNS(c,u):null}function f(g){return new Error("Could not parse ttml timestamp "+g)}function y(g,c){if(!g)return null;var u=Object(U.parseTimeStamp)(g);return u===null&&(b.test(g)?u=D(g,c):M.test(g)&&(u=T(g,c))),u}function D(g,c){var u=b.exec(g),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function T(g,c){var u=M.exec(g),a=Number(u[1]),S=u[2];switch(S){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"enableLogs",function(){return P}),R.d(Q,"logger",function(){return A});var Y=function(){},U={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},_=U;function j(p){var b=self.console[p];return b?b.bind(self.console,"["+p+"] >"):Y}function B(p){for(var b=arguments.length,M=new Array(b>1?b-1:0),L=1;L<b;L++)M[L-1]=arguments[L];M.forEach(function(C){_[C]=p[C]?p[C].bind(p):j(C)})}function P(p){if(self.console&&p===!0||typeof p=="object"){B(p,"debug","log","info","warn","error");try{_.log()}catch(b){_=U}}else _=U}var A=_},"./src/utils/mediakeys-helper.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"KeySystems",function(){return Y}),R.d(Q,"requestMediaKeySystemAccess",function(){return U});var Y;(function(_){_.WIDEVINE="com.widevine.alpha",_.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"bin2str",function(){return B}),R.d(Q,"readUint16",function(){return P}),R.d(Q,"readUint32",function(){return A}),R.d(Q,"writeUint32",function(){return p}),R.d(Q,"findBox",function(){return b}),R.d(Q,"parseSegmentIndex",function(){return M}),R.d(Q,"parseInitSegment",function(){return L}),R.d(Q,"getStartDTS",function(){return C}),R.d(Q,"getDuration",function(){return E}),R.d(Q,"computeRawDurationFromSamples",function(){return h}),R.d(Q,"offsetStartDTS",function(){return o}),R.d(Q,"segmentValidRange",function(){return l}),R.d(Q,"appendUint8Array",function(){return d});var Y=R("./src/utils/typed-array.ts"),U=R("./src/loader/fragment.ts"),_=Math.pow(2,32)-1,j=[].push;function B(w){return String.fromCharCode.apply(null,w)}function P(w,f){"data"in w&&(f+=w.start,w=w.data);var y=w[f]<<8|w[f+1];return y<0?65536+y:y}function A(w,f){"data"in w&&(f+=w.start,w=w.data);var y=w[f]<<24|w[f+1]<<16|w[f+2]<<8|w[f+3];return y<0?4294967296+y:y}function p(w,f,y){"data"in w&&(f+=w.start,w=w.data),w[f]=y>>24,w[f+1]=y>>16&255,w[f+2]=y>>8&255,w[f+3]=y&255}function b(w,f){var y=[];if(!f.length)return y;var D,T,g;"data"in w?(D=w.data,T=w.start,g=w.end):(D=w,T=0,g=D.byteLength);for(var c=T;c<g;){var u=A(D,c),a=B(D.subarray(c+4,c+8)),S=u>1?c+u:g;if(a===f[0])if(f.length===1)y.push({data:D,start:c+8,end:S});else{var x=b({data:D,start:c+8,end:S},f.slice(1));x.length&&j.apply(y,x)}c=S}return y}function M(w){var f=b(w,["moov"]),y=f[0],D=y?y.end:null,T=b(w,["sidx"]);if(!T||!T[0])return null;var g=[],c=T[0],u=c.data[0],a=u===0?8:16,S=A(c,a);a+=4;var x=0,v=0;u===0?a+=8:a+=16,a+=2;var O=c.end+v,F=P(c,a);a+=2;for(var W=0;W<F;W++){var V=a,I=A(c,V);V+=4;var N=I&2147483647,X=(I&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=A(c,V);V+=4,g.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/S,start:O,end:O+N-1}}),O+=N,V+=4,a=V}return{earliestPresentationTime:x,timescale:S,version:u,referencesCount:F,references:g,moovEndOffset:D}}function L(w){for(var f=[],y=b(w,["moov","trak"]),D=0;D<y.length;D++){var T=y[D],g=b(T,["tkhd"])[0];if(g){var c=g.data[g.start],u=c===0?12:20,a=A(g,u),S=b(T,["mdia","mdhd"])[0];if(S){c=S.data[S.start],u=c===0?12:20;var x=A(S,u),v=b(T,["mdia","hdlr"])[0];if(v){var O=B(v.data.subarray(v.start+8,v.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[O];if(F){var W=b(T,["mdia","minf","stbl","stsd"])[0],V=void 0;W&&(V=B(W.data.subarray(W.start+12,W.start+16))),f[a]={timescale:x,type:F},f[F]={timescale:x,id:a,codec:V}}}}}}var I=b(w,["moov","mvex","trex"]);return I.forEach(function(N){var X=A(N,4),q=f[X];q&&(q.default={duration:A(N,12),flags:A(N,20)})}),f}function C(w,f){return b(f,["moof","traf"]).reduce(function(y,D){var T=b(D,["tfdt"])[0],g=T.data[T.start],c=b(D,["tfhd"]).reduce(function(u,a){var S=A(a,4),x=w[S];if(x){var v=A(T,4);g===1&&(v*=Math.pow(2,32),v+=A(T,8));var O=x.timescale||9e4,F=v/O;if(isFinite(F)&&(u===null||F<u))return F}return u},null);return c!==null&&isFinite(c)&&(y===null||c<y)?c:y},null)||0}function E(w,f){for(var y=0,D=0,T=0,g=b(w,["moof","traf"]),c=0;c<g.length;c++){var u=g[c],a=b(u,["tfhd"])[0],S=A(a,4),x=f[S];if(!x)continue;var v=x.default,O=A(a,0)|(v==null?void 0:v.flags),F=v==null?void 0:v.duration;O&8&&(O&2?F=A(a,12):F=A(a,8));for(var W=x.timescale||9e4,V=b(u,["trun"]),I=0;I<V.length;I++){if(F){var N=A(V[I],4);y=F*N}else y=h(V[I]);x.type===U.ElementaryStreamTypes.VIDEO?D+=y/W:x.type===U.ElementaryStreamTypes.AUDIO&&(T+=y/W)}}if(D===0&&T===0){var X=M(w);if(X!=null&&X.references)return X.references.reduce(function(q,ae){return q+ae.info.duration||0},0)}return D||T}function h(w){var f=A(w,0),y=8;f&1&&(y+=4),f&4&&(y+=4);for(var D=0,T=A(w,4),g=0;g<T;g++){if(f&256){var c=A(w,y);D+=c,y+=4}f&512&&(y+=4),f&1024&&(y+=4),f&2048&&(y+=4)}return D}function o(w,f,y){b(f,["moof","traf"]).forEach(function(D){b(D,["tfhd"]).forEach(function(T){var g=A(T,4),c=w[g];if(!c)return;var u=c.timescale||9e4;b(D,["tfdt"]).forEach(function(a){var S=a.data[a.start],x=A(a,4);if(S===0)p(a,4,x-y*u);else{x*=Math.pow(2,32),x+=A(a,8),x-=y*u,x=Math.max(x,0);var v=Math.floor(x/(_+1)),O=Math.floor(x%(_+1));p(a,4,v),p(a,8,O)}})})})}function l(w){var f={valid:null,remainder:null},y=b(w,["moof"]);if(y){if(y.length<2)return f.remainder=w,f}else return f;var D=y[y.length-1];return f.valid=Object(Y.sliceUint8)(w,0,D.start-8),f.remainder=Object(Y.sliceUint8)(w,D.start-8),f}function d(w,f){var y=new Uint8Array(w.length+f.length);return y.set(w),y.set(f,w.length),y}},"./src/utils/output-filter.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"default",function(){return Y});var Y=function(){function U(j,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=B}var _=U.prototype;return _.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},_.newCue=function(B,P,A){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},_.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"sendAddTrackEvent",function(){return U}),R.d(Q,"addCueToTrack",function(){return _}),R.d(Q,"clearCurrentCues",function(){return j}),R.d(Q,"removeCuesInRange",function(){return B}),R.d(Q,"getCuesInRange",function(){return A});var Y=R("./src/utils/logger.ts");function U(p,b){var M;try{M=new Event("addtrack")}catch(L){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=p,b.dispatchEvent(M)}function _(p,b){var M=p.mode;if(M==="disabled"&&(p.mode="hidden"),p.cues&&!p.cues.getCueById(b.id))try{if(p.addCue(b),!p.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(C){Y.logger.debug("[texttrack-utils]: "+C);var L=new self.TextTrackCue(b.startTime,b.endTime,b.text);L.id=b.id,p.addCue(L)}M==="disabled"&&(p.mode=M)}function j(p){var b=p.mode;if(b==="disabled"&&(p.mode="hidden"),p.cues)for(var M=p.cues.length;M--;)p.removeCue(p.cues[M]);b==="disabled"&&(p.mode=b)}function B(p,b,M){var L=p.mode;if(L==="disabled"&&(p.mode="hidden"),p.cues&&p.cues.length>0)for(var C=A(p.cues,b,M),E=0;E<C.length;E++)p.removeCue(C[E]);L==="disabled"&&(p.mode=L)}function P(p,b){if(b<p[0].startTime)return 0;var M=p.length-1;if(b>p[M].endTime)return-1;for(var L=0,C=M;L<=C;){var E=Math.floor((C+L)/2);if(b<p[E].startTime)C=E-1;else if(b>p[E].startTime&&L<M)L=E+1;else return E}return p[L].startTime-b<b-p[C].startTime?L:C}function A(p,b,M){var L=[],C=P(p,b);if(C>-1)for(var E=C,h=p.length;E<h;E++){var o=p[E];if(o.startTime>=b&&o.endTime<=M)L.push(o);else if(o.startTime>M)return L}return L}},"./src/utils/time-ranges.ts":function(ie,Q,R){"use strict";R.r(Q);var Y={toString:function(_){for(var j="",B=_.length,P=0;P<B;P++)j+="["+_.start(P).toFixed(3)+","+_.end(P).toFixed(3)+"]";return j}};Q.default=Y},"./src/utils/timescale-conversion.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"toTimescaleFromBase",function(){return U}),R.d(Q,"toTimescaleFromScale",function(){return _}),R.d(Q,"toMsFromMpegTsClock",function(){return j}),R.d(Q,"toMpegTsClockFromTimescale",function(){return B});var Y=9e4;function U(P,A,p,b){p===void 0&&(p=1),b===void 0&&(b=!1);var M=P*A*p;return b?Math.round(M):M}function _(P,A,p,b){return p===void 0&&(p=1),b===void 0&&(b=!1),U(P,A,1/p,b)}function j(P,A){return A===void 0&&(A=!1),U(P,1e3,1/Y,A)}function B(P,A){return A===void 0&&(A=1),U(P,Y,1/A)}},"./src/utils/typed-array.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"sliceUint8",function(){return Y});function Y(U,_,j){return Uint8Array.prototype.slice?U.slice(_,j):new Uint8Array(Array.prototype.slice.call(U,_,j))}},"./src/utils/vttcue.ts":function(ie,Q,R){"use strict";R.r(Q),Q.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],U=["start","middle","end","left","right"];function _(p,b){if(typeof b!="string")return!1;if(!Array.isArray(p))return!1;var M=b.toLowerCase();return~p.indexOf(M)?M:!1}function j(p){return _(Y,p)}function B(p){return _(U,p)}function P(p){for(var b=arguments.length,M=new Array(b>1?b-1:0),L=1;L<b;L++)M[L-1]=arguments[L];for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var h in E)p[h]=E[h]}return p}function A(p,b,M){var L=this,C={enumerable:!0};L.hasBeenReset=!1;var E="",h=!1,o=p,l=b,d=M,w=null,f="",y=!0,D="auto",T="start",g=50,c="middle",u=50,a="middle";Object.defineProperty(L,"id",P({},C,{get:function(){return E},set:function(x){E=""+x}})),Object.defineProperty(L,"pauseOnExit",P({},C,{get:function(){return h},set:function(x){h=!!x}})),Object.defineProperty(L,"startTime",P({},C,{get:function(){return o},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");o=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",P({},C,{get:function(){return l},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");l=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",P({},C,{get:function(){return d},set:function(x){d=""+x,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",P({},C,{get:function(){return w},set:function(x){w=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",P({},C,{get:function(){return f},set:function(x){var v=j(x);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",P({},C,{get:function(){return y},set:function(x){y=!!x,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",P({},C,{get:function(){return D},set:function(x){if(typeof x!="number"&&x!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",P({},C,{get:function(){return T},set:function(x){var v=B(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");T=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",P({},C,{get:function(){return g},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");g=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",P({},C,{get:function(){return c},set:function(x){var v=B(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",P({},C,{get:function(){return u},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");u=x,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",P({},C,{get:function(){return a},set:function(x){var v=B(x);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),L.displayState=void 0}return A.prototype.getCueAsHTML=function(){var p=self.WebVTT;return p.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"parseTimeStamp",function(){return _}),R.d(Q,"fixLineBreaks",function(){return b}),R.d(Q,"VTTParser",function(){return M});var Y=R("./src/utils/vttcue.ts"),U=function(){function L(){}var C=L.prototype;return C.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},L}();function _(L){function C(h,o,l,d){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var E=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?C(E[2],E[3],0,E[4]):C(E[1],E[2],E[3],E[4]):null}var j=function(){function L(){this.values=Object.create(null)}var C=L.prototype;return C.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},C.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},C.has=function(h){return h in this.values},C.alt=function(h,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(h,o);break}},C.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},C.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},L}();function B(L,C,E,h){var o=h?L.split(h):[L];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(E);if(d.length!==2)continue;var w=d[0],f=d[1];C(w,f)}}var P=new Y.default(0,0,""),A=P.align==="middle"?"middle":"center";function p(L,C,E){var h=L;function o(){var w=_(L);if(w===null)throw new Error("Malformed timestamp: "+h);return L=L.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,f){var y=new j;B(w,function(g,c){var u;switch(g){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===c){y.set(g,E[a].region);break}break;case"vertical":y.alt(g,c,["rl","lr"]);break;case"line":u=c.split(","),y.integer(g,u[0]),y.percent(g,u[0])&&y.set("snapToLines",!1),y.alt(g,u[0],["auto"]),u.length===2&&y.alt("lineAlign",u[1],["start",A,"end"]);break;case"position":u=c.split(","),y.percent(g,u[0]),u.length===2&&y.alt("positionAlign",u[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":y.percent(g,c);break;case"align":y.alt(g,c,["start",A,"end","left","right"]);break}},/:/,/\s/),f.region=y.get("region",null),f.vertical=y.get("vertical","");var D=y.get("line","auto");D==="auto"&&P.line===-1&&(D=-1),f.line=D,f.lineAlign=y.get("lineAlign","start"),f.snapToLines=y.get("snapToLines",!0),f.size=y.get("size",100),f.align=y.get("align",A);var T=y.get("position","auto");T==="auto"&&P.position===50&&(T=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=T}function d(){L=L.replace(/^\s+/,"")}if(d(),C.startTime=o(),d(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);L=L.substr(3),d(),C.endTime=o(),d(),l(L,C)}function b(L){return L.replace(/<br(?: \/)?>/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 C=L.prototype;return C.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var T=o.buffer,g=0;for(T=b(T);g<T.length&&T[g]!=="\r"&&T[g]!==`
|
|
`;)++g;var c=T.substr(0,g);return T[g]==="\r"&&++g,T[g]===`
|
|
`&&++g,o.buffer=T.substr(g),c}function d(T){B(T,function(g,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=l();var f=w.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var y=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;y?y=!1:w=l();switch(o.state){case"HEADER":/:/.test(w)?d(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new Y.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{p(w,o.cue,o.regionList)}catch(T){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var D=w.indexOf("-->")!==-1;if(!w||D&&(y=!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+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(T){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
|
|
|
|
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(ie,Q,R){"use strict";R.r(Q),R.d(Q,"generateCueId",function(){return M}),R.d(Q,"parseWebVTT",function(){return C});var Y=R("./src/polyfills/number.ts"),U=R("./src/utils/vttparser.ts"),_=R("./src/demux/id3.ts"),j=R("./src/utils/timescale-conversion.ts"),B=R("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,A=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},p=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),w=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(o)||!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(d)||!Object(Y.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*w,o},b=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function M(E,h,o){return b(E.toString())+b(h.toString())+b(o)}var L=function(h,o,l){var d=h[o],w=h[d.prevCC];if(!w||!w.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(f=w)!==null&&f!==void 0&&f.new;){var f;h.ccOffset+=d.start-w.start,d.new=!1,d=w,w=h[d.prevCC]}h.presentationOffset=l};function C(E,h,o,l,d,w,f,y){var D=new U.VTTParser,T=Object(_.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(P,`
|
|
`).split(`
|
|
`),g=[],c=Object(j.toMpegTsClockFromTimescale)(h,o),u="00:00.000",a=0,S=0,x,v=!0,O=!1;D.oncue=function(F){var W=l[d],V=l.ccOffset,I=(a-c)/9e4;if(W!=null&&W.new&&(S!==void 0?V=l.ccOffset=W.start:L(l,d,I)),I&&(V=I-l.presentationOffset),O){var N=F.endTime-F.startTime,X=Object(B.normalizePts)((F.startTime+V-S)*9e4,w*9e4)/9e4;F.startTime=X,F.endTime=X+N}var q=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(q)),F.id||(F.id=M(F.startTime,F.endTime,q)),F.endTime>0&&g.push(F)},D.onparsingerror=function(F){x=F},D.onflush=function(){if(x){y(x);return}f(g)},T.forEach(function(F){if(v)if(A(F,"X-TIMESTAMP-MAP=")){v=!1,O=!0,F.substr(16).split(",").forEach(function(W){A(W,"LOCAL:")?u=W.substr(6):A(W,"MPEGTS:")&&(a=parseInt(W.substr(7)))});try{S=p(u)/1e3}catch(W){O=!1,x=W}return}else F===""&&(v=!1);D.parse(F+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(ie,Q,R){"use strict";R.r(Q);var Y=R("./src/utils/logger.ts"),U=R("./src/loader/load-stats.ts"),_=/^age:\s*[\d.]+\s*$/m,j=function(){function B(A){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=A?A.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var p=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),p&&(p.onreadystatechange=null,p.onprogress=null,p.readyState!==4&&(this.stats.aborted=!0,p.abort()))},P.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(p,b,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=p,this.config=b,this.callbacks=M,this.retryDelay=b.retryDelay,this.loadInternal()},P.loadInternal=function(){var p=this.config,b=this.context;if(!p)return;var M=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var C=this.xhrSetup;try{if(C)try{C(M,b.url)}catch(o){M.open("GET",b.url,!0),C(M,b.url)}M.readyState||M.open("GET",b.url,!0);var E=this.context.headers;if(E)for(var h in E)M.setRequestHeader(h,E[h])}catch(o){this.callbacks.onError({code:M.status,text:o.message},b,M);return}b.rangeEnd&&M.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout),M.send()},P.readystatechange=function(){var p=this.context,b=this.loader,M=this.stats;if(!p||!b)return;var L=b.readyState,C=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){b.onreadystatechange=null,b.onprogress=null;var E=b.status;if(E>=200&&E<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var h,o;if(p.responseType==="arraybuffer"?(h=b.response,o=h.byteLength):(h=b.responseText,o=h.length),M.loaded=M.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,p,h,b),!this.callbacks)return;var d={url:b.responseURL,data:h};this.callbacks.onSuccess(d,M,p,b)}else M.retry>=C.maxRetry||E>=400&&E<499?(Y.logger.error(E+" while loading "+p.url),this.callbacks.onError({code:E,text:b.statusText},p,b)):(Y.logger.warn(E+" while loading "+p.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,C.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},P.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var p=this.callbacks;p&&(this.abortInternal(),p.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(p){var b=this.stats;b.loaded=p.loaded,p.lengthComputable&&(b.total=p.total)},P.getCacheAge=function(){var p=null;if(this.loader&&_.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");p=b?parseFloat(b):null}return p},B}();Q.default=j}}).default})},vHTk:function(ht,qe,se){ht.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(ht,qe){function se(){this.buffer=new Array,this.length=0}se.prototype={get:function(ie){var Q=Math.floor(ie/8);return(this.buffer[Q]>>>7-ie%8&1)==1},put:function(ie,Q){for(var R=0;R<Q;R++)this.putBit((ie>>>Q-R-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(ie){var Q=Math.floor(this.length/8);this.buffer.length<=Q&&this.buffer.push(0),ie&&(this.buffer[Q]|=128>>>this.length%8),this.length++}},ht.exports=se}}]);
|